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