Commit 44c6e479c231bc9e8484f3cd5b623ecaa7f83624

Authored by zhouhaihai
1 parent 13e7d6bb

增加部分日志

docs/日志说明.xlsx 0 → 100644
No preview for this file type
src/actions/EmailAction.lua
@@ -53,7 +53,7 @@ function _M.listRpc(agent, data) @@ -53,7 +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:log("mail_actions", {desc = "get_global", s1 = email.title, s2 = email.attachments}) 56 + role:log("mail_actions", {desc = "get_global", key1 = email.title, key2 = email.attachments})
57 end 57 end
58 end 58 end
59 end 59 end
@@ -98,7 +98,7 @@ function _M.drawAllAttachRpc(agent, data) @@ -98,7 +98,7 @@ function _M.drawAllAttachRpc(agent, data)
98 local items = role:award(attachments) 98 local items = role:award(attachments)
99 ids[emailId] = 1 99 ids[emailId] = 1
100 red:hset(string.format(R_EMAIL_ITEM, roleId, emailId), "status", 2) 100 red:hset(string.format(R_EMAIL_ITEM, roleId, emailId), "status", 2)
101 - -- role:log("mail_actions", {desc = "draw_attach", int1 = emailId, s1 = email:getProperty("title"), s2 = attachments}) 101 + role:log("mail_actions", {desc = "draw_attach", int1 = emailId, key1 = email:getProperty("title"), key2 = attachments})
102 102
103 for key, v in pairs(items) do 103 for key, v in pairs(items) do
104 reward[key] = (reward[key] or 0) + v 104 reward[key] = (reward[key] or 0) + v
@@ -129,7 +129,7 @@ function _M.drawAttachRpc(agent, data) @@ -129,7 +129,7 @@ function _M.drawAttachRpc(agent, data)
129 redisproxy:hset(rds, "status", 2) -- 领取标记 129 redisproxy:hset(rds, "status", 2) -- 领取标记
130 SendPacket(actionCodes.Email_drawAttachRpc, MsgPack.pack({reward = reward})) 130 SendPacket(actionCodes.Email_drawAttachRpc, MsgPack.pack({reward = reward}))
131 131
132 - -- role:log("mail_actions", {desc = "draw_attach", int1 = id, s1 = email:getProperty("title"), s2 = attachments, ucode = ucode}) 132 + role:log("mail_actions", {desc = "draw_attach", int1 = id, key1 = email:getProperty("title"), key2 = attachments})
133 return true 133 return true
134 end 134 end
135 135
@@ -144,7 +144,7 @@ function _M.checkRpc(agent, data) @@ -144,7 +144,7 @@ function _M.checkRpc(agent, data)
144 if not redisproxy:exists(rds) then return end 144 if not redisproxy:exists(rds) then return end
145 145
146 redisproxy:hset(rds, "status", 1) 146 redisproxy:hset(rds, "status", 1)
147 - -- role:log("mail_actions", {desc = "check_mail", int1 = id}) 147 + role:log("mail_actions", {desc = "check_mail", int1 = id})
148 148
149 SendPacket(actionCodes.Email_checkRpc, '') 149 SendPacket(actionCodes.Email_checkRpc, '')
150 return true 150 return true
@@ -179,9 +179,9 @@ function _M.delRpc(agent, data) @@ -179,9 +179,9 @@ function _M.delRpc(agent, data)
179 end 179 end
180 end 180 end
181 end) 181 end)
182 - -- for delId, _ in ipairs(result) do  
183 - -- role:log("mail_actions", {desc = "del_mail", int1 = delId})  
184 - -- end 182 + for delId, _ in ipairs(result) do
  183 + role:log("mail_actions", {desc = "del_mail", int1 = delId})
  184 + end
185 SendPacket(actionCodes.Email_delRpc, MsgPack.pack({result = result})) 185 SendPacket(actionCodes.Email_delRpc, MsgPack.pack({result = result}))
186 return true 186 return true
187 end 187 end
src/actions/RoleAction.lua
@@ -94,6 +94,8 @@ function _M.loginRpc( agent, data ) @@ -94,6 +94,8 @@ function _M.loginRpc( agent, data )
94 role = require("models.Role").new({key = roleKey}) 94 role = require("models.Role").new({key = roleKey})
95 role:load() 95 role:load()
96 role:loadAll() 96 role:loadAll()
  97 + role:startActionUcode()
  98 + role:setProperty("ltime", now)
97 else 99 else
98 role:reloadWhenLogin() 100 role:reloadWhenLogin()
99 end 101 end
@@ -120,7 +122,6 @@ function _M.loginRpc( agent, data ) @@ -120,7 +122,6 @@ function _M.loginRpc( agent, data )
120 122
121 -- 跨天登陆事件 123 -- 跨天登陆事件
122 role:updateTimeReset(now) 124 role:updateTimeReset(now)
123 - role:setProperty("ltime", now)  
124 redisproxy:zadd(FRIEND_RECOMMEND, now, roleId) 125 redisproxy:zadd(FRIEND_RECOMMEND, now, roleId)
125 126
126 for _, name in ipairs({"dailyData", "dinerData"}) do 127 for _, name in ipairs({"dailyData", "dinerData"}) do
@@ -291,7 +292,7 @@ function _M.createRpc(agent, data) @@ -291,7 +292,7 @@ function _M.createRpc(agent, data)
291 SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response)) 292 SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response))
292 return true 293 return true
293 end 294 end
294 - 295 + newRole:startActionUcode()
295 newRole:award(globalCsv.birthItem) 296 newRole:award(globalCsv.birthItem)
296 -- 欢迎邮件 297 -- 欢迎邮件
297 redisproxy:insertEmail({roleId = roleId, emailId = 1}) 298 redisproxy:insertEmail({roleId = roleId, emailId = 1})
@@ -394,8 +395,8 @@ function _M.saleItemRpc(agent, data) @@ -394,8 +395,8 @@ function _M.saleItemRpc(agent, data)
394 reward[sellEffect[1]] = (reward[sellEffect[1]] or 0) + sellEffect[2] * count 395 reward[sellEffect[1]] = (reward[sellEffect[1]] or 0) + sellEffect[2] * count
395 end 396 end
396 397
397 - role:costItems(backs)  
398 - local reward = role:award(reward) 398 + role:costItems(backs, {log = {desc = "saleItem"}})
  399 + local reward = role:award(reward, {log = {desc = "saleItem"}})
399 role:checkTaskEnter("DecoFrag", {count = fragCount}) 400 role:checkTaskEnter("DecoFrag", {count = fragCount})
400 SendPacket(actionCodes.Role_saleItemRpc, MsgPack.pack({reward = reward})) 401 SendPacket(actionCodes.Role_saleItemRpc, MsgPack.pack({reward = reward}))
401 return true 402 return true
@@ -433,8 +434,8 @@ function _M.openItemRpc(agent, data) @@ -433,8 +434,8 @@ function _M.openItemRpc(agent, data)
433 end 434 end
434 reward[0] = nil 435 reward[0] = nil
435 436
436 - role:costItems({[itemId] = count})  
437 - reward = role:award(reward) 437 + role:costItems({[itemId] = count}, {log = {desc = "openItem"}})
  438 + reward = role:award(reward, {log = {desc = "openItem", int1 = itemId, int2 = count}})
438 439
439 SendPacket(actionCodes.Role_openItemRpc, MsgPack.pack({reward = reward})) 440 SendPacket(actionCodes.Role_openItemRpc, MsgPack.pack({reward = reward}))
440 return true 441 return true
@@ -457,7 +458,7 @@ function _M.openTimeBoxRpc(agent, data) @@ -457,7 +458,7 @@ function _M.openTimeBoxRpc(agent, data)
457 if not itemData or not randomData or randomData.openTime <= 0 then return end 458 if not itemData or not randomData or randomData.openTime <= 0 then return end
458 459
459 if boxL[slot] then return end 460 if boxL[slot] then return end
460 - role:costItems({[itemId] = 1}) 461 + role:costItems({[itemId] = 1}, {log = {desc = "openTimeBox"}})
461 boxL[slot] = {id = itemId, time = skynet.timex() + randomData.openTime} 462 boxL[slot] = {id = itemId, time = skynet.timex() + randomData.openTime}
462 463
463 elseif oper == 2 then -- 领取 464 elseif oper == 2 then -- 领取
@@ -468,7 +469,7 @@ function _M.openTimeBoxRpc(agent, data) @@ -468,7 +469,7 @@ function _M.openTimeBoxRpc(agent, data)
468 local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") 469 local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=")
469 local costD = math.ceil((boxL[slot].time - skynet.timex()) / (cost_pre[1] * 60)) * cost_pre[2] 470 local costD = math.ceil((boxL[slot].time - skynet.timex()) / (cost_pre[1] * 60)) * cost_pre[2]
470 if not role:checkItemEnough({[ItemId.BoxKey] = costD}) then return end 471 if not role:checkItemEnough({[ItemId.BoxKey] = costD}) then return end
471 - role:costItems({[ItemId.BoxKey] = costD}) 472 + role:costItems({[ItemId.BoxKey] = costD}, {log = {desc = "openTimeBox"}})
472 end 473 end
473 local boxId = boxL[slot].id 474 local boxId = boxL[slot].id
474 local itemData = csvdb["itemCsv"][boxId] 475 local itemData = csvdb["itemCsv"][boxId]
@@ -496,7 +497,7 @@ function _M.openTimeBoxRpc(agent, data) @@ -496,7 +497,7 @@ function _M.openTimeBoxRpc(agent, data)
496 reward[0] = nil 497 reward[0] = nil
497 498
498 boxL[slot] = nil 499 boxL[slot] = nil
499 - reward = role:award(reward) 500 + reward = role:award(reward, {log = {desc = "openTimeBox", int1 = boxId}})
500 role:checkTaskEnter("OpenBox", {id = boxId}) 501 role:checkTaskEnter("OpenBox", {id = boxId})
501 else 502 else
502 return 503 return
@@ -554,8 +555,8 @@ function _M.openSpeedUpBoxRpc(agent, data) @@ -554,8 +555,8 @@ function _M.openSpeedUpBoxRpc(agent, data)
554 return 555 return
555 end 556 end
556 557
557 - role:costItems({[id] = count})  
558 - reward = role:award(reward) 558 + role:costItems({[id] = count}, {log = {desc = "speedUpBox"}})
  559 + reward = role:award(reward, {log = {desc = "speedUpBox"}, int1 = id, int2 = count})
559 560
560 SendPacket(actionCodes.Role_openSpeedUpBoxRpc, MsgPack.pack({reward = reward})) 561 SendPacket(actionCodes.Role_openSpeedUpBoxRpc, MsgPack.pack({reward = reward}))
561 return true 562 return true
@@ -574,7 +575,7 @@ function _M.storyBookRewardRpc(agent, data) @@ -574,7 +575,7 @@ function _M.storyBookRewardRpc(agent, data)
574 -- 获取奖励 575 -- 获取奖励
575 storyStatus[storyId].s = -1 576 storyStatus[storyId].s = -1
576 role:changeUpdates({{ type = "storyB", field = storyId, value = storyStatus[storyId] }}) 577 role:changeUpdates({{ type = "storyB", field = storyId, value = storyStatus[storyId] }})
577 - local reward = role:award(storyBookData.gift) 578 + local reward = role:award(storyBookData.gift, {log = {desc = "storybookReward", int1 = storyId}})
578 SendPacket(actionCodes.Role_storyBookRewardRpc, MsgPack.pack({reward = reward})) 579 SendPacket(actionCodes.Role_storyBookRewardRpc, MsgPack.pack({reward = reward}))
579 return true 580 return true
580 end 581 end
@@ -594,7 +595,7 @@ function _M.unLockStoryBookRpc(agent, data) @@ -594,7 +595,7 @@ function _M.unLockStoryBookRpc(agent, data)
594 if not cost or not next(cost) then return end 595 if not cost or not next(cost) then return end
595 if not role:checkItemEnough(cost) then return end -- 消耗品不足 596 if not role:checkItemEnough(cost) then return end -- 消耗品不足
596 597
597 - role:costItems(cost) 598 + role:costItems(cost, {log = {desc = "unlockStory", int1 = storyId}})
598 599
599 -- 解锁 600 -- 解锁
600 storyStatus[storyId] = storyStatus[storyId] or {} 601 storyStatus[storyId] = storyStatus[storyId] or {}
@@ -626,7 +627,7 @@ function _M.taskRpc(agent, data) @@ -626,7 +627,7 @@ function _M.taskRpc(agent, data)
626 return 3 627 return 3
627 end 628 end
628 629
629 - local reward = role:award(taskData.reward) 630 + local reward = role:award(taskData.reward, {log = {desc = "finishTask", int1 = taskType, int2 = taskId}})
630 local active = (taskStatus["a"] or 0) + taskData.active 631 local active = (taskStatus["a"] or 0) + taskData.active
631 632
632 role:changeUpdates({ 633 role:changeUpdates({
@@ -659,7 +660,7 @@ function _M.taskActiveRpc(agent, data) @@ -659,7 +660,7 @@ function _M.taskActiveRpc(agent, data)
659 return 660 return
660 end 661 end
661 662
662 - local reward = role:award(taskData.reward) 663 + local reward = role:award(taskData.reward, {log = {desc = "taskActive", int1 = taskType, int2 = taskId}})
663 role:changeUpdates({ 664 role:changeUpdates({
664 { type = roleField[taskType], field = {"at", taskId}, value = -1 } 665 { type = roleField[taskType], field = {"at", taskId}, value = -1 }
665 }) 666 })
@@ -690,7 +691,7 @@ function _M.achiveRpc(agent, data) @@ -690,7 +691,7 @@ function _M.achiveRpc(agent, data)
690 return 3 691 return 3
691 end 692 end
692 693
693 - local reward = role:award(achiveTask.reward) 694 + local reward = role:award(achiveTask.reward, {log = {desc = "finishAchive", int1 = taskId}})
694 role:changeUpdates({ 695 role:changeUpdates({
695 { type = "achiveV", field = taskId, value = skynet.timex() } 696 { type = "achiveV", field = taskId, value = skynet.timex() }
696 }) 697 })
@@ -869,6 +870,8 @@ function _M.changeSettingRpc(agent, data) @@ -869,6 +870,8 @@ function _M.changeSettingRpc(agent, data)
869 setting[id] = status 870 setting[id] = status
870 role:updateProperty({field = "setting", value = setting}) 871 role:updateProperty({field = "setting", value = setting})
871 872
  873 + role:log("role_action", {desc = "changeSetting", int1 = id, int2 = status})
  874 +
872 SendPacket(actionCodes.Role_changeSettingRpc, '') 875 SendPacket(actionCodes.Role_changeSettingRpc, '')
873 return true 876 return true
874 end 877 end
@@ -897,7 +900,7 @@ function _M.drawCodeRpc(agent, data) @@ -897,7 +900,7 @@ function _M.drawCodeRpc(agent, data)
897 if ret == 0 then 900 if ret == 0 then
898 local giftId = tonumber(result.giftId) 901 local giftId = tonumber(result.giftId)
899 role:setProperty("codeStr", codestr:setv(giftId, 1)) 902 role:setProperty("codeStr", codestr:setv(giftId, 1))
900 - local reward = role:award(result.gift) 903 + local reward = role:award(result.gift, {desc = "drawCode", key1 = code, int1 = giftId})
901 904
902 SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({ 905 SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({
903 result = ret, 906 result = ret,
@@ -941,6 +944,8 @@ function _M.changeHeadRpc(agent, data) @@ -941,6 +944,8 @@ function _M.changeHeadRpc(agent, data)
941 end 944 end
942 role:updateProperty({field = "headId" ,value = id}) 945 role:updateProperty({field = "headId" ,value = id})
943 role:changeCrossServerPvpSelfInfo("headId") 946 role:changeCrossServerPvpSelfInfo("headId")
  947 + role:log("role_action", {desc = "changeHead", int1 = id})
  948 +
944 SendPacket(actionCodes.Role_changeHeadRpc, "") 949 SendPacket(actionCodes.Role_changeHeadRpc, "")
945 return true 950 return true
946 end 951 end
@@ -960,6 +965,7 @@ function _M.guideRpc(agent, data) @@ -960,6 +965,7 @@ function _M.guideRpc(agent, data)
960 if master < 0 or slave < 0 then return end 965 if master < 0 or slave < 0 then return end
961 newerGuide = string.format("%d=%d",master,slave) 966 newerGuide = string.format("%d=%d",master,slave)
962 role:updateProperty({field = "newerGuide", value = newerGuide}) 967 role:updateProperty({field = "newerGuide", value = newerGuide})
  968 + role:log("guide", {int1 = master*1000+slave})
963 elseif cmdType == 2 then 969 elseif cmdType == 2 then
964 -- 系统引导 970 -- 系统引导
965 if not msg.skip then return end 971 if not msg.skip then return end
@@ -972,6 +978,7 @@ function _M.guideRpc(agent, data) @@ -972,6 +978,7 @@ function _M.guideRpc(agent, data)
972 978
973 if msg.funcType then 979 if msg.funcType then
974 funcGuide = funcGuide:setv(msg.funcType, 1) 980 funcGuide = funcGuide:setv(msg.funcType, 1)
  981 + role:log("guide_sys", {int1 = msg.funcType})
975 end 982 end
976 role:updateProperty({field = "funcGuide", value = funcGuide}) 983 role:updateProperty({field = "funcGuide", value = funcGuide})
977 elseif cmdType == 3 then 984 elseif cmdType == 3 then
@@ -979,6 +986,7 @@ function _M.guideRpc(agent, data) @@ -979,6 +986,7 @@ function _M.guideRpc(agent, data)
979 if msg.funcType then 986 if msg.funcType then
980 local value = msg.value or 1 987 local value = msg.value or 1
981 for _, funcIdx in pairs(msg.funcType:toArray(true,"=")) do 988 for _, funcIdx in pairs(msg.funcType:toArray(true,"=")) do
  989 + role:log("guide_weak", {int1 = funcIdx})
982 funcGuide = funcGuide:setv(funcIdx, value) 990 funcGuide = funcGuide:setv(funcIdx, value)
983 end 991 end
984 role:updateProperty({field = "funcGuide", value = funcGuide}) 992 role:updateProperty({field = "funcGuide", value = funcGuide})
@@ -39,6 +39,7 @@ local function handle_timeout() @@ -39,6 +39,7 @@ local function handle_timeout()
39 end 39 end
40 40
41 function start_agent_timer() 41 function start_agent_timer()
  42 + if agentInfo.open_timer then return end
42 agentInfo.open_timer = true 43 agentInfo.open_timer = true
43 skynet.timeout(150, handle_timeout) 44 skynet.timeout(150, handle_timeout)
44 end 45 end
@@ -186,7 +187,18 @@ skynet.register_protocol { @@ -186,7 +187,18 @@ skynet.register_protocol {
186 end 187 end
187 188
188 if #data > 0 then data = xxtea.decrypt(data, XXTEA_KEY) end 189 if #data > 0 then data = xxtea.decrypt(data, XXTEA_KEY) end
  190 +
  191 + -- 一次操作是一个关联操作 记录 ucode 是一样的
  192 + if agentInfo.role then
  193 + agentInfo.role:startActionUcode()
  194 + end
  195 +
189 local result = method(agentInfo, data) 196 local result = method(agentInfo, data)
  197 +
  198 + if agentInfo.role then
  199 + agentInfo.role:endActionUcode()
  200 + end
  201 +
190 if not result or type(result) == "number" then 202 if not result or type(result) == "number" then
191 SendPacket(actionCodes.Sys_innerErrorMsg, MsgPack.pack({id = cmd * 100 + (result or 0)})) 203 SendPacket(actionCodes.Sys_innerErrorMsg, MsgPack.pack({id = cmd * 100 + (result or 0)}))
192 end 204 end
src/models/RoleLog.lua
@@ -5,6 +5,20 @@ local LogType = { @@ -5,6 +5,20 @@ local LogType = {
5 login = "common", 5 login = "common",
6 logout = "common", 6 logout = "common",
7 gm = "common", 7 gm = "common",
  8 + mail_actions = "common",
  9 + in_item = "common",
  10 + out_item = "common",
  11 + in_diamond = "common",
  12 + out_diamond = "common",
  13 + in_hero = "common",
  14 + out_hero = "common",
  15 + in_equip = "common",
  16 + out_equip = "common",
  17 + in_rune = "common",
  18 + out_rune = "common",
  19 + player_exp = "common",
  20 + func_open = "common",
  21 + role_action = "common",
8 } 22 }
9 23
10 -- 如要修改 要提前修改 _template mapping -- 对应 mapping 为 gamelog-* 24 -- 如要修改 要提前修改 _template mapping -- 对应 mapping 为 gamelog-*
@@ -23,6 +37,11 @@ local Mapping = { @@ -23,6 +37,11 @@ local Mapping = {
23 int2 = "integer", 37 int2 = "integer",
24 long1 = "long", 38 long1 = "long",
25 float1 = "float", 39 float1 = "float",
  40 +
  41 + -- 底层使用的 一些参数
  42 + cint1 = "integer",
  43 + cint2 = "integer",
  44 + cint3 = "integer",
26 } 45 }
27 } 46 }
28 47
@@ -156,6 +175,9 @@ function RoleLog.bind(Role) @@ -156,6 +175,9 @@ function RoleLog.bind(Role)
156 end 175 end
157 176
158 local mapping = Mapping[_logType] 177 local mapping = Mapping[_logType]
  178 + if mapping["ucode"] and not contents["ucode"] then
  179 + contents["ucode"] = self:getActionUcode()
  180 + end
159 181
160 for field, value in pairs(contents) do 182 for field, value in pairs(contents) do
161 local ftype = mapping[field] 183 local ftype = mapping[field]
@@ -168,5 +190,24 @@ function RoleLog.bind(Role) @@ -168,5 +190,24 @@ function RoleLog.bind(Role)
168 if not logd then return end 190 if not logd then return end
169 pcall(skynet.send, logd, "lua", "log", logType, doc, _logType) 191 pcall(skynet.send, logd, "lua", "log", logType, doc, _logType)
170 end 192 end
  193 +
  194 + function Role:startActionUcode()
  195 + if not self._uniqueCount then
  196 + self._uniqueCount = 0
  197 + end
  198 + local action = {self:getProperty("id"), skynet.timex(), self._uniqueCount}
  199 + self._uniqueCount = self._uniqueCount + 1
  200 +
  201 + self._actionUcode = table.concat(action, "_")
  202 + end
  203 +
  204 + function Role:endActionUcode()
  205 + self._actionUcode = nil
  206 + end
  207 +
  208 + function Role:getActionUcode()
  209 + return self._actionUcode
  210 + end
  211 +
171 end 212 end
172 return RoleLog 213 return RoleLog
173 \ No newline at end of file 214 \ No newline at end of file
src/models/RolePlugin.lua
@@ -59,7 +59,7 @@ function RolePlugin.bind(Role) @@ -59,7 +59,7 @@ function RolePlugin.bind(Role)
59 59
60 local itemIdAward = { 60 local itemIdAward = {
61 [ItemId.PlayerExp] = function() 61 [ItemId.PlayerExp] = function()
62 - self:addPlayExp(count) 62 + self:addPlayExp(count, pms)
63 end, 63 end,
64 } 64 }
65 65
@@ -80,14 +80,14 @@ function RolePlugin.bind(Role) @@ -80,14 +80,14 @@ function RolePlugin.bind(Role)
80 [ItemType.Rune] = function() 80 [ItemType.Rune] = function()
81 local typ = math.floor((itemId-10000)/1000) 81 local typ = math.floor((itemId-10000)/1000)
82 for _= 1, count do 82 for _= 1, count do
83 - self:addRune({type = typ,id = itemId, pms.notNotify}) 83 + self:addRune({type = typ,id = itemId, notNotify = pms.notNotify, log = pms.log})
84 end 84 end
85 end, 85 end,
86 [ItemType.AdvItem] = function() --冒险道具不会进入 玩家仓库 86 [ItemType.AdvItem] = function() --冒险道具不会进入 玩家仓库
87 count = 0 87 count = 0
88 end, 88 end,
89 [ItemType.FuncOpen] = function() 89 [ItemType.FuncOpen] = function()
90 - self:funcOpen(itemId, count) 90 + self:funcOpen(itemId, count, pms)
91 end, 91 end,
92 } 92 }
93 -- 对数量筛查 93 -- 对数量筛查
@@ -139,7 +139,7 @@ function RolePlugin.bind(Role) @@ -139,7 +139,7 @@ function RolePlugin.bind(Role)
139 return reward, allChange --实际获得的奖励 和 最高级奖励转化过程 139 return reward, allChange --实际获得的奖励 和 最高级奖励转化过程
140 end 140 end
141 141
142 - function Role:addPlayExp(addExp) 142 + function Role:addPlayExp(addExp, params)
143 local level = self:getProperty("level") 143 local level = self:getProperty("level")
144 if not csvdb["player_expCsv"][level + 1] then 144 if not csvdb["player_expCsv"][level + 1] then
145 return 145 return
@@ -155,6 +155,22 @@ function RolePlugin.bind(Role) @@ -155,6 +155,22 @@ function RolePlugin.bind(Role)
155 newExp = csvdb["player_expCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除 155 newExp = csvdb["player_expCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除
156 end 156 end
157 end 157 end
  158 +
  159 + if params.log then
  160 + local log = clone(params.log)
  161 + if log["cint1"] or log["cint2"] then
  162 + print("addPlayExp error log have cint1 or cint2 or cint3", debug.traceback())
  163 + end
  164 +
  165 + log["cint1"] = addExp
  166 + log["cint2"] = newExp
  167 + log["cint3"] = level
  168 +
  169 + self:log("player_exp", log)
  170 + else
  171 + print("addPlayExp no log ", debug.traceback())
  172 + end
  173 +
158 self:updateProperties({level = level, exp = newExp}) 174 self:updateProperties({level = level, exp = newExp})
159 self:changeCrossServerPvpSelfInfo("level") 175 self:changeCrossServerPvpSelfInfo("level")
160 end 176 end
@@ -174,6 +190,23 @@ function RolePlugin.bind(Role) @@ -174,6 +190,23 @@ function RolePlugin.bind(Role)
174 else 190 else
175 items = items:incrv(params.itemId, params.count) 191 items = items:incrv(params.itemId, params.count)
176 end 192 end
  193 +
  194 + if params.log then
  195 + local log = clone(params.log)
  196 + if log["cint1"] or log["cint2"] then
  197 + print("addItem error log have cint1 or cint2 ", debug.traceback())
  198 + end
  199 + log["cint1"] = params.itemId
  200 + log["cint2"] = math.abs(params.count)
  201 + if params.count <= 0 then
  202 + self:log("out_item", log)
  203 + else
  204 + self:log("in_item", log)
  205 + end
  206 + else
  207 + print("addItem no log ", debug.traceback())
  208 + end
  209 +
177 self:setProperty("items", items) 210 self:setProperty("items", items)
178 if not params.notNotify then 211 if not params.notNotify then
179 SendPacket(actionCodes.Role_updateItems, MsgPack.pack({[params.itemId] = nums})) 212 SendPacket(actionCodes.Role_updateItems, MsgPack.pack({[params.itemId] = nums}))
@@ -241,6 +274,19 @@ function RolePlugin.bind(Role) @@ -241,6 +274,19 @@ function RolePlugin.bind(Role)
241 else 274 else
242 self:incrProperty("diamond", count) 275 self:incrProperty("diamond", count)
243 end 276 end
  277 +
  278 + if params.log then
  279 + local log = clone(params.log)
  280 + if log["cint1"] or log["cint2"] or log["cint3"] then
  281 + print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback())
  282 + end
  283 + log["cint1"] = origin
  284 + log["cint2"] = count
  285 + self:log("in_diamond", log)
  286 + else
  287 + print("gainDiamond no log ", debug.traceback())
  288 + end
  289 +
244 self:notifyUpdateProperty("diamond", self:getAllDiamond()) 290 self:notifyUpdateProperty("diamond", self:getAllDiamond())
245 return true 291 return true
246 end 292 end
@@ -277,6 +323,18 @@ function RolePlugin.bind(Role) @@ -277,6 +323,18 @@ function RolePlugin.bind(Role)
277 self:incrProperty(costFirst[2], -last) 323 self:incrProperty(costFirst[2], -last)
278 end 324 end
279 325
  326 + if params.log then
  327 + local log = clone(params.log)
  328 + if log["cint1"] or log["cint2"] or log["cint3"] then
  329 + print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback())
  330 + end
  331 + log["cint1"] = origin
  332 + log["cint2"] = count
  333 + self:log("out_diamond", log)
  334 + else
  335 + print("costDiamond no log ", debug.traceback())
  336 + end
  337 +
280 self:notifyUpdateProperty("diamond", self:getAllDiamond()) 338 self:notifyUpdateProperty("diamond", self:getAllDiamond())
281 return true 339 return true
282 end 340 end
@@ -311,6 +369,17 @@ function RolePlugin.bind(Role) @@ -311,6 +369,17 @@ function RolePlugin.bind(Role)
311 local bin = MsgPack.pack(heroResponse) 369 local bin = MsgPack.pack(heroResponse)
312 SendPacket(actionCodes.Hero_loadInfos, bin) 370 SendPacket(actionCodes.Hero_loadInfos, bin)
313 end 371 end
  372 + if params.log then
  373 + local log = clone(params.log)
  374 + if log["cint1"] or log["cint2"] or log["cint3"] then
  375 + print("addHero error log have cint1 or cint2 or cint3 ", debug.traceback())
  376 + end
  377 + log["cint1"] = heroId
  378 + log["cint2"] = heroType
  379 + self:log("in_hero", log)
  380 + else
  381 + print("addHero no log ", debug.traceback())
  382 + end
314 return true, newHero 383 return true, newHero
315 end 384 end
316 385
@@ -323,9 +392,11 @@ function RolePlugin.bind(Role) @@ -323,9 +392,11 @@ function RolePlugin.bind(Role)
323 end 392 end
324 end 393 end
325 394
326 - function Role:delHero(heroId) 395 + function Role:delHero(heroId, params)
  396 + params = params or {}
327 local roleId = self:getProperty('id') 397 local roleId = self:getProperty('id')
328 local hero = self.heros[heroId] 398 local hero = self.heros[heroId]
  399 + local heroType = hero:getProperty("type")
329 if not hero then return end 400 if not hero then return end
330 401
331 self.heros[heroId] = nil 402 self.heros[heroId] = nil
@@ -333,6 +404,19 @@ function RolePlugin.bind(Role) @@ -333,6 +404,19 @@ function RolePlugin.bind(Role)
333 red:del(string.format(R_HERO, roleId, heroId)) 404 red:del(string.format(R_HERO, roleId, heroId))
334 red:srem(string.format(R_HEROS, roleId), heroId) 405 red:srem(string.format(R_HEROS, roleId), heroId)
335 end) 406 end)
  407 +
  408 + if params.log then
  409 + local log = clone(params.log)
  410 + if log["cint1"] or log["cint2"] or log["cint3"] then
  411 + print("delHero error log have cint1 or cint2 or cint3 ", debug.traceback())
  412 + end
  413 + log["cint1"] = heroId
  414 + log["cint2"] = heroType
  415 + self:log("out_hero", log)
  416 + else
  417 + print("delHero no log ", debug.traceback())
  418 + end
  419 +
336 SendPacket(actionCodes.Hero_loadInfos, MsgPack.pack({{id = heroId, bDel = true}})) 420 SendPacket(actionCodes.Hero_loadInfos, MsgPack.pack({{id = heroId, bDel = true}}))
337 end 421 end
338 422
@@ -406,6 +490,24 @@ function RolePlugin.bind(Role) @@ -406,6 +490,24 @@ function RolePlugin.bind(Role)
406 end 490 end
407 491
408 self:setProperty("equips", equips) 492 self:setProperty("equips", equips)
  493 +
  494 + if pms.log then
  495 + local log = clone(pms.log)
  496 + if log["cint1"] or log["cint2"] or log["cint3"] then
  497 + print("addEquip error log have cint1 or cint2 or cint3 ", debug.traceback())
  498 + end
  499 + log["cint1"] = equipType
  500 + log["cint2"] = equipLv
  501 + log["cint3"] = math.abs(count)
  502 + if count < 0 then
  503 + self:log("out_equip", log)
  504 + else
  505 + self:log("in_equip", log)
  506 + end
  507 + else
  508 + print("addEquip no log ", debug.traceback())
  509 + end
  510 +
409 if not pms.notNotify then 511 if not pms.notNotify then
410 self:changeUpdates({{type = "equips", field = {equipType, equipLv}, value = curCount, isOnlyToC = true}}) -- 通知客户端 512 self:changeUpdates({{type = "equips", field = {equipType, equipLv}, value = curCount, isOnlyToC = true}}) -- 通知客户端
411 end 513 end
@@ -463,18 +565,51 @@ function RolePlugin.bind(Role) @@ -463,18 +565,51 @@ function RolePlugin.bind(Role)
463 SendPacket(actionCodes.Role_loadRunes, MsgPack.pack(response)) 565 SendPacket(actionCodes.Role_loadRunes, MsgPack.pack(response))
464 end 566 end
465 self:checkTaskEnter("AddRune", {id = params.id, type = params.type, rarity = data.rarity}, params.notNotify) 567 self:checkTaskEnter("AddRune", {id = params.id, type = params.type, rarity = data.rarity}, params.notNotify)
  568 +
  569 + if params.log then
  570 + local log = clone(params.log)
  571 + if log["cint1"] or log["cint2"] or log["cint3"] then
  572 + print("addRune error log have cint1 or cint2 or cint3 ", debug.traceback())
  573 + end
  574 +
  575 + log["cint1"] = runeUid
  576 + log["cint2"] = params.type
  577 + log["cint3"] = params.id
  578 +
  579 + self:log("in_rune", log)
  580 + else
  581 + print("addRune no log ", debug.traceback())
  582 + end
  583 +
466 return 0, newRune 584 return 0, newRune
467 else 585 else
468 return 1 586 return 1
469 end 587 end
470 end 588 end
471 589
472 - function Role:delRunes(runeIds) -- 批量删除 {id, } 590 + function Role:delRunes(runeIds, params) -- 批量删除 {id, }
  591 + params = params or {}
473 local roleId = self:getProperty('id') 592 local roleId = self:getProperty('id')
474 local bDel = {} 593 local bDel = {}
475 for _, runeId in pairs(runeIds) do 594 for _, runeId in pairs(runeIds) do
476 local rune = self.runeBag[runeId] 595 local rune = self.runeBag[runeId]
477 if rune and rune:getProperty("refer") == 0 then 596 if rune and rune:getProperty("refer") == 0 then
  597 +
  598 + if params.log then
  599 + local log = clone(params.log)
  600 + if log["cint1"] or log["cint2"] or log["cint3"] then
  601 + print("delRunes error log have cint1 or cint2 or cint3 ", debug.traceback())
  602 + end
  603 +
  604 + log["cint1"] = runeId
  605 + log["cint2"] = rune:getProperty("type")
  606 + log["cint3"] = rune:getProperty("id")
  607 +
  608 + self:log("out_rune", log)
  609 + else
  610 + print("delRunes no log ", debug.traceback())
  611 + end
  612 +
478 self.runeBag[runeId] = nil 613 self.runeBag[runeId] = nil
479 table.insert(bDel, runeId) 614 table.insert(bDel, runeId)
480 end 615 end
@@ -528,9 +663,8 @@ function RolePlugin.bind(Role) @@ -528,9 +663,8 @@ function RolePlugin.bind(Role)
528 heartWarning = heartWarning + 1 663 heartWarning = heartWarning + 1
529 self:setProperty("heartWarning", heartWarning) 664 self:setProperty("heartWarning", heartWarning)
530 if heartWarning == 50 then 665 if heartWarning == 50 then
531 - self:setProperty("delete", 1) 666 + self:setBan(30, 1) --封禁 30天
532 self:sendGmMsg("server_accountBanned_inGame_1") 667 self:sendGmMsg("server_accountBanned_inGame_1")
533 - self:log("gm",{desc = "ban"})  
534 return 668 return
535 end 669 end
536 if heartWarning < 50 and heartWarning % 5 == 0 then 670 if heartWarning < 50 and heartWarning % 5 == 0 then
@@ -687,8 +821,25 @@ function RolePlugin.bind(Role) @@ -687,8 +821,25 @@ function RolePlugin.bind(Role)
687 return true 821 return true
688 end 822 end
689 823
690 - function Role:funcOpen(func, count) 824 + function Role:funcOpen(func, count, params)
  825 + params = params or {}
  826 +
691 count = count or 1 827 count = count or 1
  828 +
  829 + if params.log then
  830 + local log = clone(params.log)
  831 + if log["cint1"] or log["cint2"] or log["cint3"] then
  832 + print("funcOpen error log have cint1 or cint2 or cint3 ", debug.traceback())
  833 + end
  834 +
  835 + log["cint1"] = func
  836 + log["cint2"] = count
  837 +
  838 + self:log("func_open", log)
  839 + else
  840 + print("funcOpen no log ", debug.traceback())
  841 + end
  842 +
692 if csvdb["itemCsv"][func] and csvdb["itemCsv"][func].type == ItemType.FuncOpen then 843 if csvdb["itemCsv"][func] and csvdb["itemCsv"][func].type == ItemType.FuncOpen then
693 local unlockData = csvdb["unlockCsv"][func] 844 local unlockData = csvdb["unlockCsv"][func]
694 if unlockData.type == 4 then -- 解锁神器 845 if unlockData.type == 4 then -- 解锁神器