Commit 44c6e479c231bc9e8484f3cd5b623ecaa7f83624
1 parent
13e7d6bb
增加部分日志
Showing
6 changed files
with
245 additions
and
33 deletions
 
Show diff stats
No preview for this file type
src/actions/EmailAction.lua
| ... | ... | @@ -53,7 +53,7 @@ function _M.listRpc(agent, data) | 
| 53 | 53 | content = email.content, | 
| 54 | 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 | 57 | end | 
| 58 | 58 | end | 
| 59 | 59 | end | 
| ... | ... | @@ -98,7 +98,7 @@ function _M.drawAllAttachRpc(agent, data) | 
| 98 | 98 | local items = role:award(attachments) | 
| 99 | 99 | ids[emailId] = 1 | 
| 100 | 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 | 103 | for key, v in pairs(items) do | 
| 104 | 104 | reward[key] = (reward[key] or 0) + v | 
| ... | ... | @@ -129,7 +129,7 @@ function _M.drawAttachRpc(agent, data) | 
| 129 | 129 | redisproxy:hset(rds, "status", 2) -- 领取标记 | 
| 130 | 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 | 133 | return true | 
| 134 | 134 | end | 
| 135 | 135 | |
| ... | ... | @@ -144,7 +144,7 @@ function _M.checkRpc(agent, data) | 
| 144 | 144 | if not redisproxy:exists(rds) then return end | 
| 145 | 145 | |
| 146 | 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 | 149 | SendPacket(actionCodes.Email_checkRpc, '') | 
| 150 | 150 | return true | 
| ... | ... | @@ -179,9 +179,9 @@ function _M.delRpc(agent, data) | 
| 179 | 179 | end | 
| 180 | 180 | end | 
| 181 | 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 | 185 | SendPacket(actionCodes.Email_delRpc, MsgPack.pack({result = result})) | 
| 186 | 186 | return true | 
| 187 | 187 | end | ... | ... | 
src/actions/RoleAction.lua
| ... | ... | @@ -94,6 +94,8 @@ function _M.loginRpc( agent, data ) | 
| 94 | 94 | role = require("models.Role").new({key = roleKey}) | 
| 95 | 95 | role:load() | 
| 96 | 96 | role:loadAll() | 
| 97 | + role:startActionUcode() | |
| 98 | + role:setProperty("ltime", now) | |
| 97 | 99 | else | 
| 98 | 100 | role:reloadWhenLogin() | 
| 99 | 101 | end | 
| ... | ... | @@ -120,7 +122,6 @@ function _M.loginRpc( agent, data ) | 
| 120 | 122 | |
| 121 | 123 | -- 跨天登陆事件 | 
| 122 | 124 | role:updateTimeReset(now) | 
| 123 | - role:setProperty("ltime", now) | |
| 124 | 125 | redisproxy:zadd(FRIEND_RECOMMEND, now, roleId) | 
| 125 | 126 | |
| 126 | 127 | for _, name in ipairs({"dailyData", "dinerData"}) do | 
| ... | ... | @@ -291,7 +292,7 @@ function _M.createRpc(agent, data) | 
| 291 | 292 | SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response)) | 
| 292 | 293 | return true | 
| 293 | 294 | end | 
| 294 | - | |
| 295 | + newRole:startActionUcode() | |
| 295 | 296 | newRole:award(globalCsv.birthItem) | 
| 296 | 297 | -- 欢迎邮件 | 
| 297 | 298 | redisproxy:insertEmail({roleId = roleId, emailId = 1}) | 
| ... | ... | @@ -394,8 +395,8 @@ function _M.saleItemRpc(agent, data) | 
| 394 | 395 | reward[sellEffect[1]] = (reward[sellEffect[1]] or 0) + sellEffect[2] * count | 
| 395 | 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 | 400 | role:checkTaskEnter("DecoFrag", {count = fragCount}) | 
| 400 | 401 | SendPacket(actionCodes.Role_saleItemRpc, MsgPack.pack({reward = reward})) | 
| 401 | 402 | return true | 
| ... | ... | @@ -433,8 +434,8 @@ function _M.openItemRpc(agent, data) | 
| 433 | 434 | end | 
| 434 | 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 | 440 | SendPacket(actionCodes.Role_openItemRpc, MsgPack.pack({reward = reward})) | 
| 440 | 441 | return true | 
| ... | ... | @@ -457,7 +458,7 @@ function _M.openTimeBoxRpc(agent, data) | 
| 457 | 458 | if not itemData or not randomData or randomData.openTime <= 0 then return end | 
| 458 | 459 | |
| 459 | 460 | if boxL[slot] then return end | 
| 460 | - role:costItems({[itemId] = 1}) | |
| 461 | + role:costItems({[itemId] = 1}, {log = {desc = "openTimeBox"}}) | |
| 461 | 462 | boxL[slot] = {id = itemId, time = skynet.timex() + randomData.openTime} | 
| 462 | 463 | |
| 463 | 464 | elseif oper == 2 then -- 领取 | 
| ... | ... | @@ -468,7 +469,7 @@ function _M.openTimeBoxRpc(agent, data) | 
| 468 | 469 | local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") | 
| 469 | 470 | local costD = math.ceil((boxL[slot].time - skynet.timex()) / (cost_pre[1] * 60)) * cost_pre[2] | 
| 470 | 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 | 473 | end | 
| 473 | 474 | local boxId = boxL[slot].id | 
| 474 | 475 | local itemData = csvdb["itemCsv"][boxId] | 
| ... | ... | @@ -496,7 +497,7 @@ function _M.openTimeBoxRpc(agent, data) | 
| 496 | 497 | reward[0] = nil | 
| 497 | 498 | |
| 498 | 499 | boxL[slot] = nil | 
| 499 | - reward = role:award(reward) | |
| 500 | + reward = role:award(reward, {log = {desc = "openTimeBox", int1 = boxId}}) | |
| 500 | 501 | role:checkTaskEnter("OpenBox", {id = boxId}) | 
| 501 | 502 | else | 
| 502 | 503 | return | 
| ... | ... | @@ -554,8 +555,8 @@ function _M.openSpeedUpBoxRpc(agent, data) | 
| 554 | 555 | return | 
| 555 | 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 | 561 | SendPacket(actionCodes.Role_openSpeedUpBoxRpc, MsgPack.pack({reward = reward})) | 
| 561 | 562 | return true | 
| ... | ... | @@ -574,7 +575,7 @@ function _M.storyBookRewardRpc(agent, data) | 
| 574 | 575 | -- 获取奖励 | 
| 575 | 576 | storyStatus[storyId].s = -1 | 
| 576 | 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 | 579 | SendPacket(actionCodes.Role_storyBookRewardRpc, MsgPack.pack({reward = reward})) | 
| 579 | 580 | return true | 
| 580 | 581 | end | 
| ... | ... | @@ -594,7 +595,7 @@ function _M.unLockStoryBookRpc(agent, data) | 
| 594 | 595 | if not cost or not next(cost) then return end | 
| 595 | 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 | 601 | storyStatus[storyId] = storyStatus[storyId] or {} | 
| ... | ... | @@ -626,7 +627,7 @@ function _M.taskRpc(agent, data) | 
| 626 | 627 | return 3 | 
| 627 | 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 | 631 | local active = (taskStatus["a"] or 0) + taskData.active | 
| 631 | 632 | |
| 632 | 633 | role:changeUpdates({ | 
| ... | ... | @@ -659,7 +660,7 @@ function _M.taskActiveRpc(agent, data) | 
| 659 | 660 | return | 
| 660 | 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 | 664 | role:changeUpdates({ | 
| 664 | 665 | { type = roleField[taskType], field = {"at", taskId}, value = -1 } | 
| 665 | 666 | }) | 
| ... | ... | @@ -690,7 +691,7 @@ function _M.achiveRpc(agent, data) | 
| 690 | 691 | return 3 | 
| 691 | 692 | end | 
| 692 | 693 | |
| 693 | - local reward = role:award(achiveTask.reward) | |
| 694 | + local reward = role:award(achiveTask.reward, {log = {desc = "finishAchive", int1 = taskId}}) | |
| 694 | 695 | role:changeUpdates({ | 
| 695 | 696 | { type = "achiveV", field = taskId, value = skynet.timex() } | 
| 696 | 697 | }) | 
| ... | ... | @@ -869,6 +870,8 @@ function _M.changeSettingRpc(agent, data) | 
| 869 | 870 | setting[id] = status | 
| 870 | 871 | role:updateProperty({field = "setting", value = setting}) | 
| 871 | 872 | |
| 873 | + role:log("role_action", {desc = "changeSetting", int1 = id, int2 = status}) | |
| 874 | + | |
| 872 | 875 | SendPacket(actionCodes.Role_changeSettingRpc, '') | 
| 873 | 876 | return true | 
| 874 | 877 | end | 
| ... | ... | @@ -897,7 +900,7 @@ function _M.drawCodeRpc(agent, data) | 
| 897 | 900 | if ret == 0 then | 
| 898 | 901 | local giftId = tonumber(result.giftId) | 
| 899 | 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 | 905 | SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({ | 
| 903 | 906 | result = ret, | 
| ... | ... | @@ -941,6 +944,8 @@ function _M.changeHeadRpc(agent, data) | 
| 941 | 944 | end | 
| 942 | 945 | role:updateProperty({field = "headId" ,value = id}) | 
| 943 | 946 | role:changeCrossServerPvpSelfInfo("headId") | 
| 947 | + role:log("role_action", {desc = "changeHead", int1 = id}) | |
| 948 | + | |
| 944 | 949 | SendPacket(actionCodes.Role_changeHeadRpc, "") | 
| 945 | 950 | return true | 
| 946 | 951 | end | 
| ... | ... | @@ -960,6 +965,7 @@ function _M.guideRpc(agent, data) | 
| 960 | 965 | if master < 0 or slave < 0 then return end | 
| 961 | 966 | newerGuide = string.format("%d=%d",master,slave) | 
| 962 | 967 | role:updateProperty({field = "newerGuide", value = newerGuide}) | 
| 968 | + role:log("guide", {int1 = master*1000+slave}) | |
| 963 | 969 | elseif cmdType == 2 then | 
| 964 | 970 | -- 系统引导 | 
| 965 | 971 | if not msg.skip then return end | 
| ... | ... | @@ -972,6 +978,7 @@ function _M.guideRpc(agent, data) | 
| 972 | 978 | |
| 973 | 979 | if msg.funcType then | 
| 974 | 980 | funcGuide = funcGuide:setv(msg.funcType, 1) | 
| 981 | + role:log("guide_sys", {int1 = msg.funcType}) | |
| 975 | 982 | end | 
| 976 | 983 | role:updateProperty({field = "funcGuide", value = funcGuide}) | 
| 977 | 984 | elseif cmdType == 3 then | 
| ... | ... | @@ -979,6 +986,7 @@ function _M.guideRpc(agent, data) | 
| 979 | 986 | if msg.funcType then | 
| 980 | 987 | local value = msg.value or 1 | 
| 981 | 988 | for _, funcIdx in pairs(msg.funcType:toArray(true,"=")) do | 
| 989 | + role:log("guide_weak", {int1 = funcIdx}) | |
| 982 | 990 | funcGuide = funcGuide:setv(funcIdx, value) | 
| 983 | 991 | end | 
| 984 | 992 | role:updateProperty({field = "funcGuide", value = funcGuide}) | ... | ... | 
src/agent.lua
| ... | ... | @@ -39,6 +39,7 @@ local function handle_timeout() | 
| 39 | 39 | end | 
| 40 | 40 | |
| 41 | 41 | function start_agent_timer() | 
| 42 | + if agentInfo.open_timer then return end | |
| 42 | 43 | agentInfo.open_timer = true | 
| 43 | 44 | skynet.timeout(150, handle_timeout) | 
| 44 | 45 | end | 
| ... | ... | @@ -186,7 +187,18 @@ skynet.register_protocol { | 
| 186 | 187 | end | 
| 187 | 188 | |
| 188 | 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 | 196 | local result = method(agentInfo, data) | 
| 197 | + | |
| 198 | + if agentInfo.role then | |
| 199 | + agentInfo.role:endActionUcode() | |
| 200 | + end | |
| 201 | + | |
| 190 | 202 | if not result or type(result) == "number" then | 
| 191 | 203 | SendPacket(actionCodes.Sys_innerErrorMsg, MsgPack.pack({id = cmd * 100 + (result or 0)})) | 
| 192 | 204 | end | ... | ... | 
src/models/RoleLog.lua
| ... | ... | @@ -5,6 +5,20 @@ local LogType = { | 
| 5 | 5 | login = "common", | 
| 6 | 6 | logout = "common", | 
| 7 | 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 | 24 | -- 如要修改 要提前修改 _template mapping -- 对应 mapping 为 gamelog-* | 
| ... | ... | @@ -23,6 +37,11 @@ local Mapping = { | 
| 23 | 37 | int2 = "integer", | 
| 24 | 38 | long1 = "long", | 
| 25 | 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 | 175 | end | 
| 157 | 176 | |
| 158 | 177 | local mapping = Mapping[_logType] | 
| 178 | + if mapping["ucode"] and not contents["ucode"] then | |
| 179 | + contents["ucode"] = self:getActionUcode() | |
| 180 | + end | |
| 159 | 181 | |
| 160 | 182 | for field, value in pairs(contents) do | 
| 161 | 183 | local ftype = mapping[field] | 
| ... | ... | @@ -168,5 +190,24 @@ function RoleLog.bind(Role) | 
| 168 | 190 | if not logd then return end | 
| 169 | 191 | pcall(skynet.send, logd, "lua", "log", logType, doc, _logType) | 
| 170 | 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 | 212 | end | 
| 172 | 213 | return RoleLog | 
| 173 | 214 | \ No newline at end of file | ... | ... | 
src/models/RolePlugin.lua
| ... | ... | @@ -59,7 +59,7 @@ function RolePlugin.bind(Role) | 
| 59 | 59 | |
| 60 | 60 | local itemIdAward = { | 
| 61 | 61 | [ItemId.PlayerExp] = function() | 
| 62 | - self:addPlayExp(count) | |
| 62 | + self:addPlayExp(count, pms) | |
| 63 | 63 | end, | 
| 64 | 64 | } | 
| 65 | 65 | |
| ... | ... | @@ -80,14 +80,14 @@ function RolePlugin.bind(Role) | 
| 80 | 80 | [ItemType.Rune] = function() | 
| 81 | 81 | local typ = math.floor((itemId-10000)/1000) | 
| 82 | 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 | 84 | end | 
| 85 | 85 | end, | 
| 86 | 86 | [ItemType.AdvItem] = function() --冒险道具不会进入 玩家仓库 | 
| 87 | 87 | count = 0 | 
| 88 | 88 | end, | 
| 89 | 89 | [ItemType.FuncOpen] = function() | 
| 90 | - self:funcOpen(itemId, count) | |
| 90 | + self:funcOpen(itemId, count, pms) | |
| 91 | 91 | end, | 
| 92 | 92 | } | 
| 93 | 93 | -- 对数量筛查 | 
| ... | ... | @@ -139,7 +139,7 @@ function RolePlugin.bind(Role) | 
| 139 | 139 | return reward, allChange --实际获得的奖励 和 最高级奖励转化过程 | 
| 140 | 140 | end | 
| 141 | 141 | |
| 142 | - function Role:addPlayExp(addExp) | |
| 142 | + function Role:addPlayExp(addExp, params) | |
| 143 | 143 | local level = self:getProperty("level") | 
| 144 | 144 | if not csvdb["player_expCsv"][level + 1] then | 
| 145 | 145 | return | 
| ... | ... | @@ -155,6 +155,22 @@ function RolePlugin.bind(Role) | 
| 155 | 155 | newExp = csvdb["player_expCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除 | 
| 156 | 156 | end | 
| 157 | 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 | 174 | self:updateProperties({level = level, exp = newExp}) | 
| 159 | 175 | self:changeCrossServerPvpSelfInfo("level") | 
| 160 | 176 | end | 
| ... | ... | @@ -174,6 +190,23 @@ function RolePlugin.bind(Role) | 
| 174 | 190 | else | 
| 175 | 191 | items = items:incrv(params.itemId, params.count) | 
| 176 | 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 | 210 | self:setProperty("items", items) | 
| 178 | 211 | if not params.notNotify then | 
| 179 | 212 | SendPacket(actionCodes.Role_updateItems, MsgPack.pack({[params.itemId] = nums})) | 
| ... | ... | @@ -241,6 +274,19 @@ function RolePlugin.bind(Role) | 
| 241 | 274 | else | 
| 242 | 275 | self:incrProperty("diamond", count) | 
| 243 | 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 | 290 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) | 
| 245 | 291 | return true | 
| 246 | 292 | end | 
| ... | ... | @@ -277,6 +323,18 @@ function RolePlugin.bind(Role) | 
| 277 | 323 | self:incrProperty(costFirst[2], -last) | 
| 278 | 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 | 338 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) | 
| 281 | 339 | return true | 
| 282 | 340 | end | 
| ... | ... | @@ -311,6 +369,17 @@ function RolePlugin.bind(Role) | 
| 311 | 369 | local bin = MsgPack.pack(heroResponse) | 
| 312 | 370 | SendPacket(actionCodes.Hero_loadInfos, bin) | 
| 313 | 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 | 383 | return true, newHero | 
| 315 | 384 | end | 
| 316 | 385 | |
| ... | ... | @@ -323,9 +392,11 @@ function RolePlugin.bind(Role) | 
| 323 | 392 | end | 
| 324 | 393 | end | 
| 325 | 394 | |
| 326 | - function Role:delHero(heroId) | |
| 395 | + function Role:delHero(heroId, params) | |
| 396 | + params = params or {} | |
| 327 | 397 | local roleId = self:getProperty('id') | 
| 328 | 398 | local hero = self.heros[heroId] | 
| 399 | + local heroType = hero:getProperty("type") | |
| 329 | 400 | if not hero then return end | 
| 330 | 401 | |
| 331 | 402 | self.heros[heroId] = nil | 
| ... | ... | @@ -333,6 +404,19 @@ function RolePlugin.bind(Role) | 
| 333 | 404 | red:del(string.format(R_HERO, roleId, heroId)) | 
| 334 | 405 | red:srem(string.format(R_HEROS, roleId), heroId) | 
| 335 | 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 | 420 | SendPacket(actionCodes.Hero_loadInfos, MsgPack.pack({{id = heroId, bDel = true}})) | 
| 337 | 421 | end | 
| 338 | 422 | |
| ... | ... | @@ -406,6 +490,24 @@ function RolePlugin.bind(Role) | 
| 406 | 490 | end | 
| 407 | 491 | |
| 408 | 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 | 511 | if not pms.notNotify then | 
| 410 | 512 | self:changeUpdates({{type = "equips", field = {equipType, equipLv}, value = curCount, isOnlyToC = true}}) -- 通知客户端 | 
| 411 | 513 | end | 
| ... | ... | @@ -463,18 +565,51 @@ function RolePlugin.bind(Role) | 
| 463 | 565 | SendPacket(actionCodes.Role_loadRunes, MsgPack.pack(response)) | 
| 464 | 566 | end | 
| 465 | 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 | 584 | return 0, newRune | 
| 467 | 585 | else | 
| 468 | 586 | return 1 | 
| 469 | 587 | end | 
| 470 | 588 | end | 
| 471 | 589 | |
| 472 | - function Role:delRunes(runeIds) -- 批量删除 {id, } | |
| 590 | + function Role:delRunes(runeIds, params) -- 批量删除 {id, } | |
| 591 | + params = params or {} | |
| 473 | 592 | local roleId = self:getProperty('id') | 
| 474 | 593 | local bDel = {} | 
| 475 | 594 | for _, runeId in pairs(runeIds) do | 
| 476 | 595 | local rune = self.runeBag[runeId] | 
| 477 | 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 | 613 | self.runeBag[runeId] = nil | 
| 479 | 614 | table.insert(bDel, runeId) | 
| 480 | 615 | end | 
| ... | ... | @@ -528,9 +663,8 @@ function RolePlugin.bind(Role) | 
| 528 | 663 | heartWarning = heartWarning + 1 | 
| 529 | 664 | self:setProperty("heartWarning", heartWarning) | 
| 530 | 665 | if heartWarning == 50 then | 
| 531 | - self:setProperty("delete", 1) | |
| 666 | + self:setBan(30, 1) --封禁 30天 | |
| 532 | 667 | self:sendGmMsg("server_accountBanned_inGame_1") | 
| 533 | - self:log("gm",{desc = "ban"}) | |
| 534 | 668 | return | 
| 535 | 669 | end | 
| 536 | 670 | if heartWarning < 50 and heartWarning % 5 == 0 then | 
| ... | ... | @@ -687,8 +821,25 @@ function RolePlugin.bind(Role) | 
| 687 | 821 | return true | 
| 688 | 822 | end | 
| 689 | 823 | |
| 690 | - function Role:funcOpen(func, count) | |
| 824 | + function Role:funcOpen(func, count, params) | |
| 825 | + params = params or {} | |
| 826 | + | |
| 691 | 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 | 843 | if csvdb["itemCsv"][func] and csvdb["itemCsv"][func].type == ItemType.FuncOpen then | 
| 693 | 844 | local unlockData = csvdb["unlockCsv"][func] | 
| 694 | 845 | if unlockData.type == 4 then -- 解锁神器 | ... | ... |