Commit e30b047e4c9d2d2ee53fe52761949e87756a6506
Merge branch 'develop' of 120.26.43.151:wasteland/server into develop
Showing
20 changed files
with
595 additions
and
88 deletions
Show diff stats
src/actions/ActivityAction.lua
| ... | ... | @@ -70,6 +70,7 @@ function _M.sudokuRpc(agent, data) |
| 70 | 70 | activity_type = 0, -- 活动类型,见活动类型枚举表 |
| 71 | 71 | activity_reward = reward or {}, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} |
| 72 | 72 | }) |
| 73 | + role:mylog("act_action", {desc = "sudoku", int1 = id, int2 = phase}) | |
| 73 | 74 | |
| 74 | 75 | SendPacket(actionCodes.Activity_sudokuRpc, MsgPack.pack({task = role:packReward(task, tchange), reward = role:packReward(reward, rchange), rId = rId})) |
| 75 | 76 | return true | ... | ... |
src/actions/AdvAction.lua
| ... | ... | @@ -174,6 +174,7 @@ function _M.startAdvRpc( agent, data ) |
| 174 | 174 | role:checkTaskEnter("AdvStart", {id = chapterId}) |
| 175 | 175 | role:checkTaskEnter("AdvStartSelf", {id = chapterId}) |
| 176 | 176 | role:getAdvData():popBackEvents() -- 清一下事件 |
| 177 | + role:getAdvData():mylog({desc = "start", int1 = supportIdx}) | |
| 177 | 178 | |
| 178 | 179 | SendPacket(actionCodes.Adv_startAdvRpc, '') |
| 179 | 180 | return true |
| ... | ... | @@ -254,6 +255,7 @@ function _M.startHangRpc(agent, data) |
| 254 | 255 | |
| 255 | 256 | role:changeAdvCount(adv_idle_energy) |
| 256 | 257 | role:checkTaskEnter("AdvStart", {id = chapterId}) |
| 258 | + role:mylog("adv_action", {desc = "startHang", int1 = chapterId}) | |
| 257 | 259 | |
| 258 | 260 | SendPacket(actionCodes.Adv_startHangRpc, '') |
| 259 | 261 | return true |
| ... | ... | @@ -293,6 +295,8 @@ function _M.quickHangRpc(agent, data) |
| 293 | 295 | info.time = 0 |
| 294 | 296 | role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) |
| 295 | 297 | |
| 298 | + role:mylog("adv_action", {desc = "advQuickHang", int1 = chapterId}) | |
| 299 | + | |
| 296 | 300 | SendPacket(actionCodes.Adv_quickHangRpc, '') |
| 297 | 301 | return true |
| 298 | 302 | end |
| ... | ... | @@ -374,6 +378,8 @@ function _M.endHangRpc(agent, data) |
| 374 | 378 | |
| 375 | 379 | role:changeUpdates({{type = "advHang", field = chapterId, value = nil}}) |
| 376 | 380 | |
| 381 | + role:mylog("adv_action", {desc = "endHang", int1 = chapterId, short1 = cancel and 1 or 0}) | |
| 382 | + | |
| 377 | 383 | SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, change = change, isFull = isFull})) |
| 378 | 384 | return true |
| 379 | 385 | end |
| ... | ... | @@ -403,6 +409,7 @@ function _M.buyAdvCountRpc(agent , data) |
| 403 | 409 | role:changeAdvCount(-count * globalCsv.adv_daily_buy_num) |
| 404 | 410 | role.dailyData:updateProperty({field = "advBC", delta = count}) |
| 405 | 411 | end |
| 412 | + role:mylog("adv_action", {desc = "buyAdvCount", short1 = isEl and 1 or 0, int1 = count}) | |
| 406 | 413 | |
| 407 | 414 | SendPacket(actionCodes.Adv_buyAdvCountRpc, '') |
| 408 | 415 | return true |
| ... | ... | @@ -427,6 +434,8 @@ function _M.finishTaskRpc(agent, data) |
| 427 | 434 | if not status then return end |
| 428 | 435 | role:checkTaskEnter("AdvOverTask", {id = taskId}) |
| 429 | 436 | |
| 437 | + adv:mylog({desc = "finishTask", int1 = taskId}) | |
| 438 | + | |
| 430 | 439 | SendPacket(actionCodes.Adv_finishTaskRpc, MsgPack.pack(role:packReward(reward, change))) |
| 431 | 440 | return true |
| 432 | 441 | end |
| ... | ... | @@ -448,6 +457,8 @@ function _M.clickBlockRpc(agent, data) |
| 448 | 457 | |
| 449 | 458 | if adv:isWaitChooseArtifact() then return returnFail() end |
| 450 | 459 | |
| 460 | + adv:mylog({desc = "clickBlock", int1 = msg.roomId, int2 = msg.blockId}) | |
| 461 | + | |
| 451 | 462 | local status, errorCode = adv:clickBlock(msg.roomId, msg.blockId, msg) |
| 452 | 463 | if not status then return returnFail(errorCode) end |
| 453 | 464 | |
| ... | ... | @@ -483,8 +494,8 @@ function _M.useItemRpc(agent, data) |
| 483 | 494 | if itemId == 5020 then |
| 484 | 495 | role:finishGuide(53) |
| 485 | 496 | end |
| 486 | - | |
| 487 | 497 | adv:checkAchievement(adv.AchievType.UseItem, count, itemId) |
| 498 | + adv:mylog({desc = "useItem", int1 = itemId, int2 = count}) | |
| 488 | 499 | |
| 489 | 500 | for i = 1, count do |
| 490 | 501 | adv:doActive(itemData.effect, target) -- target |
| ... | ... | @@ -520,6 +531,7 @@ function _M.usePotionRpc(agent, data) |
| 520 | 531 | local adv = role:getAdvData() |
| 521 | 532 | if adv:isWaitChooseArtifact() then return end |
| 522 | 533 | |
| 534 | + adv:mylog({desc = "usePotion", int1 = potionId}) | |
| 523 | 535 | |
| 524 | 536 | local status = adv:doActive(potionData.effect, target) -- target |
| 525 | 537 | if not status then return end |
| ... | ... | @@ -619,6 +631,7 @@ function _M.exitAdvRpc(agent, data) |
| 619 | 631 | role:saveGuide(57,1,true) |
| 620 | 632 | end |
| 621 | 633 | local adv = role:getAdvData() |
| 634 | + adv:mylog({desc = "exit"}) | |
| 622 | 635 | local status = adv:exit() -- target {roomId = 1, blockId = 1} 选择的目标 |
| 623 | 636 | SendPacket(actionCodes.Adv_exitAdvRpc, MsgPack.pack({events = adv:popBackEvents()})) |
| 624 | 637 | return true |
| ... | ... | @@ -689,7 +702,7 @@ function _M.endBattleRpc(agent, data) |
| 689 | 702 | role:saveGuide(61,1,true) |
| 690 | 703 | end |
| 691 | 704 | end |
| 692 | - | |
| 705 | + adv:mylog({desc = "endBattle"}) | |
| 693 | 706 | local status = adv:clickBlock(roomId, blockId, {player = player, bySkill = bySkill}) |
| 694 | 707 | |
| 695 | 708 | if not status then return end |
| ... | ... | @@ -772,7 +785,9 @@ function _M.wheelSurfRpc(agent, data) |
| 772 | 785 | end |
| 773 | 786 | role:award(reward, {log = {desc = "advWheelSurf", int1 = ptype}}) |
| 774 | 787 | role:finishGuide(58) |
| 788 | + | |
| 775 | 789 | role:checkTaskEnter("AdvDraw", {count = count, ptype = ptype}) |
| 790 | + role:mylog("adv_action", {desc = "advWheelSurf", int1 = ptype, int2 = count}) | |
| 776 | 791 | |
| 777 | 792 | SendPacket(actionCodes.Adv_wheelSurfRpc, MsgPack.pack({reward = backReward})) |
| 778 | 793 | return true |
| ... | ... | @@ -801,6 +816,7 @@ function _M.repayWheelSurfRpc(agent, data) |
| 801 | 816 | local gift = drawData["pool3"]:randWeight(true) |
| 802 | 817 | local reward, change = {[gift[1]] = gift[2]} |
| 803 | 818 | reward, change = role:award(reward, {log = {desc = "advRepayWheelSurf", int1 = ptype}}) |
| 819 | + role:mylog("adv_action", {desc = "advRepayWheelSurf", int1 = ptype}) | |
| 804 | 820 | |
| 805 | 821 | SendPacket(actionCodes.Adv_repayWheelSurfRpc, MsgPack.pack(role:packReward(reward, change))) |
| 806 | 822 | return true |
| ... | ... | @@ -824,6 +840,8 @@ function _M.finishAchievRpc(agent, data) |
| 824 | 840 | if not status then return end |
| 825 | 841 | adv:updateAchievement() |
| 826 | 842 | role:finishGuide(57) |
| 843 | + role:mylog("adv_action", {desc = "finishAchiev", short1 = ctype, int1 = chapterId, int2 = taskId}) | |
| 844 | + | |
| 827 | 845 | SendPacket(actionCodes.Adv_finishAchievRpc, MsgPack.pack(role:packReward(reward, change))) |
| 828 | 846 | return true |
| 829 | 847 | end |
| ... | ... | @@ -879,6 +897,7 @@ function _M.refreshSupportRpc(agent, data) |
| 879 | 897 | end |
| 880 | 898 | |
| 881 | 899 | role:advRandomSupportEffect() |
| 900 | + role:mylog("adv_action", {desc = "advSupRe", short1 = cr < al and 0 or 1}) | |
| 882 | 901 | |
| 883 | 902 | SendPacket(actionCodes.Adv_refreshSupportRpc, '') |
| 884 | 903 | return true | ... | ... |
src/actions/CarAction.lua
| ... | ... | @@ -47,6 +47,8 @@ function _M.makePotionRpc( agent, data ) |
| 47 | 47 | carriage_cook_amount = count, -- 制作总量 |
| 48 | 48 | carriage_cook_cost = cost, -- 制作消耗道具,json格式记录,{'itemid1':10,'itemid2':5,…………..} |
| 49 | 49 | }) |
| 50 | + role:mylog("role_action", {desc = "makePotion", int1 = potionId, int2 = count}) | |
| 51 | + | |
| 50 | 52 | SendPacket(actionCodes.Car_makePotionRpc, MsgPack.pack({potionBag = potionBag})) |
| 51 | 53 | return true |
| 52 | 54 | end |
| ... | ... | @@ -105,7 +107,7 @@ function _M.equipUpRpc( agent, data ) |
| 105 | 107 | equip_upgrade_cost = costCount, -- 升级操作消耗装备数量 |
| 106 | 108 | equip_upgrade_current = cost, -- 升级消耗的货币类型 |
| 107 | 109 | }) |
| 108 | - | |
| 110 | + role:mylog("role_action", {desc = "equipUp", int1 = id, int2 = count}) | |
| 109 | 111 | SendPacket(actionCodes.Car_equipUpRpc, '') |
| 110 | 112 | return true |
| 111 | 113 | end |
| ... | ... | @@ -145,7 +147,7 @@ function _M.runeUpRpc( agent, data ) |
| 145 | 147 | hero:updateProperty({field = "battleV", value = hero:getBattleValue()}) |
| 146 | 148 | end |
| 147 | 149 | end |
| 148 | - ownRune:log({desc = "runeUp", int1 = level + 1}) | |
| 150 | + ownRune:mylog({desc = "runeUp", int1 = level + 1}) | |
| 149 | 151 | |
| 150 | 152 | SendPacket(actionCodes.Car_runeUpRpc, '') |
| 151 | 153 | return true |
| ... | ... | @@ -179,7 +181,8 @@ function _M.saleEquipRpc(agent, data ) |
| 179 | 181 | end |
| 180 | 182 | role:checkTaskEnter("SaleEquip", {count = allCount}) |
| 181 | 183 | reward, change = role:award(reward, {log = {desc = "saleEquip"}}) |
| 182 | - | |
| 184 | + role:mylog("role_action", {desc = "saleEquip", int1 = allCount}) | |
| 185 | + | |
| 183 | 186 | SendPacket(actionCodes.Car_saleEquipRpc, MsgPack.pack(role:packReward(reward, change))) |
| 184 | 187 | return true |
| 185 | 188 | end | ... | ... |
src/actions/DinerAction.lua
| ... | ... | @@ -106,6 +106,8 @@ function _M.addSellRpc( agent, data ) |
| 106 | 106 | end |
| 107 | 107 | role:finishGuide(28) |
| 108 | 108 | |
| 109 | + role:mylog("diner_action", {desc = "addSell", int1 = dish, int2 = count}) | |
| 110 | + | |
| 109 | 111 | role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) |
| 110 | 112 | SendPacket(actionCodes.Diner_addSellRpc, "") |
| 111 | 113 | return true |
| ... | ... | @@ -161,6 +163,7 @@ function _M.removeSellRpc( agent, data ) |
| 161 | 163 | restaurant_sale_coin = reward[ItemId.DinerCoin] or 0, -- 售卖获得美食币 |
| 162 | 164 | restaurant_sale_gear = reward[ItemId.Gold] or 0, -- 售卖获得齿轮 |
| 163 | 165 | }) |
| 166 | + role:mylog("diner_action", {desc = "removeSell", int1 = dish}) | |
| 164 | 167 | |
| 165 | 168 | role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) |
| 166 | 169 | SendPacket(actionCodes.Diner_removeSellRpc, MsgPack.pack({reward = reward, change = change})) |
| ... | ... | @@ -230,7 +233,7 @@ function _M.getSellRewardRpc( agent, data ) |
| 230 | 233 | role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order")) |
| 231 | 234 | end |
| 232 | 235 | |
| 233 | - | |
| 236 | + role:mylog("diner_action", {desc = "sell"}) | |
| 234 | 237 | |
| 235 | 238 | SendPacket(actionCodes.Diner_getSellRewardRpc, MsgPack.pack({reward = reward, change = change})) |
| 236 | 239 | return true |
| ... | ... | @@ -319,6 +322,8 @@ function _M.expediteSellRpc( agent, data ) |
| 319 | 322 | end |
| 320 | 323 | role:checkTaskEnter("FoodSellQuick") |
| 321 | 324 | |
| 325 | + role:mylog("diner_action", {desc = "sellQ"}) | |
| 326 | + | |
| 322 | 327 | SendPacket(actionCodes.Diner_expediteSellRpc, MsgPack.pack({reward = reward, change = change, popular = popular})) |
| 323 | 328 | return true |
| 324 | 329 | end |
| ... | ... | @@ -365,6 +370,7 @@ function _M.levelUpRpc( agent, data ) |
| 365 | 370 | restaurant_up_effectbef = curLevel, --升级前加成 |
| 366 | 371 | restaurant_up_effect = curLevel + 1, --升级后加成 |
| 367 | 372 | }) |
| 373 | + role:mylog("diner_action", {desc = "buildUp", int1 = index, int2 = curLevel + 1}) | |
| 368 | 374 | |
| 369 | 375 | SendPacket(actionCodes.Diner_levelUpRpc, '') |
| 370 | 376 | return true |
| ... | ... | @@ -454,6 +460,8 @@ function _M.talentUpRpc( agent, data ) |
| 454 | 460 | carriage_logistics_gear = cost[ItemId.Gold] or 0, -- 后勤室升级花费齿轮数量 |
| 455 | 461 | carriage_logistics_coin = cost[ItemId.DinerCoin] or 0, -- 后勤室升级花费美食币数量 |
| 456 | 462 | }) |
| 463 | + role:mylog("diner_action", {desc = "talentUp", int1 = dish, int2 = dishLevel + 1}) | |
| 464 | + | |
| 457 | 465 | SendPacket(actionCodes.Diner_talentUpRpc, '') |
| 458 | 466 | return true |
| 459 | 467 | end |
| ... | ... | @@ -487,6 +495,7 @@ function _M.skillUpRpc( agent, data ) |
| 487 | 495 | |
| 488 | 496 | role:costItems(cost, {log = {desc = "dinerSkillUp", int1 = skill, int2 = skillLevel + 1}}) |
| 489 | 497 | role.dinerData:updateProperty({field = "skillTree", value = skillTree:setv(skill, skillLevel + 1)}) |
| 498 | + role:mylog("diner_action", {desc = "skillUp", int1 = skill, int2 = skillLevel + 1}) | |
| 490 | 499 | |
| 491 | 500 | SendPacket(actionCodes.Diner_skillUpRpc, '') |
| 492 | 501 | return true |
| ... | ... | @@ -514,6 +523,8 @@ function _M.lockTaskRpc( agent, data ) |
| 514 | 523 | end |
| 515 | 524 | role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) |
| 516 | 525 | |
| 526 | + role:mylog("diner_action", {desc = "lockTask", int1 = order.id}) | |
| 527 | + | |
| 517 | 528 | SendPacket(actionCodes.Diner_lockTaskRpc, MsgPack.pack({lock = order.lock})) |
| 518 | 529 | return true |
| 519 | 530 | end |
| ... | ... | @@ -550,7 +561,8 @@ function _M.updateTaskRpc( agent, data ) |
| 550 | 561 | orders[index].status = 1 |
| 551 | 562 | orders[index].lock = 1 |
| 552 | 563 | |
| 553 | - role:checkTaskEnter("GetOderTask", {rarity = taskSet.rarity}) | |
| 564 | + role:checkTaskEnter("GetOderTask", {rarity = taskData.rarity}) | |
| 565 | + role:mylog("diner_action", {desc = "getTask", int1 = order.id}) | |
| 554 | 566 | elseif cmd == 1 then |
| 555 | 567 | if order.status ~= 1 then |
| 556 | 568 | return 31 |
| ... | ... | @@ -558,6 +570,8 @@ function _M.updateTaskRpc( agent, data ) |
| 558 | 570 | orders[index].status = 0 |
| 559 | 571 | orders[index].lock = 0 |
| 560 | 572 | |
| 573 | + role:mylog("diner_action", {desc = "deleteTask", int1 = order.id}) | |
| 574 | + | |
| 561 | 575 | elseif cmd == 2 then |
| 562 | 576 | if order.status ~= 1 then |
| 563 | 577 | return 32 |
| ... | ... | @@ -565,10 +579,11 @@ function _M.updateTaskRpc( agent, data ) |
| 565 | 579 | if order.n < taskData.value then |
| 566 | 580 | return 6 |
| 567 | 581 | end |
| 582 | + role:mylog("diner_action", {desc = "finishTask", int1 = order.id}) | |
| 568 | 583 | |
| 569 | 584 | reward, change = role:award(taskData.reward, {log = {desc = "dinerFinishTask", int1 = order.id}}) |
| 570 | 585 | table.remove(orders,index) |
| 571 | - role:checkTaskEnter("OverOderTask", {rarity = taskSet.rarity}) | |
| 586 | + role:checkTaskEnter("OverOderTask", {rarity = taskData.rarity}) | |
| 572 | 587 | else |
| 573 | 588 | return 33 |
| 574 | 589 | end |
| ... | ... | @@ -577,8 +592,8 @@ function _M.updateTaskRpc( agent, data ) |
| 577 | 592 | role:log("restaurant_order", { |
| 578 | 593 | restaurant_order_id = order.id, -- 订单任务ID |
| 579 | 594 | restaurant_order_status = cmd, -- 订单任务状态,接受:0, 拒绝:1, 完成:2 |
| 580 | - restaurant_order_rwd = reward, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | |
| 581 | - restaurant_order_lv = taskSet.rarity, -- 订单品质等级,普通:0, 稀有:1, 顶级:2, 豪华:3 | |
| 595 | + restaurant_order_rwd = reward or {}, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | |
| 596 | + restaurant_order_lv = taskData.rarity, -- 订单品质等级,普通:0, 稀有:1, 顶级:2, 豪华:3 | |
| 582 | 597 | }) |
| 583 | 598 | |
| 584 | 599 | role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) |
| ... | ... | @@ -656,6 +671,8 @@ function _M.refreshTaskRpc( agent, data ) |
| 656 | 671 | end |
| 657 | 672 | |
| 658 | 673 | role:finishGuide(41) |
| 674 | + role:mylog("diner_action", {desc = "reTask"}) | |
| 675 | + | |
| 659 | 676 | role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) |
| 660 | 677 | |
| 661 | 678 | SendPacket(actionCodes.Diner_refreshTaskRpc, '') |
| ... | ... | @@ -696,6 +713,8 @@ function _M.addWantFoodRpc(agent , data) |
| 696 | 713 | end |
| 697 | 714 | |
| 698 | 715 | role:finishGuide(36) |
| 716 | + role:mylog("diner_action", {desc = "wantFood"}) | |
| 717 | + | |
| 699 | 718 | role.dinerData:updateProperty({field = "gfood", value = gfood}) |
| 700 | 719 | |
| 701 | 720 | SendPacket(actionCodes.Diner_addWantFoodRpc, '') |
| ... | ... | @@ -742,6 +761,7 @@ function _M.getGreenhouseRpc( agent, data ) |
| 742 | 761 | local reward, change = role:award(reward, {log = {desc = "greenHourse", int1 = level}}) |
| 743 | 762 | role:checkTaskEnter("FoodMGet") |
| 744 | 763 | |
| 764 | + role:mylog("diner_action", {desc = "greenHourse"}) | |
| 745 | 765 | |
| 746 | 766 | SendPacket(actionCodes.Diner_getGreenhouseRpc, MsgPack.pack({reward = reward, change = change})) |
| 747 | 767 | return true |
| ... | ... | @@ -880,6 +900,7 @@ function _M.entrustRpc(agent , data) |
| 880 | 900 | role.dinerData:updateProperty({field = "entrust", value = entrust}) |
| 881 | 901 | |
| 882 | 902 | role:finishGuide(26) |
| 903 | + role:mylog("diner_action", {desc = "entrus", short1 = ctype, int1 = entrustId}) | |
| 883 | 904 | |
| 884 | 905 | SendPacket(actionCodes.Diner_entrustRpc, MsgPack.pack({reward = reward, change = change})) |
| 885 | 906 | return true |
| ... | ... | @@ -916,6 +937,7 @@ function _M.collectRpc(agent , data) |
| 916 | 937 | restaurant_collect_rwd = reward, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} |
| 917 | 938 | restaurant_collect_plan = count, -- 收集进度,即解锁顾客,数字表示 |
| 918 | 939 | }) |
| 940 | + role:mylog("diner_action", {desc = "collect", int1 = id}) | |
| 919 | 941 | |
| 920 | 942 | SendPacket(actionCodes.Diner_collectRpc, MsgPack.pack({reward = reward, change = change})) |
| 921 | 943 | return true |
| ... | ... | @@ -945,6 +967,8 @@ function _M.comboRewardRpc(agent , data) |
| 945 | 967 | |
| 946 | 968 | role.dinerData:updateProperty({field = "comboStatus", value = comboStatus}) -- 解锁了 |
| 947 | 969 | |
| 970 | + role:mylog("diner_action", {desc = "combo", int1 = id}) | |
| 971 | + | |
| 948 | 972 | SendPacket(actionCodes.Diner_comboRewardRpc, MsgPack.pack({reward = reward, change = change})) |
| 949 | 973 | return true |
| 950 | 974 | end | ... | ... |
src/actions/EmailAction.lua
| ... | ... | @@ -53,6 +53,7 @@ function _M.listRpc(agent, data) |
| 53 | 53 | content = email.content, |
| 54 | 54 | attachments = email.attachments |
| 55 | 55 | }) |
| 56 | + role:mylog("mail_action", {desc = "get_global", key1 = email.title, key2 = email.attachments}) | |
| 56 | 57 | end |
| 57 | 58 | end |
| 58 | 59 | end |
| ... | ... | @@ -98,6 +99,7 @@ function _M.drawAllAttachRpc(agent, data) |
| 98 | 99 | for key, v in pairs(attachments:toNumMap()) do |
| 99 | 100 | reward[key] = (reward[key] or 0) + v |
| 100 | 101 | end |
| 102 | + role:mylog("mail_action", {desc = "draw_attach", int1 = email:getProperty("emailId"), key1 = email:getProperty("title"), key2 = attachments}) | |
| 101 | 103 | end |
| 102 | 104 | end |
| 103 | 105 | reward, change = role:award(reward, {log = {desc = "draw_attach"}}) |
| ... | ... | @@ -123,7 +125,7 @@ function _M.drawAttachRpc(agent, data) |
| 123 | 125 | email:setProperty("status", 2) |
| 124 | 126 | email:log(role, 2) |
| 125 | 127 | SendPacket(actionCodes.Email_drawAttachRpc, MsgPack.pack({reward = reward, change = change})) |
| 126 | - | |
| 128 | + role:mylog("mail_action", {desc = "draw_attach", int1 = id, key1 = email:getProperty("title"), key2 = attachments}) | |
| 127 | 129 | return true |
| 128 | 130 | end |
| 129 | 131 | |
| ... | ... | @@ -140,6 +142,7 @@ function _M.checkRpc(agent, data) |
| 140 | 142 | |
| 141 | 143 | email:setProperty("status", 1) |
| 142 | 144 | email:log(role, 1) |
| 145 | + role:mylog("mail_action", {desc = "check_mail", int1 = id}) | |
| 143 | 146 | |
| 144 | 147 | SendPacket(actionCodes.Email_checkRpc, '') |
| 145 | 148 | return true |
| ... | ... | @@ -175,6 +178,9 @@ function _M.delRpc(agent, data) |
| 175 | 178 | end |
| 176 | 179 | end |
| 177 | 180 | end) |
| 181 | + for delId, _ in ipairs(result) do | |
| 182 | + role:mylog("mail_action", {desc = "del_mail", int1 = delId}) | |
| 183 | + end | |
| 178 | 184 | SendPacket(actionCodes.Email_delRpc, MsgPack.pack({result = result})) |
| 179 | 185 | return true |
| 180 | 186 | end | ... | ... |
src/actions/FriendAction.lua
| ... | ... | @@ -111,6 +111,7 @@ function _M.searchRpc(agent, data) |
| 111 | 111 | })) |
| 112 | 112 | end |
| 113 | 113 | |
| 114 | + role:mylog("role_action", {desc = "searchFriend"}) | |
| 114 | 115 | SendPacket(actionCodes.Friend_searchRpc, MsgPack.pack({searchList = searchList})) |
| 115 | 116 | return true |
| 116 | 117 | end |
| ... | ... | @@ -177,6 +178,8 @@ function _M.applyRpc(agent, data) |
| 177 | 178 | myInfo.online = true |
| 178 | 179 | myInfo.hadApply = true |
| 179 | 180 | |
| 181 | + role:mylog("role_action", {desc = "addFriend", int1 = 1}) | |
| 182 | + | |
| 180 | 183 | rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newApply = 1, info = {myInfo}})) -- 通知对方 |
| 181 | 184 | end |
| 182 | 185 | |
| ... | ... | @@ -283,6 +286,8 @@ function _M.handleApplyRpc(agent, data) |
| 283 | 286 | friend_roleid = objectId, -- 好友账户下的角色id |
| 284 | 287 | friend_cnt = curCount + 1, -- 操作后好友数量 |
| 285 | 288 | }) |
| 289 | + role:mylog("role_action", {desc = "addFriend", int1 = 1}) | |
| 290 | + | |
| 286 | 291 | end |
| 287 | 292 | |
| 288 | 293 | elseif cmd == 0 then -- 不同意 |
| ... | ... | @@ -347,6 +352,8 @@ function _M.handleApplyRpc(agent, data) |
| 347 | 352 | rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = {myInfo}})) -- 通知对方 |
| 348 | 353 | end |
| 349 | 354 | if next(needAdd) then |
| 355 | + role:mylog("role_action", {desc = "addFriend", int1 = #needAdd}) | |
| 356 | + | |
| 350 | 357 | SendPacket(actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = needAddInfo})) |
| 351 | 358 | else |
| 352 | 359 | result = 1 |
| ... | ... | @@ -553,6 +560,8 @@ function _M.pointRpc(agent, data) |
| 553 | 560 | role.dailyData:updateProperty({field = "giveFP", value = giveP}) |
| 554 | 561 | role:checkTaskEnter("GiveFriendP", {count = 1}) |
| 555 | 562 | rpcRole(objId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newPoint = 1, roleId = roleId})) |
| 563 | + | |
| 564 | + role:mylog("role_action", {desc = "giveFPoint", int1 = 1}) | |
| 556 | 565 | end |
| 557 | 566 | elseif cmd == 2 then -- 领取 |
| 558 | 567 | local objId = msg.roleId |
| ... | ... | @@ -572,6 +581,7 @@ function _M.pointRpc(agent, data) |
| 572 | 581 | role.dailyData:updateProperty({field = "getFP", value = getP}) |
| 573 | 582 | role:checkTaskEnter("GetFriendP", {count = 1}) |
| 574 | 583 | |
| 584 | + role:mylog("role_action", {desc = "getFPoint", int1 = 1}) | |
| 575 | 585 | end |
| 576 | 586 | elseif cmd == 3 then -- 一键赠送领取 |
| 577 | 587 | -- 赠送 |
| ... | ... | @@ -593,6 +603,8 @@ function _M.pointRpc(agent, data) |
| 593 | 603 | role.dailyData:updateProperty({field = "giveFP", value = giveP}) |
| 594 | 604 | role:checkTaskEnter("GiveFriendP", {count = change}) |
| 595 | 605 | |
| 606 | + role:mylog("role_action", {desc = "giveFPoint", int1 = change}) | |
| 607 | + | |
| 596 | 608 | else |
| 597 | 609 | result = 1 |
| 598 | 610 | end |
| ... | ... | @@ -617,6 +629,7 @@ function _M.pointRpc(agent, data) |
| 617 | 629 | reward = role:award({[ItemId.FriendPoint] = getCount}, {log = {desc = "friendPoint"}}) |
| 618 | 630 | role.dailyData:updateProperty({field = "getFP", value = getP}) |
| 619 | 631 | role:checkTaskEnter("GetFriendP", {count = getCount}) |
| 632 | + role:mylog("role_action", {desc = "getFPoint", int1 = getCount}) | |
| 620 | 633 | else |
| 621 | 634 | result = (result or 0) + 2 |
| 622 | 635 | end | ... | ... |
src/actions/GmAction.lua
| ... | ... | @@ -446,18 +446,33 @@ function _M.email(role, pms) |
| 446 | 446 | return "成功" |
| 447 | 447 | end |
| 448 | 448 | |
| 449 | -table.insert(helpDes, {"清除引导", "cguide", "0全/1强/2弱"}) | |
| 450 | -function _M.cguide(role, pms) | |
| 451 | - local id = tonum(pms.pm1, 0) | |
| 452 | - if id == 0 then | |
| 453 | - role:updateProperties({ | |
| 454 | - newerGuide = "1=1", | |
| 455 | - funcGuide = "", | |
| 456 | - }, notNotify) | |
| 457 | - elseif id == 1 then | |
| 458 | - role:updateProperty({field = "newerGuide", value = "1=1"}) | |
| 459 | - elseif id == 2 then | |
| 460 | - role:updateProperty({field = "funcGuide", value = ""}) | |
| 449 | +table.insert(helpDes, {"引导", "guide", "skip/reset"}) | |
| 450 | +function _M.guide(role, pms) | |
| 451 | + local cmd = pms.pm1 or "un" | |
| 452 | + if cmd == "SKIP" then | |
| 453 | + role:updateProperty({field = "newerGuide", value = "9999=1"}) | |
| 454 | + local str = "" | |
| 455 | + for _, set in pairs(csvdb["guide_mainCsv"]) do | |
| 456 | + str = str:setv(set[1].major * 1000,1) | |
| 457 | + for _,data in ipairs(set) do | |
| 458 | + if data["break"] ~= 0 then | |
| 459 | + str = str:setv(data.major * 1000 + data.minor,1) | |
| 460 | + end | |
| 461 | + end | |
| 462 | + end | |
| 463 | + role:updateProperty({field = "funcGuide", value = str}) | |
| 464 | + elseif cmd == "RESET" then | |
| 465 | + local id = tonum(pms.pm2, 0) | |
| 466 | + if id == 0 then | |
| 467 | + role:updateProperties({ | |
| 468 | + newerGuide = "1=1", | |
| 469 | + funcGuide = "", | |
| 470 | + }, notNotify) | |
| 471 | + elseif id == 1 then | |
| 472 | + role:updateProperty({field = "newerGuide", value = "1=1"}) | |
| 473 | + elseif id == 2 then | |
| 474 | + role:updateProperty({field = "funcGuide", value = ""}) | |
| 475 | + end | |
| 461 | 476 | end |
| 462 | 477 | |
| 463 | 478 | return "成功" | ... | ... |
src/actions/HeroAction.lua
| ... | ... | @@ -57,6 +57,7 @@ function _M.levelUpRpc( agent, data ) |
| 57 | 57 | if hero:getProperty("type") == 103 then |
| 58 | 58 | role:finishGuide(7) |
| 59 | 59 | end |
| 60 | + hero:mylog({desc = "levelUp", int1 = hero:getProperty("level")}) | |
| 60 | 61 | |
| 61 | 62 | role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")}) |
| 62 | 63 | SendPacket(actionCodes.Hero_levelUpRpc, '') |
| ... | ... | @@ -84,6 +85,7 @@ function _M.breakRpc( agent, data ) |
| 84 | 85 | hero_break_result = getChangeAttrJson(oldAttr, hero:getTotalAttrs()), -- 英雄突破效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} |
| 85 | 86 | hero_break_level = hero:getMaxLevel(), -- 英雄突破后等级上限 |
| 86 | 87 | }) |
| 88 | + hero:mylog({desc = "break", int1 = hero:getProperty("breakL")}) | |
| 87 | 89 | |
| 88 | 90 | SendPacket(actionCodes.Hero_breakRpc, '') |
| 89 | 91 | return true |
| ... | ... | @@ -114,6 +116,7 @@ function _M.wakeRpc(agent, data) |
| 114 | 116 | if curLevel == 4 then -- 解锁cg |
| 115 | 117 | role:checkTaskEnter("WakeCG", {heroType = typ}) |
| 116 | 118 | end |
| 119 | + hero:mylog({desc = "wake", int1 = hero:getProperty("wakeL")}) | |
| 117 | 120 | |
| 118 | 121 | role:log("hero_rise", { |
| 119 | 122 | hero_id = typ, --英雄ID |
| ... | ... | @@ -199,6 +202,7 @@ function _M.talentRpc(agent, data) |
| 199 | 202 | hero_talent_levelbef = oldSkillLv, -- 英雄技能升级前等级 |
| 200 | 203 | hero_talent_level = hero:getSkillLevel(1), -- 英雄技能升级后等级 |
| 201 | 204 | }) |
| 205 | + hero:mylog({desc = "talent", int1 = index, int2 = talent:getv(index, 0)}) | |
| 202 | 206 | |
| 203 | 207 | SendPacket(actionCodes.Hero_talentRpc, '') |
| 204 | 208 | return true |
| ... | ... | @@ -691,6 +695,7 @@ function _M.getResetRewardRpc(agent, data) |
| 691 | 695 | equip = "", |
| 692 | 696 | rune = "", |
| 693 | 697 | }) |
| 698 | + hero:mylog({desc = "resetHero"}) | |
| 694 | 699 | |
| 695 | 700 | for itemId, count in pairs(reward) do |
| 696 | 701 | reward[itemId] = math.floor(count * globalCsv.unit_back_discount) |
| ... | ... | @@ -948,6 +953,7 @@ function _M.repayHeroRpc(agent, data) |
| 948 | 953 | role:award({[id] = 1}, {log = {desc = "heroRepay"}}) |
| 949 | 954 | reward = {id = id, count = 1} |
| 950 | 955 | end |
| 956 | + role:mylog("hero_action", {desc = "heroRepay", int1=result}) | |
| 951 | 957 | SendPacket(actionCodes.Hero_repayHeroRpc, MsgPack.pack({reward = reward})) |
| 952 | 958 | return true |
| 953 | 959 | end |
| ... | ... | @@ -979,7 +985,7 @@ function _M.unlockPoolRpc(agent, data) |
| 979 | 985 | role.dailyData:updateProperty({field="unlockPool", value = unlockPool}) |
| 980 | 986 | role.dailyData:updateProperty({field="curPool", value = type}) |
| 981 | 987 | |
| 982 | - --role:log("hero_action", {desc = "unlockPool", int1=type}) | |
| 988 | + role:mylog("hero_action", {desc = "unlockPool", int1=type}) | |
| 983 | 989 | SendPacket(actionCodes.Hero_unlockPoolRpc, MsgPack.pack({})) |
| 984 | 990 | return true |
| 985 | 991 | end | ... | ... |
src/actions/PvpAction.lua
| ... | ... | @@ -296,6 +296,9 @@ function _M.startBattleRpc(agent, data) |
| 296 | 296 | _pvpStartBattleCacheC = {idx = idx, key = key, revenge = revenge} |
| 297 | 297 | |
| 298 | 298 | role:checkTaskEnter("PvpBattle") |
| 299 | + | |
| 300 | + | |
| 301 | + role:mylog("pvp_action", {desc = "startBattle", short1 = 1, int1 = revenge and 1 or 0}) | |
| 299 | 302 | end |
| 300 | 303 | |
| 301 | 304 | SendPacket(actionCodes.Pvp_startBattleRpc, MsgPack.pack({matchInfo = matchInfo, key = key, result = result, wait = wait})) |
| ... | ... | @@ -393,6 +396,7 @@ function _M.endBattleRpc(agent, data) |
| 393 | 396 | reward = reward, |
| 394 | 397 | rank = myRank, |
| 395 | 398 | }) |
| 399 | + role:mylog("pvp_action", {desc = "battleEnd", short1 = 1, int1 = isWin and 1 or 0, int2 = revenge and 1 or 0}) | |
| 396 | 400 | |
| 397 | 401 | _pvpBattleInfoCacheC = {} --重新发阵容了 没毛病 |
| 398 | 402 | _pvpRecordInfoCacheC = {} -- 记录刷新了 |
| ... | ... | @@ -525,6 +529,8 @@ function _M.startBattleHRpc(agent, data) |
| 525 | 529 | |
| 526 | 530 | role:checkTaskEnter("PvpBattle") |
| 527 | 531 | |
| 532 | + role:mylog("pvp_action", {desc = "startBattle", short1 = 2, int1 = revenge and 1 or 0}) | |
| 533 | + | |
| 528 | 534 | end |
| 529 | 535 | |
| 530 | 536 | SendPacket(actionCodes.Pvp_startBattleHRpc, MsgPack.pack({ |
| ... | ... | @@ -707,7 +713,8 @@ function _M.endBattleHRpc(agent, data) |
| 707 | 713 | if isWin then |
| 708 | 714 | role:checkTaskEnter("PvpWin", {score = myScore}) |
| 709 | 715 | end |
| 710 | - | |
| 716 | + role:mylog("pvp_action", {desc = "battleEnd", short1 = 2, int1 = isWin and 1 or 0, int2 = revenge and 1 or 0}) | |
| 717 | + | |
| 711 | 718 | SendPacket(actionCodes.Pvp_endBattleHRpc, MsgPack.pack({ |
| 712 | 719 | reward = reward, |
| 713 | 720 | change = change, |
| ... | ... | @@ -855,6 +862,7 @@ function _M.highDivisionGiftRpc(agent, data) |
| 855 | 862 | }) |
| 856 | 863 | |
| 857 | 864 | local reward, change = role:award(newReward, {log = {desc = "pvpDivisionH"}}) |
| 865 | + role:mylog("pvp_action", {desc = "pvpDivisionH"}) | |
| 858 | 866 | |
| 859 | 867 | SendPacket(actionCodes.Pvp_highDivisionGiftRpc, MsgPack.pack(role:packReward(reward, change))) |
| 860 | 868 | return true |
| ... | ... | @@ -889,6 +897,8 @@ function _M.shopBuyRpc(agent, data) |
| 889 | 897 | end |
| 890 | 898 | local reward, change = role:award(gift, {log = {desc = "pvpShop", int1 = id, int2 = count}}) |
| 891 | 899 | |
| 900 | + role:mylog("pvp_action", {desc = "pvpShop", int1 = id, int2 = count}) | |
| 901 | + | |
| 892 | 902 | SendPacket(actionCodes.Pvp_shopBuyRpc, MsgPack.pack(role:packReward(reward, change))) |
| 893 | 903 | return true |
| 894 | 904 | end |
| ... | ... | @@ -980,6 +990,7 @@ function _M.crossBetRpc(agent, data) |
| 980 | 990 | local result, code = role:setCrossServerPvpBet(msg.idx) |
| 981 | 991 | if not result then return 10 + code end |
| 982 | 992 | |
| 993 | + role:mylog("pvp_action", {desc = "crossBet"}) | |
| 983 | 994 | SendPacket(actionCodes.Pvp_crossBetRpc, MsgPack.pack(result)) |
| 984 | 995 | return true |
| 985 | 996 | end | ... | ... |
src/actions/StoreAction.lua
| ... | ... | @@ -260,6 +260,7 @@ function _M.shopBuyRpc(agent , data) |
| 260 | 260 | shop_purchase_current = costCount or 0, -- 购买道具消耗的货币数量 |
| 261 | 261 | shop_id = dataSet.shop, -- 商店ID |
| 262 | 262 | }) |
| 263 | + role:mylog("role_action", {desc = desc, int1 = id, int2 = count}) | |
| 263 | 264 | SendPacket(actionCodes.Store_shopBuyRpc, MsgPack.pack({reward = reward})) |
| 264 | 265 | return true |
| 265 | 266 | end | ... | ... |
src/actions/TowerAction.lua
| ... | ... | @@ -75,7 +75,7 @@ function _M.startBattleRpc(agent, data) |
| 75 | 75 | |
| 76 | 76 | role:updateProperty({field = "towerInfo", value = towerInfo}) |
| 77 | 77 | role:checkTaskEnter("TowerBattle", {level = towerInfo.l}) |
| 78 | - | |
| 78 | + role:mylog("tower_action", {desc = "startBattle", int1 = id}) | |
| 79 | 79 | SendPacket(actionCodes.Tower_startBattleRpc, '') |
| 80 | 80 | return true |
| 81 | 81 | end |
| ... | ... | @@ -128,6 +128,7 @@ function _M.endBattleRpc(agent, data) |
| 128 | 128 | reward = reward, |
| 129 | 129 | rank = rank, |
| 130 | 130 | }) |
| 131 | + role:mylog("tower_action", {desc = "endBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id}) | |
| 131 | 132 | |
| 132 | 133 | SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({reward = reward, change = change})) |
| 133 | 134 | return true |
| ... | ... | @@ -151,7 +152,7 @@ function _M.bugCountRpc(agent, data) |
| 151 | 152 | towerInfo.c = curCount |
| 152 | 153 | towerInfo.t = nextTime |
| 153 | 154 | role:updateProperty({field = "towerInfo", value = towerInfo}) |
| 154 | - | |
| 155 | + role:mylog("tower_action", {desc = "bugCount"}) | |
| 155 | 156 | SendPacket(actionCodes.Tower_bugCountRpc, '') |
| 156 | 157 | return true |
| 157 | 158 | end | ... | ... |
src/adv/Adv.lua
| ... | ... | @@ -24,6 +24,17 @@ function Adv:ctor(owner) |
| 24 | 24 | self:initByInfo(self.owner:getProperty("advInfo")) |
| 25 | 25 | end |
| 26 | 26 | |
| 27 | +function Adv:mylog(contents) | |
| 28 | + contents = contents or {} | |
| 29 | + if contents["cint1"] or contents["cint2"] or contents["cint3"] then | |
| 30 | + print("advLog error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 31 | + end | |
| 32 | + contents["cint1"] = self.chapterId | |
| 33 | + contents["cint2"] = self.level | |
| 34 | + | |
| 35 | + self.owner:mylog("adv_action", contents) | |
| 36 | +end | |
| 37 | + | |
| 27 | 38 | --初始化adv 信息 |
| 28 | 39 | function Adv:initByInfo(advInfo) |
| 29 | 40 | if not next(advInfo) then return end --还没有 开始新地图 |
| ... | ... | @@ -498,18 +509,18 @@ function Adv:awardArtifact(id, params) |
| 498 | 509 | self:checkAchievement(Adv.AchievType.GetMWeapon, 1, id) |
| 499 | 510 | |
| 500 | 511 | |
| 501 | - -- if params.log then | |
| 502 | - -- local log = clone(params.log) | |
| 503 | - -- if log["cint1"] or log["cint2"] or log["cint3"] then | |
| 504 | - -- print("awardArtifact error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 505 | - -- end | |
| 506 | - -- log["cint1"] = self.chapterId | |
| 507 | - -- log["cint2"] = self.level | |
| 508 | - -- log["cint3"] = id | |
| 509 | - -- self.owner:log("in_artifact", log) | |
| 510 | - -- else | |
| 511 | - -- print("awardArtifact no log ", debug.traceback()) | |
| 512 | - -- end | |
| 512 | + if params.log then | |
| 513 | + local log = clone(params.log) | |
| 514 | + if log["cint1"] or log["cint2"] or log["cint3"] then | |
| 515 | + print("awardArtifact error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 516 | + end | |
| 517 | + log["cint1"] = self.chapterId | |
| 518 | + log["cint2"] = self.level | |
| 519 | + log["cint3"] = id | |
| 520 | + self.owner:mylog("in_artifact", log) | |
| 521 | + else | |
| 522 | + print("awardArtifact no log ", debug.traceback()) | |
| 523 | + end | |
| 513 | 524 | if not params.isChoose then |
| 514 | 525 | self:pushBackEvent(AdvBackEventType.Artifact, {id = id}) |
| 515 | 526 | end |
| ... | ... | @@ -598,6 +609,7 @@ function Adv:wearArtifact(slot, id) |
| 598 | 609 | else |
| 599 | 610 | id = nil |
| 600 | 611 | end |
| 612 | + self:mylog({desc = "wearArtifact", int1 = id}) | |
| 601 | 613 | |
| 602 | 614 | self.owner:changeUpdates({{type = "advAFWear", field = slot, value = id}}) |
| 603 | 615 | return true |
| ... | ... | @@ -656,6 +668,9 @@ function Adv:artifactLevelUp(id, level) |
| 656 | 668 | end |
| 657 | 669 | if newLv == advAFGet[id] then return end |
| 658 | 670 | |
| 671 | + self:mylog({desc = "artifactLevelUp", int1 = id, int2 = level}) | |
| 672 | + | |
| 673 | + | |
| 659 | 674 | local status = 0 |
| 660 | 675 | if curWear[id] then -- 穿着呢 |
| 661 | 676 | local oldData = csvdb["adv_artifactCsv"][id][advAFGet[id]] |
| ... | ... | @@ -700,6 +715,8 @@ function Adv:chooseArtifact(index) |
| 700 | 715 | if not self.waitArtifact or not self.waitArtifact[index] then return end |
| 701 | 716 | self:award({[self.waitArtifact[index]] = 1}, {log = {desc = "chooseArtifact"}, isChoose = true}) |
| 702 | 717 | |
| 718 | + self:mylog({desc = "chooseArtifact", int1 = self.waitArtifact[index]}) | |
| 719 | + | |
| 703 | 720 | self.waitArtifact = nil |
| 704 | 721 | |
| 705 | 722 | -- 支援效果继续选择 |
| ... | ... | @@ -796,6 +813,8 @@ function Adv:over(success, rewardRatio, overType) |
| 796 | 813 | end |
| 797 | 814 | self:clearAdvUnlockCache() |
| 798 | 815 | |
| 816 | + self:mylog({desc = "over", short1 = success and 1 or 0, int1 = overType}) | |
| 817 | + | |
| 799 | 818 | local chapterId = self.chapterId |
| 800 | 819 | self:clear() |
| 801 | 820 | self.owner:checkTaskEnter("AdvScore", {score = score}) |
| ... | ... | @@ -902,24 +921,23 @@ function Adv:award(gift, params) |
| 902 | 921 | if itemId == 16 and not self.owner:checkOverGuide(51,4) then |
| 903 | 922 | self.owner:saveGuide(51,4) |
| 904 | 923 | end |
| 905 | - | |
| 906 | - -- if params.log then | |
| 907 | - -- local log = clone(params.log) | |
| 908 | - -- if log["cint1"] or log["cint2"] or log["cint3"] or log["long1"] then | |
| 909 | - -- print("addAdvItem error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 910 | - -- end | |
| 911 | - -- log["cint1"] = itemId | |
| 912 | - -- log["cint2"] = math.abs(count) | |
| 913 | - -- log["cint3"] = self.chapterId | |
| 914 | - -- log["long1"] = self.level | |
| 915 | - -- if count >= 0 then | |
| 916 | - -- self.owner:log("in_adv", log) | |
| 917 | - -- else | |
| 918 | - -- self.owner:log("out_adv", log) | |
| 919 | - -- end | |
| 920 | - -- else | |
| 921 | - -- print("addAdvItem no log ", debug.traceback()) | |
| 922 | - -- end | |
| 924 | + if params.log then | |
| 925 | + local log = clone(params.log) | |
| 926 | + if log["cint1"] or log["cint2"] or log["cint3"] or log["long1"] then | |
| 927 | + print("addAdvItem error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 928 | + end | |
| 929 | + log["cint1"] = itemId | |
| 930 | + log["cint2"] = math.abs(count) | |
| 931 | + log["cint3"] = self.chapterId | |
| 932 | + log["long1"] = self.level | |
| 933 | + if count >= 0 then | |
| 934 | + self.owner:mylog("in_adv", log) | |
| 935 | + else | |
| 936 | + self.owner:mylog("out_adv", log) | |
| 937 | + end | |
| 938 | + else | |
| 939 | + print("addAdvItem no log ", debug.traceback()) | |
| 940 | + end | |
| 923 | 941 | end |
| 924 | 942 | end |
| 925 | 943 | if items ~= oldItems then |
| ... | ... | @@ -1013,6 +1031,7 @@ local function clickOut(self, room, block, params, isExit) |
| 1013 | 1031 | isRelay = true, |
| 1014 | 1032 | }) |
| 1015 | 1033 | else |
| 1034 | + self:mylog({desc = "pass"}) | |
| 1016 | 1035 | self:initByChapter({ |
| 1017 | 1036 | chapterId = self.chapterId, |
| 1018 | 1037 | level = self.level + 1, | ... | ... |
src/adv/AdvTask.lua
| ... | ... | @@ -376,6 +376,7 @@ function AdvTask.bind(Adv) |
| 376 | 376 | else |
| 377 | 377 | if (status or -1) >= data.value1 then |
| 378 | 378 | status = -1 |
| 379 | + self.owner:mylog("adv_action", {desc = "finishAchiev", short1 = 1, int1 = self.chapterId, int2 = taskId}) | |
| 379 | 380 | end |
| 380 | 381 | if status and status ~= oldStatus then |
| 381 | 382 | insertChange(self, self.chapterId, taskId, status) | ... | ... |
src/agent.lua
| ... | ... | @@ -285,6 +285,7 @@ function CMD.close() |
| 285 | 285 | local role = agentInfo.role |
| 286 | 286 | if not role then return end |
| 287 | 287 | role:log("onLogout", {logtime = skynet.timex()-role:getProperty("ltime")}) |
| 288 | + role:mylog("logout", {int1 = skynet.timex()-role:getProperty("ltime")}) | |
| 288 | 289 | role:onOfflineEvent() |
| 289 | 290 | end |
| 290 | 291 | ... | ... |
src/models/HeroPlugin.lua
| ... | ... | @@ -3,7 +3,7 @@ local HeroPlugin = {} |
| 3 | 3 | |
| 4 | 4 | function HeroPlugin.bind(Hero) |
| 5 | 5 | |
| 6 | - function Hero:log(contents) | |
| 6 | + function Hero:mylog(contents) | |
| 7 | 7 | contents = contents or {} |
| 8 | 8 | if contents["cint1"] or contents["cint2"] or contents["cint3"] then |
| 9 | 9 | print("heroLog error log have cint1 or cint2 or cint3 ", debug.traceback()) |
| ... | ... | @@ -11,7 +11,7 @@ function HeroPlugin.bind(Hero) |
| 11 | 11 | contents["cint1"] = self:getProperty("id") |
| 12 | 12 | contents["cint2"] = self:getProperty("type") |
| 13 | 13 | |
| 14 | - self.owner:log("hero_action", contents) | |
| 14 | + self.owner:mylog("hero_action", contents) | |
| 15 | 15 | end |
| 16 | 16 | |
| 17 | 17 | function Hero:getMaxLevel() | ... | ... |
src/models/RoleLog.lua
| 1 | -local server_id = (skynet.getenv("serverType") or "localtest") .. "_" .. skynet.getenv("servId") | |
| 1 | +local serverId = skynet.getenv("servId") | |
| 2 | +local server_id = (skynet.getenv("serverType") or "localtest") .. "_" .. serverId | |
| 2 | 3 | |
| 3 | 4 | --[[ |
| 4 | 5 | 100 购买/兑换行为 |
| ... | ... | @@ -198,10 +199,9 @@ local MethodType = { |
| 198 | 199 | mission_strength = true, -- 消耗的体力或次数 |
| 199 | 200 | mission_score = true, -- 本局分数,PVP玩法记录为对战后积分,无得分的填0 |
| 200 | 201 | mission_cleartype = true, -- 1正常通关;2代理拾荒 |
| 201 | - mission_rank = true, -- 对战后排名,适用于PVP玩法和电波塔,其他玩法留空 | |
| 202 | + mission_rank = "auto", -- 对战后排名,适用于PVP玩法和电波塔,其他玩法留空 | |
| 202 | 203 | misson_monsterkill = "json", -- 击杀怪物ID和数量,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} |
| 203 | 204 | misson_teamskill = "json", -- 编队支援技能和技能等级情况,json格式记录,{"teamskill1":1,"teamskill2":2,………..} |
| 204 | - misson_teambond = "json", -- 编队羁绊和羁绊等级,json格式记录,{"bondid1":1,"bondid2":2,………..} | |
| 205 | 205 | }, |
| 206 | 206 | residence_reward = { --玩家挂机或排名奖励 |
| 207 | 207 | mission_threadid = true, --大关卡ID |
| ... | ... | @@ -465,6 +465,178 @@ local function getBaseLog(self) |
| 465 | 465 | end |
| 466 | 466 | |
| 467 | 467 | |
| 468 | +-- logType | |
| 469 | +local LogType = { | |
| 470 | + create = "common", | |
| 471 | + login = "common", | |
| 472 | + logout = "common", | |
| 473 | + guide = "common", | |
| 474 | + | |
| 475 | + in_item = "common", | |
| 476 | + out_item = "common", | |
| 477 | + in_diamond = "common", | |
| 478 | + out_diamond = "common", | |
| 479 | + in_hero = "common", | |
| 480 | + out_hero = "common", | |
| 481 | + in_equip = "common", | |
| 482 | + out_equip = "common", | |
| 483 | + in_rune = "common", | |
| 484 | + out_rune = "common", | |
| 485 | + player_exp = "common", | |
| 486 | + func_open = "common", | |
| 487 | + in_adv = "common", | |
| 488 | + out_adv = "common", | |
| 489 | + in_artifact = "common", | |
| 490 | + | |
| 491 | + mail_action = "common", | |
| 492 | + role_action = "common", | |
| 493 | + hang_action = "common", | |
| 494 | + hero_action = "common", | |
| 495 | + adv_action = "common", | |
| 496 | + rune_action = "common", | |
| 497 | + pvp_action = "common", | |
| 498 | + diner_action = "common", | |
| 499 | + tower_action = "common", | |
| 500 | + gm_action = "common", | |
| 501 | + act_action = "common", | |
| 502 | +} | |
| 503 | + | |
| 504 | +-- 如要修改 要提前修改 _template mapping -- 对应 mapping 为 gamelog-* | |
| 505 | +local Mapping = { | |
| 506 | + -- 预留一些数据格式 担心integer 范围不够用 将 通用的int* 全部换为long | |
| 507 | + common = { | |
| 508 | + desc = "keyword",--索引的短字符串 | |
| 509 | + ucode = "keyword",--关联日志对应ucode | |
| 510 | + key1 = "keyword", --可索引的短字符串 | |
| 511 | + key2 = "keyword", --可索引的短字符串 | |
| 512 | + -- 几乎不用的长文本 | |
| 513 | + text1 = "text", --长字符串不索引的类型 | |
| 514 | + -- 五个不同类型的数字 基本上满足数量要求 尽量从低到高用 | |
| 515 | + short1 = "short", | |
| 516 | + int1 = "long", | |
| 517 | + int2 = "long", | |
| 518 | + long1 = "long", | |
| 519 | + float1 = "float", | |
| 520 | + | |
| 521 | + -- 底层使用的 一些参数 | |
| 522 | + cint1 = "long", | |
| 523 | + cint2 = "long", | |
| 524 | + cint3 = "long", | |
| 525 | + } | |
| 526 | +} | |
| 527 | + | |
| 528 | +-- 所有的日志都包括的部分 role 里面的信息 -- mapping 信息在 gamelog-role | |
| 529 | +local commonRoleField = { | |
| 530 | + name = "keyword", | |
| 531 | + id = "integer", | |
| 532 | + uid = "keyword", | |
| 533 | + sid = "short", | |
| 534 | + device = "keyword", | |
| 535 | + ctime = "integer", | |
| 536 | + ltime = "integer", | |
| 537 | + level = "short", | |
| 538 | + rmbC = "integer", | |
| 539 | +} | |
| 540 | + | |
| 541 | +local function checkType(logType, field, value, ctype) | |
| 542 | + local typecheckfunc = { | |
| 543 | + keyword = function() | |
| 544 | + --长度不超过256 | |
| 545 | + if type(value) ~= "string" then | |
| 546 | + value = tostring(value) | |
| 547 | + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [keyword], value : %s", logType, field, value)) | |
| 548 | + else | |
| 549 | + if #value > 256 then | |
| 550 | + printError(string.format("LOG ERROR: logType [%s] field [%s] [keyword] type to long. value : %s", logType, field, value)) | |
| 551 | + end | |
| 552 | + end | |
| 553 | + return value | |
| 554 | + end, | |
| 555 | + text = function() | |
| 556 | + if type(value) ~= "string" then | |
| 557 | + value = tostring(value) | |
| 558 | + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [text], value : %s", logType, field, value)) | |
| 559 | + end | |
| 560 | + return value | |
| 561 | + end, | |
| 562 | + integer = function() | |
| 563 | + if type(value) ~= "number" then | |
| 564 | + value = tonumber(value) | |
| 565 | + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], value : %s", logType, field, value)) | |
| 566 | + end | |
| 567 | + if value then | |
| 568 | + if math.type(value) ~= "integer" then | |
| 569 | + local oldValue = value | |
| 570 | + value = math.floor(value) | |
| 571 | + if value ~= oldValue then | |
| 572 | + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], is float, value : %s", logType, field, value)) | |
| 573 | + end | |
| 574 | + end | |
| 575 | + if -2147483648 > value or value > 2147483647 then | |
| 576 | + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], too big, value : %s", logType, field, value)) | |
| 577 | + value = nil | |
| 578 | + end | |
| 579 | + end | |
| 580 | + return value | |
| 581 | + end, | |
| 582 | + short = function() | |
| 583 | + if type(value) ~= "number" then | |
| 584 | + value = tonumber(value) | |
| 585 | + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], value : %s", logType, field, value)) | |
| 586 | + end | |
| 587 | + if value then | |
| 588 | + if math.type(value) ~= "integer" then | |
| 589 | + local oldValue = value | |
| 590 | + value = math.floor(value) | |
| 591 | + if value ~= oldValue then | |
| 592 | + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], is float, value : %s", logType, field, value)) | |
| 593 | + end | |
| 594 | + end | |
| 595 | + | |
| 596 | + if -32768 > value or value > 32768 then | |
| 597 | + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], too big, value : %s", logType, field, value)) | |
| 598 | + value = nil | |
| 599 | + end | |
| 600 | + end | |
| 601 | + return value | |
| 602 | + end, | |
| 603 | + long = function() | |
| 604 | + if type(value) ~= "number" then | |
| 605 | + value = tonumber(value) | |
| 606 | + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], value : %s", logType, field, value)) | |
| 607 | + end | |
| 608 | + if value then | |
| 609 | + if math.type(value) ~= "integer" then | |
| 610 | + local oldValue = value | |
| 611 | + value = math.floor(value) | |
| 612 | + if type(value) ~= "integer" then | |
| 613 | + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], too big, value : %s", logType, field, value)) | |
| 614 | + value = nil | |
| 615 | + elseif value ~= oldValue then | |
| 616 | + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], is float, value : %s", logType, field, value)) | |
| 617 | + end | |
| 618 | + end | |
| 619 | + end | |
| 620 | + return value | |
| 621 | + end, | |
| 622 | + float = function() | |
| 623 | + if type(value) ~= "number" then | |
| 624 | + value = tonumber(value) | |
| 625 | + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [float], value : %s", logType, field, value)) | |
| 626 | + end | |
| 627 | + return value | |
| 628 | + end, | |
| 629 | + } | |
| 630 | + | |
| 631 | + if typecheckfunc[ctype] then | |
| 632 | + return typecheckfunc[ctype]() | |
| 633 | + else | |
| 634 | + printError(string.format("LOG ERROR: logType [%s] field [%s] have a new type [%s] need add check.", logType, field, ctype)) | |
| 635 | + return nil | |
| 636 | + end | |
| 637 | +end | |
| 638 | + | |
| 639 | + | |
| 468 | 640 | |
| 469 | 641 | local RoleLog = {} |
| 470 | 642 | function RoleLog.bind(Role) |
| ... | ... | @@ -493,13 +665,14 @@ function RoleLog.bind(Role) |
| 493 | 665 | if not contents[field] then |
| 494 | 666 | if tag == "ucode" then |
| 495 | 667 | contents[field] = self:getActionUcode() |
| 668 | + elseif tag == "auto" then | |
| 496 | 669 | else |
| 497 | 670 | printError(string.format("LOG ERROR: logType [%s] lose field [%s].", logType, field)) |
| 498 | 671 | end |
| 499 | 672 | end |
| 500 | 673 | end |
| 501 | 674 | if not logd then return end |
| 502 | - pcall(skynet.send, logd, "lua", "log", doc) | |
| 675 | + pcall(skynet.send, logd, "lua", "log", doc, "bi") | |
| 503 | 676 | end |
| 504 | 677 | |
| 505 | 678 | function Role:logItems(itemId, before, after, log) |
| ... | ... | @@ -530,6 +703,38 @@ function RoleLog.bind(Role) |
| 530 | 703 | }) |
| 531 | 704 | end |
| 532 | 705 | |
| 706 | + function Role:mylog(logType, contents) | |
| 707 | + contents = contents or {} | |
| 708 | + local _logType = LogType[logType] | |
| 709 | + if not _logType then | |
| 710 | + printError(string.format("LOG ERROR: new logType [%s] need Add Maping.", logType)) | |
| 711 | + return | |
| 712 | + end | |
| 713 | + local doc = {} | |
| 714 | + for field, ctype in pairs(commonRoleField) do | |
| 715 | + if contents[field] then | |
| 716 | + printError(string.format("LOG ERROR: logType [%s] had field [%s] overwrite default.", logType, field)) | |
| 717 | + end | |
| 718 | + doc[field] = checkType("commonRoleField", field, self:getProperty(field), ctype) | |
| 719 | + end | |
| 720 | + | |
| 721 | + local mapping = Mapping[_logType] | |
| 722 | + if mapping["ucode"] and not contents["ucode"] then | |
| 723 | + contents["ucode"] = self:getActionUcode() | |
| 724 | + end | |
| 725 | + for field, value in pairs(contents) do | |
| 726 | + local ftype = mapping[field] | |
| 727 | + if ftype then | |
| 728 | + doc[field] = checkType(logType, field, value, ftype) | |
| 729 | + else | |
| 730 | + printError(string.format("LOG ERROR: logType [%s] have new field [%s] no type in mapping.", logType, field)) | |
| 731 | + end | |
| 732 | + end | |
| 733 | + doc["@type"] = logType | |
| 734 | + if not logd then return end | |
| 735 | + pcall(skynet.send, logd, "lua", "log", doc, "log") | |
| 736 | + end | |
| 737 | + | |
| 533 | 738 | |
| 534 | 739 | function Role:startActionUcode() |
| 535 | 740 | if not self._uniqueCount then |
| ... | ... | @@ -550,5 +755,6 @@ function RoleLog.bind(Role) |
| 550 | 755 | end |
| 551 | 756 | |
| 552 | 757 | |
| 758 | + | |
| 553 | 759 | end |
| 554 | 760 | return RoleLog |
| 555 | 761 | \ No newline at end of file | ... | ... |
src/models/RolePlugin.lua
| ... | ... | @@ -235,7 +235,22 @@ function RolePlugin.bind(Role) |
| 235 | 235 | else |
| 236 | 236 | print("addPlayExp no log ", debug.traceback()) |
| 237 | 237 | end |
| 238 | + end | |
| 239 | + | |
| 240 | + if params.log then | |
| 241 | + local log = params.log | |
| 242 | + if log["cint1"] or log["cint2"] then | |
| 243 | + print("addPlayExp error log have cint1 or cint2 or cint3", debug.traceback()) | |
| 244 | + end | |
| 238 | 245 | |
| 246 | + | |
| 247 | + log["cint1"] = addExp | |
| 248 | + log["cint2"] = newExp | |
| 249 | + log["cint3"] = level | |
| 250 | + | |
| 251 | + self:mylog("player_exp", log) | |
| 252 | + else | |
| 253 | + print("addPlayExp no log ", debug.traceback()) | |
| 239 | 254 | end |
| 240 | 255 | |
| 241 | 256 | self:updateProperties({level = level, exp = newExp}) |
| ... | ... | @@ -259,6 +274,21 @@ function RolePlugin.bind(Role) |
| 259 | 274 | end |
| 260 | 275 | |
| 261 | 276 | self:logItems(params.itemId, origin, nums, params.log) |
| 277 | + if params.log then | |
| 278 | + local log = params.log | |
| 279 | + if log["cint1"] or log["cint2"] then | |
| 280 | + print("addItem error log have cint1 or cint2 ", debug.traceback()) | |
| 281 | + end | |
| 282 | + log["cint1"] = params.itemId | |
| 283 | + log["cint2"] = math.abs(params.count) | |
| 284 | + if params.count <= 0 then | |
| 285 | + self:mylog("out_item", log) | |
| 286 | + else | |
| 287 | + self:mylog("in_item", log) | |
| 288 | + end | |
| 289 | + else | |
| 290 | + print("addItem no log ", debug.traceback()) | |
| 291 | + end | |
| 262 | 292 | |
| 263 | 293 | self:setProperty("items", items) |
| 264 | 294 | if not params.notNotify then |
| ... | ... | @@ -329,11 +359,22 @@ function RolePlugin.bind(Role) |
| 329 | 359 | end |
| 330 | 360 | |
| 331 | 361 | self:logItems(ItemId.Diamond, origin, count, params.log) |
| 362 | + if params.log then | |
| 363 | + local log = params.log | |
| 364 | + if log["cint1"] or log["cint2"] or log["cint3"] then | |
| 365 | + print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 366 | + end | |
| 367 | + log["cint1"] = origin | |
| 368 | + log["cint2"] = count | |
| 369 | + self:mylog("in_diamond", log) | |
| 370 | + else | |
| 371 | + print("gainDiamond no log ", debug.traceback()) | |
| 372 | + end | |
| 373 | + | |
| 332 | 374 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) |
| 333 | 375 | return true |
| 334 | 376 | end |
| 335 | 377 | |
| 336 | - | |
| 337 | 378 | function Role:costDiamond(params) |
| 338 | 379 | if not params or type(params) ~= "table" then return false end |
| 339 | 380 | local count = tonum(params.count) |
| ... | ... | @@ -368,6 +409,17 @@ function RolePlugin.bind(Role) |
| 368 | 409 | |
| 369 | 410 | |
| 370 | 411 | self:logItems(ItemId.Diamond, origin, count, params.log) |
| 412 | + if params.log then | |
| 413 | + local log = params.log | |
| 414 | + if log["cint1"] or log["cint2"] or log["cint3"] then | |
| 415 | + print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 416 | + end | |
| 417 | + log["cint1"] = origin | |
| 418 | + log["cint2"] = count | |
| 419 | + self:mylog("out_diamond", log) | |
| 420 | + else | |
| 421 | + print("costDiamond no log ", debug.traceback()) | |
| 422 | + end | |
| 371 | 423 | |
| 372 | 424 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) |
| 373 | 425 | return true |
| ... | ... | @@ -406,6 +458,17 @@ function RolePlugin.bind(Role) |
| 406 | 458 | |
| 407 | 459 | self:logItems(heroType + ItemStartId.Hero, 0, 1, params.log) |
| 408 | 460 | |
| 461 | + if params.log then | |
| 462 | + local log = params.log | |
| 463 | + if log["cint1"] or log["cint2"] or log["cint3"] then | |
| 464 | + print("addHero error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 465 | + end | |
| 466 | + log["cint1"] = heroId | |
| 467 | + log["cint2"] = heroType | |
| 468 | + self:mylog("in_hero", log) | |
| 469 | + else | |
| 470 | + print("addHero no log ", debug.traceback()) | |
| 471 | + end | |
| 409 | 472 | return true, newHero |
| 410 | 473 | end |
| 411 | 474 | |
| ... | ... | @@ -516,6 +579,22 @@ function RolePlugin.bind(Role) |
| 516 | 579 | self:setProperty("equips", equips) |
| 517 | 580 | |
| 518 | 581 | self:logItems(equipCsv.id, oldCount, curCount, pms.log) |
| 582 | + if pms.log then | |
| 583 | + local log = pms.log | |
| 584 | + if log["cint1"] or log["cint2"] or log["cint3"] then | |
| 585 | + print("addEquip error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 586 | + end | |
| 587 | + log["cint1"] = equipType | |
| 588 | + log["cint2"] = equipLv | |
| 589 | + log["cint3"] = math.abs(count) | |
| 590 | + if count < 0 then | |
| 591 | + self:mylog("out_equip", log) | |
| 592 | + else | |
| 593 | + self:mylog("in_equip", log) | |
| 594 | + end | |
| 595 | + else | |
| 596 | + print("addEquip no log ", debug.traceback()) | |
| 597 | + end | |
| 519 | 598 | |
| 520 | 599 | if not pms.notNotify then |
| 521 | 600 | self:changeUpdates({{type = "equips", field = {equipType, equipLv}, value = curCount, isOnlyToC = true}}) -- 通知客户端 |
| ... | ... | @@ -576,6 +655,20 @@ function RolePlugin.bind(Role) |
| 576 | 655 | self:checkTaskEnter("AddRune", {id = params.id, type = params.type, rarity = data.rarity}, params.notNotify) |
| 577 | 656 | |
| 578 | 657 | self:logItems(params.id, 0, 1, params.log) |
| 658 | + if params.log then | |
| 659 | + local log = params.log | |
| 660 | + if log["cint1"] or log["cint2"] or log["cint3"] then | |
| 661 | + print("addRune error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 662 | + end | |
| 663 | + | |
| 664 | + log["cint1"] = runeUid | |
| 665 | + log["cint2"] = params.type | |
| 666 | + log["cint3"] = params.id | |
| 667 | + | |
| 668 | + self:mylog("in_rune", log) | |
| 669 | + else | |
| 670 | + print("addRune no log ", debug.traceback()) | |
| 671 | + end | |
| 579 | 672 | |
| 580 | 673 | return 0, newRune |
| 581 | 674 | else |
| ... | ... | @@ -592,6 +685,20 @@ function RolePlugin.bind(Role) |
| 592 | 685 | if rune and rune:getProperty("refer") == 0 then |
| 593 | 686 | |
| 594 | 687 | self:logItems(rune:getProperty("id"), 1, 0, params.log) |
| 688 | + if params.log then | |
| 689 | + local log = params.log | |
| 690 | + if log["cint1"] or log["cint2"] or log["cint3"] then | |
| 691 | + print("delRunes error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 692 | + end | |
| 693 | + | |
| 694 | + log["cint1"] = runeId | |
| 695 | + log["cint2"] = rune:getProperty("type") | |
| 696 | + log["cint3"] = rune:getProperty("id") | |
| 697 | + | |
| 698 | + self:mylog("out_rune", log) | |
| 699 | + else | |
| 700 | + print("delRunes no log ", debug.traceback()) | |
| 701 | + end | |
| 595 | 702 | |
| 596 | 703 | self.runeBag[runeId] = nil |
| 597 | 704 | table.insert(bDel, runeId) |
| ... | ... | @@ -838,6 +945,19 @@ function RolePlugin.bind(Role) |
| 838 | 945 | count = count or 1 |
| 839 | 946 | |
| 840 | 947 | self:logItems(func, 0, count, params.log) |
| 948 | + if params.log then | |
| 949 | + local log = params.log | |
| 950 | + if log["cint1"] or log["cint2"] or log["cint3"] then | |
| 951 | + print("funcOpen error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 952 | + end | |
| 953 | + | |
| 954 | + log["cint1"] = func | |
| 955 | + log["cint2"] = count | |
| 956 | + | |
| 957 | + self:mylog("func_open", log) | |
| 958 | + else | |
| 959 | + print("funcOpen no log ", debug.traceback()) | |
| 960 | + end | |
| 841 | 961 | |
| 842 | 962 | if csvdb["itemCsv"][func] and csvdb["itemCsv"][func].type == ItemType.FuncOpen then |
| 843 | 963 | local unlockData = csvdb["unlockCsv"][func] |
| ... | ... | @@ -1393,7 +1513,10 @@ function RolePlugin.bind(Role) |
| 1393 | 1513 | |
| 1394 | 1514 | local order_type = self:getProperty("rmbC") > 0 and 0 or 1 |
| 1395 | 1515 | local status, reward = self:recharge({ |
| 1396 | - id = rechargeId | |
| 1516 | + id = rechargeId, | |
| 1517 | + transactionId = params.transactionId, | |
| 1518 | + pay_time = params.pay_time, | |
| 1519 | + order = partnerOrderStr, | |
| 1397 | 1520 | }) |
| 1398 | 1521 | orderObject:setProperty("finishTime", skynet.time()) |
| 1399 | 1522 | orderObject:setProperty("status", "finish") |
| ... | ... | @@ -1466,6 +1589,8 @@ function RolePlugin.bind(Role) |
| 1466 | 1589 | -- 累充 |
| 1467 | 1590 | local rmb = rechargeData.rmb |
| 1468 | 1591 | self:updateProperty({field = "rmbC", delta = rmb}) |
| 1592 | + | |
| 1593 | + self:mylog("role_action", {desc = "recharge", int1 = id, int2 = rmb, key1 = params.transactionId, key2 = params.order, long1 = params.pay_time}) | |
| 1469 | 1594 | |
| 1470 | 1595 | return nil, reward |
| 1471 | 1596 | end |
| ... | ... | @@ -1513,6 +1638,7 @@ function RolePlugin.bind(Role) |
| 1513 | 1638 | end |
| 1514 | 1639 | self:updateProperty({field = "funcGuide", value = funcGuide}) |
| 1515 | 1640 | self:log("onGuidePoint", {guild_type = 0, guild_id = master, guild_point = slave, guild_pass = 0}) |
| 1641 | + self:mylog("guide", {desc = "guide_new",int1 = master*1000+slave}) | |
| 1516 | 1642 | |
| 1517 | 1643 | newerGuide = string.format("%d=%d",master,slave) |
| 1518 | 1644 | self:updateProperty({field = "newerGuide", value = newerGuide}) | ... | ... |
src/models/Rune.lua
| ... | ... | @@ -26,16 +26,16 @@ function Rune:notifyUpdateProperty(field, newValue, oldValue) |
| 26 | 26 | self:notifyUpdateProperties(datas) |
| 27 | 27 | end |
| 28 | 28 | |
| 29 | -function Rune:log(contents) | |
| 30 | - -- contents = contents or {} | |
| 31 | - -- if contents["cint1"] or contents["cint2"] or contents["cint3"] then | |
| 32 | - -- print("heroLog error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 33 | - -- end | |
| 34 | - -- contents["cint1"] = self:getProperty("uid") | |
| 35 | - -- contents["cint2"] = self:getProperty("type") | |
| 36 | - -- contents["cint3"] = self:getProperty("id") | |
| 29 | +function Rune:mylog(contents) | |
| 30 | + contents = contents or {} | |
| 31 | + if contents["cint1"] or contents["cint2"] or contents["cint3"] then | |
| 32 | + print("heroLog error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 33 | + end | |
| 34 | + contents["cint1"] = self:getProperty("uid") | |
| 35 | + contents["cint2"] = self:getProperty("type") | |
| 36 | + contents["cint3"] = self:getProperty("id") | |
| 37 | 37 | |
| 38 | - -- self.owner:log("rune_action", contents) | |
| 38 | + self.owner:mylog("rune_action", contents) | |
| 39 | 39 | end |
| 40 | 40 | |
| 41 | 41 | function Rune:notifyUpdateProperties(params) | ... | ... |
src/services/agent_ctrl.lua
| ... | ... | @@ -128,7 +128,7 @@ function _M:check_agent_status() |
| 128 | 128 | next_log_time = now + 60 |
| 129 | 129 | local count = table_nums(self.u2f) |
| 130 | 130 | datacenter.set("onlineCount", count) |
| 131 | - -- pcall(skynet.send, logd, "lua", "log", "online", {count = count}, "online") | |
| 131 | + pcall(skynet.send, logd, "lua", "log", {["@type"] = "online", count = count}, "log") | |
| 132 | 132 | end |
| 133 | 133 | end |
| 134 | 134 | ... | ... |
src/services/logd.lua
| ... | ... | @@ -13,8 +13,37 @@ local pairs = pairs |
| 13 | 13 | local ipairs = ipairs |
| 14 | 14 | local string_format = string.format |
| 15 | 15 | |
| 16 | +local logId = 0 | |
| 16 | 17 | local CMD, cs = {} |
| 17 | -local log_fd, connecting = nil , false | |
| 18 | + | |
| 19 | +local logHandle = { | |
| 20 | + bi = { | |
| 21 | + host = "127.0.0.1", | |
| 22 | + port = 13001, | |
| 23 | + }, | |
| 24 | + log = { | |
| 25 | + host = "127.0.0.1", | |
| 26 | + port = 13002, | |
| 27 | + handle = function(doc) | |
| 28 | + -- 注入字段 | |
| 29 | + local now = skynet.timex() | |
| 30 | + doc["time"] = now | |
| 31 | + doc["timestamp"] = now | |
| 32 | + doc["server"] = serverId | |
| 33 | + doc["game_name"] = "wasteland" | |
| 34 | + doc["env"] = "cb" | |
| 35 | + doc["game_name_type"] = "guaji" | |
| 36 | + doc["log_id"] = "wastelandC" .. logId .. "S" .. serverId .. "T" .. now | |
| 37 | + logId = (logId + 1) % 10000000 | |
| 38 | + end | |
| 39 | + }, | |
| 40 | +} | |
| 41 | + | |
| 42 | +local connect_relation = {} | |
| 43 | +local function getConInfo(fd) | |
| 44 | + return logHandle[connect_relation[fd] or ""] | |
| 45 | +end | |
| 46 | + | |
| 18 | 47 | |
| 19 | 48 | |
| 20 | 49 | local socket_message = {} |
| ... | ... | @@ -27,20 +56,30 @@ end |
| 27 | 56 | |
| 28 | 57 | -- SKYNET_SOCKET_TYPE_CONNECT = 2 |
| 29 | 58 | socket_message[2] = function(id, _ , addr) |
| 59 | + local cur = getConInfo(id) | |
| 30 | 60 | skynet.error("LOG SOCKET: connect: ", addr) |
| 31 | - connecting = false | |
| 61 | + cur.connected = true | |
| 62 | + cur.connecting = false | |
| 32 | 63 | end |
| 33 | 64 | |
| 34 | 65 | -- SKYNET_SOCKET_TYPE_CLOSE = 3 |
| 35 | 66 | socket_message[3] = function(id) |
| 36 | 67 | skynet.error("LOG SOCKET: closed") |
| 37 | - connecting = false | |
| 68 | + local cur = getConInfo(id) | |
| 69 | + if not cur then return end | |
| 70 | + cur.connected = false | |
| 71 | + cur.connecting = false | |
| 72 | + connect_relation[id] = nil | |
| 38 | 73 | end |
| 39 | 74 | |
| 40 | 75 | -- SKYNET_SOCKET_TYPE_ERROR = 5 |
| 41 | 76 | socket_message[5] = function(id, _, err) |
| 42 | 77 | skynet.error("LOG SOCKET: error: ", err) |
| 43 | - connecting = false | |
| 78 | + local cur = getConInfo(id) | |
| 79 | + if not cur then return end | |
| 80 | + cur.connected = false | |
| 81 | + cur.connecting = false | |
| 82 | + connect_relation[id] = nil | |
| 44 | 83 | end |
| 45 | 84 | |
| 46 | 85 | |
| ... | ... | @@ -55,18 +94,33 @@ skynet.register_protocol { |
| 55 | 94 | end |
| 56 | 95 | } |
| 57 | 96 | |
| 58 | -function CMD.log(doc) | |
| 59 | - if not socketdriver.send(log_fd, json.encode(doc) .. "\n") then | |
| 60 | - if not connecting then | |
| 61 | - CMD.open() -- 连一下试试 | |
| 62 | - socketdriver.send(log_fd, json.encode(doc) .. "\n") | |
| 97 | +function CMD.log(doc, logTo) | |
| 98 | + logTo = logTo or "log" | |
| 99 | + local cur = logHandle[logTo] | |
| 100 | + if not cur then | |
| 101 | + print("error log to ", logTo) | |
| 102 | + end | |
| 103 | + if cur.handle then | |
| 104 | + cur.handle(doc) | |
| 105 | + end | |
| 106 | + if cur.connected and cur.fd then | |
| 107 | + socketdriver.send(cur.fd, json.encode(doc) .. "\n") | |
| 108 | + else | |
| 109 | + -- 断线会丢失一部分日志 | |
| 110 | + if not cur.connecting then | |
| 111 | + CMD.open() -- 连一下 | |
| 63 | 112 | end |
| 64 | 113 | end |
| 65 | 114 | end |
| 66 | 115 | |
| 67 | 116 | function CMD.open() |
| 68 | - log_fd = socketdriver.connect("127.0.0.1", 13001) | |
| 69 | - connecting = true | |
| 117 | + for logTo, data in pairs(logHandle) do | |
| 118 | + if not data.connecting and not data.connected then | |
| 119 | + data.connecting = true | |
| 120 | + data.fd = socketdriver.connect(data.host, data.port) | |
| 121 | + connect_relation[data.fd] = logTo | |
| 122 | + end | |
| 123 | + end | |
| 70 | 124 | end |
| 71 | 125 | |
| 72 | 126 | local function __init__() |
| ... | ... | @@ -75,8 +129,8 @@ local function __init__() |
| 75 | 129 | if command == "open" then |
| 76 | 130 | skynet.ret(skynet.pack(f(...))) |
| 77 | 131 | else |
| 78 | - local logType, doc, index_suffix = ... | |
| 79 | - cs(function() f(logType, doc, index_suffix) end) | |
| 132 | + local doc, logTo = ... | |
| 133 | + cs(function() f(doc, logTo) end) | |
| 80 | 134 | end |
| 81 | 135 | end) |
| 82 | 136 | cs = queue() | ... | ... |