diff --git a/src/actions/AdvAction.lua b/src/actions/AdvAction.lua index e513537..4f50f96 100644 --- a/src/actions/AdvAction.lua +++ b/src/actions/AdvAction.lua @@ -163,6 +163,8 @@ function _M.startAdvRpc( agent, data ) role:checkTaskEnter("AdvStart", {id = chapterId}) role:checkTaskEnter("AdvStartSelf", {id = chapterId}) role:getAdvData():popBackEvents() -- 清一下事件 + role:getAdvData():log({desc = "start", int1 = supportIdx}) + SendPacket(actionCodes.Adv_startAdvRpc, '') return true end @@ -215,6 +217,8 @@ function _M.startHangRpc(agent, data) role.dailyData:updateProperty({field = "advC", delta = 1}) role:checkTaskEnter("AdvStart", {id = chapterId}) + role:log("adv_action", {desc = "startHang", int1 = chapterId}) + SendPacket(actionCodes.Adv_startHangRpc, '') return true end @@ -238,10 +242,12 @@ function _M.quickHangRpc(agent, data) local cost = math.ceil((info.time - skynet.timex()) / chapterData.idleTime * chapterData.accelerate) if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return end - role:costItems({[ItemId.Diamond] = cost}) + role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "quickHang", int1 = chapterId}}) info.time = 0 role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) + role:log("adv_action", {desc = "quickHang", int1 = chapterId}) + SendPacket(actionCodes.Adv_quickHangRpc, '') return true end @@ -262,7 +268,7 @@ function _M.endHangRpc(agent, data) local reward, isFull if skynet.timex() >= info.time then - reward = role:award(chapterData.idleReward) + reward = role:award(chapterData.idleReward, {log = {desc = "advHang", int1 = chapterId}}) else if cancel then if role.dailyData:getProperty("advC") <= 0 then @@ -277,6 +283,8 @@ function _M.endHangRpc(agent, data) role:changeUpdates({{type = "advHang", field = chapterId, value = nil}}) + role:log("adv_action", {desc = "endHang", int1 = chapterId, short1 = cancel and 1 or 0}) + SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, isFull = isFull})) return true end @@ -298,7 +306,7 @@ function _M.buyAdvCountRpc(agent , data) if not role:checkItemEnough(cost) then return end - role:costItems(cost) + role:costItems(cost, {log = {desc = "buyAdvCount", short1 = isEl and 1 or 0, int1 = count}}) if isEl then role.dailyData:updateProperty({field = "advElC", delta = -count}) role.dailyData:updateProperty({field = "advElBC", delta = count}) @@ -306,6 +314,7 @@ function _M.buyAdvCountRpc(agent , data) role.dailyData:updateProperty({field = "advC", delta = -count}) role.dailyData:updateProperty({field = "advBC", delta = count}) end + role:log("adv_action", {desc = "buyAdvCount", short1 = isEl and 1 or 0, int1 = count}) SendPacket(actionCodes.Adv_buyAdvCountRpc, '') return true @@ -329,6 +338,9 @@ function _M.finishTaskRpc(agent, data) adv:updateTask() if not status then return end role:checkTaskEnter("AdvOverTask", {id = taskId}) + + adv:log({desc = "finishTask", int1 = taskId}) + SendPacket(actionCodes.Adv_finishTaskRpc, MsgPack.pack({reward = reward})) return true end @@ -342,8 +354,12 @@ function _M.clickBlockRpc(agent, data) local adv = role:getAdvData() if adv:isWaitChooseArtifact() then return end + + adv:log({desc = "clickBlock", int1 = msg.roomId, int2 = msg.blockId}) + local status, errorCode = adv:clickBlock(msg.roomId, msg.blockId, msg) if not status then return errorCode end + SendPacket(actionCodes.Adv_clickBlockRpc, MsgPack.pack({events = adv:popBackEvents()})) return true end @@ -374,6 +390,7 @@ function _M.useItemRpc(agent, data) end adv:checkAchievement(adv.AchievType.UseItem, count, itemId) + adv:log({desc = "useItem", int1 = itemId, int2 = count}) for i = 1, count do adv:doActive(itemData.effect, target) -- target @@ -409,6 +426,8 @@ function _M.usePotionRpc(agent, data) local adv = role:getAdvData() if adv:isWaitChooseArtifact() then return end + adv:log({desc = "usePotion", int1 = potionId}) + local status = adv:doActive(potionData.effect, target) -- target if not status then return end @@ -436,7 +455,7 @@ function _M.chooseArtifactRpc(agent, data) local status = adv:chooseArtifact(msg.idx) if not status then return end adv:saveDB() - + SendPacket(actionCodes.Adv_chooseArtifactRpc, '') return true end @@ -497,6 +516,7 @@ function _M.exitAdvRpc(agent, data) if not isCanContinue(role) then return end local adv = role:getAdvData() + adv:log({desc = "exit"}) local status = adv:exit() -- target {roomId = 1, blockId = 1} 选择的目标 SendPacket(actionCodes.Adv_exitAdvRpc, MsgPack.pack({events = adv:popBackEvents()})) return true @@ -555,8 +575,9 @@ function _M.endBattleRpc(agent, data) if enemy.monsterId ~= monsterId or enemy.roomId ~= roomId or enemy.blockId ~= blockId then return end adv.__battleCache = nil - + adv:log({desc = "endBattle"}) local status = adv:clickBlock(roomId, blockId, {player = player, bySkill = bySkill}) + if not status then return end SendPacket(actionCodes.Adv_endBattleRpc, MsgPack.pack({events = adv:popBackEvents()})) return true @@ -621,7 +642,7 @@ function _M.wheelSurfRpc(agent, data) end if not role:checkItemEnough(costs) then return 5 end - role:costItems(costs) + role:costItems(costs, {log = {desc = "advWheelSurf", int1 = ptype}}) role:addAdvLvExp(costs[ItemId.OldCoin] or 0) local advDrawB = role:getProperty("advDrawB") advDrawB[ptype] = (advDrawB[ptype] or 0) + count @@ -635,8 +656,11 @@ function _M.wheelSurfRpc(agent, data) reward[gift[1]] = (reward[gift[1]] or 0) + gift[2] table.insert(backReward, gift) end - role:award(reward) + role:award(reward, {log = {desc = "advWheelSurf", int1 = ptype}}) + role:checkTaskEnter("AdvDraw", {count = count, ptype = ptype}) + role:log("adv_action", {desc = "advWheelSurf", int1 = ptype, int2 = count}) + SendPacket(actionCodes.Adv_wheelSurfRpc, MsgPack.pack({reward = backReward})) return true end @@ -663,7 +687,8 @@ function _M.repayWheelSurfRpc(agent, data) role:updateProperty({field = "advDrawB", value = advDrawB}) local gift = drawData["pool3"]:randWeight(true) local reward = {[gift[1]] = gift[2]} - reward = role:award(reward) + reward = role:award(reward, {log = {desc = "advRepayWheelSurf", int1 = ptype}}) + role:log("adv_action", {desc = "advRepayWheelSurf", int1 = ptype}) SendPacket(actionCodes.Adv_repayWheelSurfRpc, MsgPack.pack({reward = reward})) return true @@ -686,6 +711,8 @@ function _M.finishAchievRpc(agent, data) end if not status then return end adv:updateAchievement() + role:log("adv_action", {desc = "finishAchiev", short1 = ctype, int1 = chapterId, int2 = taskId}) + SendPacket(actionCodes.Adv_finishAchievRpc, MsgPack.pack({reward = reward})) return true end @@ -737,10 +764,11 @@ function _M.refreshSupportRpc(agent, data) role.dailyData:updateProperty({field = "advSupRe", delta = 1}) else -- 付费 if not role:checkItemEnough({[ItemId.Diamond] = globalCsv.adv_support_refresh_cost}) then return end - role:costItems({[ItemId.Diamond] = globalCsv.adv_support_refresh_cost}) + role:costItems({[ItemId.Diamond] = globalCsv.adv_support_refresh_cost}, {log = {desc = "advReSupport"}}) end role:advRandomSupportEffect() + role:log("adv_action", {desc = "advSupRe", short1 = cr < al and 0 or 1}) SendPacket(actionCodes.Adv_refreshSupportRpc, '') return true diff --git a/src/actions/CarAction.lua b/src/actions/CarAction.lua index 10f32f3..dd4daf8 100644 --- a/src/actions/CarAction.lua +++ b/src/actions/CarAction.lua @@ -35,10 +35,12 @@ function _M.makePotionRpc( agent, data ) return 5 end - role:costItems(cost) + role:costItems(cost, {log = {desc = "makePotion", int1 = potionId, int2 = count}}) potionBag[potionId] = own + count role:updateProperty({field = "potionBag", value = potionBag}) role:checkTaskEnter("PotionMake", {count = count, id = potionId}) + + role:log("role_action", {desc = "makePotion", int1 = potionId, int2 = count}) SendPacket(actionCodes.Car_makePotionRpc, MsgPack.pack({potionBag = potionBag})) return true end @@ -84,10 +86,13 @@ function _M.equipUpRpc( agent, data ) return 4 end - role:costItems(cost) - role:addEquip(typ, lv, -costCount) - role:addEquip(typ, nextLv ,count) + role:costItems(cost, {log = {desc = "equipUp", int1 = id, int2 = count}}) + role:addEquip(typ, lv, -costCount, {log = {desc = "equipUp"}}) + role:addEquip(typ, nextLv ,count, {log = {desc = "equipUp"}}) role:checkTaskEnter("EquipUp", {count = count}) + + role:log("role_action", {desc = "equipUp", int1 = id, int2 = count}) + SendPacket(actionCodes.Car_equipUpRpc, '') return true end @@ -117,9 +122,12 @@ function _M.runeUpRpc( agent, data ) return 7 end - role:costItems(cost) + role:costItems(cost, {log = {desc = "runeUp", int1 = uid, int2 = level}}) ownRune:updateProperty({field = "level",value = level+1}) role:checkTaskEnter("RuneUp") + + ownRune:log({desc = "runeUp", int1 = level + 1}) + SendPacket(actionCodes.Car_runeUpRpc, '') return true end @@ -143,7 +151,7 @@ function _M.saleEquipRpc(agent, data ) local itemData = csvdb["itemCsv"][id] local typ = math.floor((id-7000)/100) local lv = (id-7000)%100 - role:addEquip(typ, lv, -count) -- 删掉装备 + role:addEquip(typ, lv, -count, {log = {desc = "saleEquip"}}) -- 删掉装备 -- 发奖励 local one = itemData.sell_effect:toNumMap() for k ,v in pairs(one) do @@ -151,7 +159,10 @@ function _M.saleEquipRpc(agent, data ) end end role:checkTaskEnter("SaleEquip", {count = allCount}) - reward = role:award(reward) + reward = role:award(reward, {log = {desc = "saleEquip"}}) + + role:log("role_action", {desc = "saleEquip", int1 = allCount}) + SendPacket(actionCodes.Car_saleEquipRpc, MsgPack.pack({reward = reward})) return true end @@ -177,10 +188,10 @@ function _M.saleRuneRpc(agent, data ) end end - role:delRunes(backs) + role:delRunes(backs, {log = {desc = "saleRune"}}) role:checkTaskEnter("DecoRune", {count = count}) - reward = role:award(reward) - + reward = role:award(reward, {log = {desc = "saleRune"}}) + SendPacket(actionCodes.Car_saleRuneRpc, MsgPack.pack({reward = reward})) return true end diff --git a/src/actions/DinerAction.lua b/src/actions/DinerAction.lua index ce59e56..f95418b 100644 --- a/src/actions/DinerAction.lua +++ b/src/actions/DinerAction.lua @@ -54,7 +54,7 @@ function _M.addSellRpc( agent, data ) return 6 end - role:costItems(cost) + role:costItems(cost, {log = {desc = "addSell"}}) role.dinerData:updateSell(slot) role:checkTaskEnter("MakeFood", {id = dish, count = count}) @@ -105,6 +105,8 @@ function _M.addSellRpc( agent, data ) role.dinerData:updateProperty({field = "customer", value = customer}) end + role:log("diner_action", {desc = "addSell", int1 = dish, int2 = count}) + role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) SendPacket(actionCodes.Diner_addSellRpc, "") return true @@ -143,10 +145,13 @@ function _M.removeSellRpc( agent, data ) local cost = dishData.material:toNumMap() for k, n in pairs(cost) do local sum = n*sell.count - role:addItem({itemId = k,count = sum}) reward[k] = sum end + reward = role:award(reward, {log = {desc = "removeSell"}}) sells[slot].count = 0 + + role:log("diner_action", {desc = "removeSell", int1 = dish}) + role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) SendPacket(actionCodes.Diner_removeSellRpc, MsgPack.pack({reward = reward})) return true @@ -184,18 +189,23 @@ function _M.getSellRewardRpc( agent, data ) sells[slot].popular = 0 end role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) - for k, v in pairs(reward:toNumMap()) do - role:addItem({itemId = k,count = v}) + local gift = reward:toNumMap() + for k, v in pairs(gift) do if k == ItemId.Gold then role:checkTaskEnter("FoodSellGold", {count = v}) end end + role:award(gift, {log = {desc = "dinerSell"}}) + role.dinerData:popularAdd(popular) if dirty then role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order")) end + + role:log("diner_action", {desc = "sell"}) + SendPacket(actionCodes.Diner_getSellRewardRpc, MsgPack.pack({reward = reward})) return true end @@ -213,7 +223,7 @@ function _M.expediteSellRpc( agent, data ) if not role:checkItemEnough(cost) then return 2 end - role:costItems(cost) + role:costItems(cost, {log = {desc = "dinerSellQ"}}) end local dirty = false @@ -250,12 +260,14 @@ function _M.expediteSellRpc( agent, data ) role.dinerData:notifyUpdateProperty("sells", role.dinerData:getProperty("sells")) role.dinerData:setProperty("expedite",count+1) role.dinerData:notifyUpdateProperty("expedite", count+1) - for k, v in pairs(reward:toNumMap()) do - role:addItem({itemId = k,count = v}) + local gift = reward:toNumMap() + for k, v in pairs(gift) do if k == ItemId.Gold then role:checkTaskEnter("FoodSellGold", {count = v}) end end + role:award(gift, {log = {desc = "dinerSell"}}) + role.dinerData:popularAdd(popular) @@ -263,6 +275,9 @@ function _M.expediteSellRpc( agent, data ) role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order")) end role:checkTaskEnter("FoodSellQuick") + + role:log("diner_action", {desc = "sellQ"}) + SendPacket(actionCodes.Diner_expediteSellRpc, MsgPack.pack({reward = reward,popular = popular})) return true end @@ -298,9 +313,12 @@ function _M.levelUpRpc( agent, data ) return end - role:costItems(cost) + role:costItems(cost, {log = {desc = "dinerBuildUp", int1 = index}}) role.dinerData:updateProperty({field = "buildL", value = buildL:setv(index, curLevel + 1)}) role:checkTaskEnter("DinerLevelUp", {type = index, level = curLevel + 1}) + + role:log("diner_action", {desc = "buildUp", int1 = index, int2 = curLevel + 1}) + SendPacket(actionCodes.Diner_levelUpRpc, '') return true end @@ -374,7 +392,7 @@ function _M.talentUpRpc( agent, data ) -- if next(role:getProperty("advTeam")) then return 8 end -- end - role:costItems(cost) + role:costItems(cost, {log = {desc = "talentUp", int1 = dish, int2 = dishLevel + 1}}) role.dinerData:updateProperty({field = "dishTree", value = dishTree:setv(dish, dishLevel + 1)}) -- local treePoint = talentData.tree_point:toNumMap() -- if next(treePoint) then @@ -383,6 +401,8 @@ function _M.talentUpRpc( agent, data ) role:checkTaskEnter("DinerTalentUp", {type = talentData.effect:toArray(true,"=")[1]}) + role:log("diner_action", {desc = "talentUp", int1 = dish, int2 = dishLevel + 1}) + SendPacket(actionCodes.Diner_talentUpRpc, '') return true end @@ -414,8 +434,9 @@ function _M.skillUpRpc( agent, data ) return end - role:costItems(cost) + role:costItems(cost, {log = {desc = "dinerSkillUp", int1 = skill, int2 = skillLevel + 1}}) role.dinerData:updateProperty({field = "skillTree", value = skillTree:setv(skill, skillLevel + 1)}) + role:log("diner_action", {desc = "skillUp", int1 = skill, int2 = skillLevel + 1}) SendPacket(actionCodes.Diner_skillUpRpc, '') return true @@ -442,6 +463,9 @@ function _M.lockTaskRpc( agent, data ) order.lock = 0 end role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) + + role:log("diner_action", {desc = "lockTask", int1 = order.id}) + SendPacket(actionCodes.Diner_lockTaskRpc, MsgPack.pack({lock = order.lock})) return true end @@ -477,6 +501,9 @@ function _M.updateTaskRpc( agent, data ) end orders[index].status = 1 orders[index].lock = 1 + + role:log("diner_action", {desc = "getTask", int1 = order.id}) + role:checkTaskEnter("GetOderTask", {rarity = taskSet.rarity}) elseif cmd == 1 then if order.status ~= 1 then @@ -484,6 +511,9 @@ function _M.updateTaskRpc( agent, data ) end orders[index].status = 0 orders[index].lock = 0 + + role:log("diner_action", {desc = "deleteTask", int1 = order.id}) + elseif cmd == 2 then if order.status ~= 1 then return 32 @@ -491,9 +521,9 @@ function _M.updateTaskRpc( agent, data ) if order.n < taskData.value then return 6 end - for typ, count in pairs(taskData.reward:toNumMap()) do - role:addItem({itemId = typ, count = count}) - end + role:log("diner_action", {desc = "finishTask", int1 = order.id}) + + role:award(taskData.reward, {log = {desc = "dinerFinishTask", int1 = order.id}}) table.remove(orders,index) role:checkTaskEnter("OverOderTask", {rarity = taskSet.rarity}) else @@ -550,7 +580,7 @@ function _M.refreshTaskRpc( agent, data ) end if not role:checkItemEnough(cost) then return end - role:costItems(cost) + role:costItems(cost, {log = {desc = "dinerReTask"}}) for idx, order in ipairs(orders) do @@ -565,6 +595,8 @@ function _M.refreshTaskRpc( agent, data ) end end + role:log("diner_action", {desc = "reTask"}) + role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) SendPacket(actionCodes.Diner_refreshTaskRpc, '') @@ -605,6 +637,8 @@ function _M.addWantFoodRpc(agent , data) gfood[slot] = {id = itemId, st = skynet.timex()} end + role:log("diner_action", {desc = "wantFood"}) + role.dinerData:updateProperty({field = "gfood", value = gfood}) SendPacket(actionCodes.Diner_addWantFoodRpc, '') @@ -640,8 +674,11 @@ function _M.getGreenhouseRpc( agent, data ) end end role.dinerData:updateProperty({field = "gfood", value = gfood}) - local reward = role:award(reward) + local reward = role:award(reward, {log = {desc = "greenHourse"}}) role:checkTaskEnter("FoodMGet") + + role:log("diner_action", {desc = "greenHourse"}) + SendPacket(actionCodes.Diner_getGreenhouseRpc, MsgPack.pack({reward = reward})) return true end @@ -751,24 +788,25 @@ function _M.entrustRpc(agent , data) local ctype = msg.ctype local entrust = role.dinerData:getProperty("entrust") - if not entrust[1] then return end + local entrustId = entrust[1] + if not entrustId then return end local reward if ctype == 1 then -- 完成 - local curData = csvdb["diner_missionCsv"][entrust[1]] + local curData = csvdb["diner_missionCsv"][entrustId] if not curData then return end if curData.type == 1 then local cost = curData.condition:toNumMap() if not role:checkItemEnough(cost) then return end - role:costItems(cost) + role:costItems(cost, {log = {desc = "dinerEntrus", int1 = entrustId}}) elseif curData.type == 2 then -- todo 数据校验 else return end - reward = role:award(curData.reward) + reward = role:award(curData.reward, {log = {desc = "dinerEntrus", int1 = entrustId}}) table.remove(entrust, 1) elseif ctype == 2 then -- 放弃 table.remove(entrust, 1) @@ -777,6 +815,8 @@ function _M.entrustRpc(agent , data) end role.dinerData:updateProperty({field = "entrust", value = entrust}) + role:log("diner_action", {desc = "entrus", short1 = ctype, int1 = entrustId}) + SendPacket(actionCodes.Diner_entrustRpc, MsgPack.pack({reward = reward})) return true end @@ -798,9 +838,10 @@ function _M.collectRpc(agent , data) for slot, _ in pairs(sells) do role.dinerData:updateSell(slot) end - local reward = role:award(customerData.reward) + local reward = role:award(customerData.reward, {log = {desc = "dinerCollect", int1 = id}}) customer[id] = 1 role.dinerData:updateProperty({field = "customer", value = customer}) -- 解锁了 + role:log("diner_action", {desc = "collect", int1 = id}) SendPacket(actionCodes.Diner_collectRpc, MsgPack.pack({reward = reward})) return true @@ -826,10 +867,12 @@ function _M.comboRewardRpc(agent , data) end comboStatus[id] = 1 - local reward = role:award(comboData.reward) + local reward = role:award(comboData.reward, {log = {desc = "dinerCombo", int1 = id}}) role.dinerData:updateProperty({field = "comboStatus", value = comboStatus}) -- 解锁了 + role:log("diner_action", {desc = "combo", int1 = id}) + SendPacket(actionCodes.Diner_comboRewardRpc, MsgPack.pack({reward = reward})) return true end diff --git a/src/actions/EmailAction.lua b/src/actions/EmailAction.lua index 53f85d1..834f4e1 100644 --- a/src/actions/EmailAction.lua +++ b/src/actions/EmailAction.lua @@ -53,7 +53,7 @@ function _M.listRpc(agent, data) content = email.content, attachments = email.attachments }) - role:log("mail_actions", {desc = "get_global", key1 = email.title, key2 = email.attachments}) + role:log("mail_action", {desc = "get_global", key1 = email.title, key2 = email.attachments}) end end end @@ -95,10 +95,10 @@ function _M.drawAllAttachRpc(agent, data) local attachments = getEmailAttachments(email) if attachments ~= "" then local emailId = email:getProperty("id") - local items = role:award(attachments) + local items = role:award(attachments, {log = {desc = "draw_attach", int1 = emailId, key1 = email:getProperty("title")}}) ids[emailId] = 1 red:hset(string.format(R_EMAIL_ITEM, roleId, emailId), "status", 2) - role:log("mail_actions", {desc = "draw_attach", int1 = emailId, key1 = email:getProperty("title"), key2 = attachments}) + role:log("mail_action", {desc = "draw_attach", int1 = emailId, key1 = email:getProperty("title"), key2 = attachments}) for key, v in pairs(items) do reward[key] = (reward[key] or 0) + v @@ -125,11 +125,11 @@ function _M.drawAttachRpc(agent, data) local attachments = getEmailAttachments(email) if attachments == "" then return end - local reward = role:award(attachments) + local reward = role:award(attachments, {log = {desc = "draw_attach", int1 = emailId, key1 = email:getProperty("title")}}) redisproxy:hset(rds, "status", 2) -- 领取标记 SendPacket(actionCodes.Email_drawAttachRpc, MsgPack.pack({reward = reward})) - role:log("mail_actions", {desc = "draw_attach", int1 = id, key1 = email:getProperty("title"), key2 = attachments}) + role:log("mail_action", {desc = "draw_attach", int1 = id, key1 = email:getProperty("title"), key2 = attachments}) return true end @@ -144,7 +144,7 @@ function _M.checkRpc(agent, data) if not redisproxy:exists(rds) then return end redisproxy:hset(rds, "status", 1) - role:log("mail_actions", {desc = "check_mail", int1 = id}) + role:log("mail_action", {desc = "check_mail", int1 = id}) SendPacket(actionCodes.Email_checkRpc, '') return true @@ -180,7 +180,7 @@ function _M.delRpc(agent, data) end end) for delId, _ in ipairs(result) do - role:log("mail_actions", {desc = "del_mail", int1 = delId}) + role:log("mail_action", {desc = "del_mail", int1 = delId}) end SendPacket(actionCodes.Email_delRpc, MsgPack.pack({result = result})) return true diff --git a/src/actions/FriendAction.lua b/src/actions/FriendAction.lua index 17304f2..c322ba7 100644 --- a/src/actions/FriendAction.lua +++ b/src/actions/FriendAction.lua @@ -110,6 +110,8 @@ function _M.searchRpc(agent, data) })) end + + role:log("role_action", {desc = "searchFriend"}) SendPacket(actionCodes.Friend_searchRpc, MsgPack.pack({searchList = searchList})) return true end @@ -175,8 +177,14 @@ function _M.applyRpc(agent, data) myInfo.roleId = roleId myInfo.online = true myInfo.hadApply = true + + role:log("role_action", {desc = "addFriend", int1 = 1}) + rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newApply = 1, info = {myInfo}})) -- 通知对方 end + + + SendPacket(actionCodes.Friend_applyRpc, MsgPack.pack({result = result})) return true end @@ -268,6 +276,9 @@ function _M.handleApplyRpc(agent, data) otherInfo.isFriend = true otherInfo.pGet = redret[2] == 1 and 1 or nil SendPacket(actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = {otherInfo}})) + + role:log("role_action", {desc = "addFriend", int1 = 1}) + end elseif cmd == 0 then -- 不同意 @@ -322,6 +333,8 @@ function _M.handleApplyRpc(agent, data) rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = {myInfo}})) -- 通知对方 end if next(needAdd) then + role:log("role_action", {desc = "addFriend", int1 = #needAdd}) + SendPacket(actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = needAddInfo})) else result = 1 @@ -520,6 +533,8 @@ function _M.pointRpc(agent, data) role.dailyData:updateProperty({field = "giveFP", value = giveP}) role:checkTaskEnter("GiveFriendP", {count = 1}) rpcRole(objId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newPoint = 1, roleId = roleId})) + + role:log("role_action", {desc = "giveFPoint", int1 = 1}) end elseif cmd == 2 then -- 领取 local objId = msg.roleId @@ -535,9 +550,11 @@ function _M.pointRpc(agent, data) end if not result then getP[objId] = 1 - reward = role:award({[ItemId.FriendPoint] = 1}) + reward = role:award({[ItemId.FriendPoint] = 1}, {log = {desc = "friendPoint"}}) role.dailyData:updateProperty({field = "getFP", value = getP}) role:checkTaskEnter("GetFriendP", {count = 1}) + + role:log("role_action", {desc = "getFPoint", int1 = 1}) end elseif cmd == 3 then -- 一键赠送领取 -- 赠送 @@ -558,6 +575,9 @@ function _M.pointRpc(agent, data) if change > 0 then role.dailyData:updateProperty({field = "giveFP", value = giveP}) role:checkTaskEnter("GiveFriendP", {count = change}) + + role:log("role_action", {desc = "giveFPoint", int1 = change}) + else result = 1 end @@ -579,9 +599,10 @@ function _M.pointRpc(agent, data) end end if getCount > 0 then - reward = role:award({[ItemId.FriendPoint] = getCount}) + reward = role:award({[ItemId.FriendPoint] = getCount}, {log = {desc = "friendPoint"}}) role.dailyData:updateProperty({field = "getFP", value = getP}) role:checkTaskEnter("GetFriendP", {count = getCount}) + role:log("role_action", {desc = "getFPoint", int1 = getCount}) else result = (result or 0) + 2 end diff --git a/src/actions/GmAction.lua b/src/actions/GmAction.lua index 3b0faf9..c83a6fa 100644 --- a/src/actions/GmAction.lua +++ b/src/actions/GmAction.lua @@ -19,14 +19,15 @@ function _M.testhotfix(role, pms) return csvdb["itemCsv"][1]["name"] .. " -=- " .. csvdb["itemCsv"][2]["name"] .. " -=- " .. role:getItemCount(123) .. " -=- " .. table.pack(next(role.heros))[2]:getBattleValue() end -function _M.ignoreout(role, params) - params = params or {} - local status = tonum(params.pm1, 1) +function _M.ignoreout(role, pms) + pms = pms or {} + local status = tonum(pms.pm1, 1) if status == 1 then -- 忽视 role:updateProperty({field = "ignoreMt", value = 1}) else -- 解除 role:updateProperty({field = "ignoreMt", value = 0}) end + role:log("gm_action", {desc = "ignoreout", key1 = pms.sender}) return "指令生效" end @@ -46,11 +47,17 @@ function _M.ban(role, pms) end) end end + + role:log("gm_action", {desc = "ban", int1 = time, int2 = ctype, key1 = pms.sender}) + return isBan and "解封杀成功" or "封杀成功" end function _M.unban(role, pms) role:setBan(0, 0) + + role:log("gm_action", {desc = "unban", key1 = pms.sender}) + return "解封杀成功" end @@ -63,6 +70,7 @@ function _M.gmmsg(role, pms) skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd) end) end + role:log("gm_action", {desc = "gmmsg", text1 = pms.pm1, key1 = pms.sender}) return "指令成功" end @@ -74,6 +82,8 @@ function _M.silent(role, pms) return "解禁言成功" end role:updateProperty({field = "silent", value = specTime({hour = 0}, skynet.timex()) + pm1 * 86400}) + + role:log("gm_action", {desc = "silent", int1 = pms.pm1, key1 = pms.sender}) return "禁言成功" end @@ -83,9 +93,11 @@ local helpDes = {{"描述", "指令", "参数1", "参数2" ,"参数3"}} table.insert(helpDes, {"获得角色" , "hero", "角色类型"}) function _M.hero(role, pms) local heroType = tonum(pms.pm1) - if not role:addHero({type = heroType}) then + if not role:addHero({type = heroType, log = {desc = "gm"}}) then return "失败" end + + role:log("gm_action", {desc = "hero", int1 = heroType, key1 = pms.sender}) return "成功" end @@ -117,6 +129,9 @@ function _M.herol(role, pms) addLevel = math.min(hero:getMaxLevel() - hero:getProperty("level"), addLevel) hero:updateProperty({field = "level", delta = addLevel}) role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")}) + + role:log("gm_action", {desc = "herol", int1 = heroType, int2 = addLevel, key1 = pms.sender}) + return "成功" end @@ -127,6 +142,9 @@ function _M.herola(role, pms) for _, hero in pairs(role.heros) do _M.herol(role, {pm1 = hero:getProperty("type"), pm2 = addLevel}) end + + role:log("gm_action", {desc = "herola", int1 = addLevel, key1 = pms.sender}) + return "成功" end @@ -136,7 +154,8 @@ function _M.equip(role, pms) local typ = tonum(pms.pm1) local level = tonum(pms.pm2) local count = tonum(pms.pm3) - role:addEquip({type = typ,level = level,count = count}) + role:addEquip(typ, level, count, {log = {desc = "gm"}}) + role:log("gm_action", {desc = "equip", int1 = typ, int2 = level, long1 = count, key1 = pms.sender}) return "成功" end @@ -144,7 +163,9 @@ table.insert(helpDes, {"获得零件" , "rune", "零件类型", "零件id"}) function _M.rune(role, pms) local typ = tonum(pms.pm1) local id = tonum(pms.pm2) - local result = role:addRune({type = typ,id = id}) + local result = role:addRune({type = typ,id = id, log = {desc = "gm"}}) + role:log("gm_action", {desc = "rune", int1 = typ, int2 = id, key1 = pms.sender}) + return result end @@ -165,6 +186,9 @@ function _M.fb(role, pms) -- 直接通关 passCarbon[carbonId] = 1 addPre(carbonId) role:updateProperty({field = "hangPass", value = passCarbon}) + + role:log("gm_action", {desc = "fb", int1 = carbonId, key1 = pms.sender}) + role:checkTaskEnter("HangPass", {id = carbonId}) return "成功" end @@ -187,6 +211,9 @@ function _M.fbc(role, pms) -- 直接通关 role:updateProperty({field = "hangInfo", value = {}}) role:updateProperty({field = "hangPass", value = passCarbon}) role:checkTaskEnter("HangPass", {id = carbonId}) + + role:log("gm_action", {desc = "fbc", int1 = carbonId, key1 = pms.sender}) + return "成功" end @@ -217,7 +244,10 @@ table.insert(helpDes, {"玩家经验", "exp", "经验"}) function _M.exp(role, pms) local exp = tonum(pms.pm1) exp = math.floor(math.max(exp, 0)) - role:addPlayExp(exp) + role:addPlayExp(exp, {log = {desc = "gm"}}) + + role:log("gm_action", {desc = "exp", int1 = exp, key1 = pms.sender}) + return "成功" end @@ -236,35 +266,35 @@ function _M.get(role, pms) reward[id] = data.number end end - role:award(reward) + role:award(reward, {log = {desc = "gm"}}) elseif pms.pm1 == "EQUIP" then for itemId = 7000 , 8000 do if csvdb["itemCsv"][itemId] then - role:award({[itemId] = 100}) + role:award({[itemId] = 100}, {log = {desc = "gm"}}) end end elseif pms.pm1 == "RUNE" then for itemId = 2000 , 3000 do if csvdb["itemCsv"][itemId] then - role:award({[itemId] = 1}) + role:award({[itemId] = 1}, {log = {desc = "gm"}}) end end elseif pms.pm1 == "FRAG" then for itemId = 100 , 400 do if csvdb["itemCsv"][itemId] then - role:award({[itemId] = 100}) + role:award({[itemId] = 100}, {log = {desc = "gm"}}) end end elseif pms.pm1 == "FOOD" then for itemId = 4000 , 5000 do if csvdb["itemCsv"][itemId] then - role:award({[itemId] = 100}) + role:award({[itemId] = 100}, {log = {desc = "gm"}}) end end elseif pms.pm1 == "HERO" then for itemId = 400 , 700 do if csvdb["itemCsv"][itemId] then - role:award({[itemId] = 1}) + role:award({[itemId] = 1}, {log = {desc = "gm"}}) end end else @@ -273,7 +303,8 @@ function _M.get(role, pms) return "物品不存在" end local count = tonum(pms.pm2, 1) - role:award({[itemId] = count}) + role:award({[itemId] = count}, {log = {desc = "gm"}}) + role:log("gm_action", {desc = "get", int1 = itemId, int2 = count, key1 = pms.sender}) end return "成功" end @@ -287,7 +318,7 @@ function _M.advc(role, pms) for itemId, count in pairs(reward) do reward[itemId] = math.ceil(count * globalCsv.adv_fail_reward_ratio / 100) -- 奖励相当于失败 end - role:award(reward) + role:award(reward, {log = {desc = "gm"}}) role:updateProperties({ advInfo = {}, @@ -297,6 +328,9 @@ function _M.advc(role, pms) advAFWear = {}, }, notNotify) role.advData = nil + + role:log("gm_action", {desc = "advc", key1 = pms.sender}) + return "成功" end @@ -304,6 +338,9 @@ table.insert(helpDes, {"冒险次数恢复", "advf"}) function _M.advf(role, pms) role.dailyData:updateProperty({field = "advC", value = 0}) role.dailyData:updateProperty({field = "advElC", value = 0}) + + role:log("gm_action", {desc = "advf", key1 = pms.sender}) + return "成功" end @@ -331,6 +368,7 @@ function _M.adv(role, pms) addPre(chapterId) role:updateProperty({field = "advPass", value = advPass}) end + role:log("gm_action", {desc = "advf", int1 = chapterId, int2 = layer, key1 = pms.sender}) return "成功" end @@ -355,6 +393,7 @@ function _M.advt(role, pms) advData.level = layer advData:saveDB() + role:log("gm_action", {desc = "advt", int1 = chapterId, int2 = layer, key1 = pms.sender}) return "成功" end @@ -363,6 +402,9 @@ table.insert(helpDes, {"冒险队等级增加", "advl", "经验"}) function _M.advl(role, pms) local exp = tonum(pms.pm1) role:addAdvLvExp(math.max(0, exp)) + + role:log("gm_action", {desc = "advl", int1 = exp, key1 = pms.sender}) + return "成功" end @@ -376,7 +418,8 @@ function _M.advcl(role, pms) end advData.battle.player:addExp(exp) advData:saveDB() - + role:log("gm_action", {desc = "advcl", int1 = exp, key1 = pms.sender}) + return "成功" end @@ -385,6 +428,8 @@ function _M.idlec(role, pms) role:updateProperty({field = "hangTeam", value = {}}) role:updateProperty({field = "hangInfo", value = {}}) role:updateProperty({field = "hangBag", value = {}}) + role:log("gm_action", {desc = "idlec", key1 = pms.sender}) + role.advData = nil return "成功" end @@ -408,11 +453,13 @@ function _M.advit(role, pms) local itemId = tonum(pms.pm1) local count = tonum(pms.pm2) reward[itemId] = count + + role:log("gm_action", {desc = "advit", int1 = itemId, int2 = count, key1 = pms.sender}) end local adv = role:getAdvData() - adv:award(reward) + adv:award(reward, {log = {desc = "gm"}}) return "成功" end @@ -422,6 +469,9 @@ function _M.tower(role, pms) local level = tonum(pms.pm1, 1) if not csvdb["tower_battleCsv"][level] then return "不存在" end role:updateProperty({field = "towerInfo", value = {c = globalCsv.tower_count_limit, l = level}}) + + role:log("gm_action", {desc = "tower", int1 = level, key1 = pms.sender}) + return "成功" end @@ -439,6 +489,9 @@ function _M.email(role, pms) attachments = id == 0 and reward or nil, rewardPms = id ~= 0 and reward or nil, }) + + role:log("gm_action", {desc = "email", int1 = id, key1 = pms.sender}) + return "成功" end @@ -455,6 +508,8 @@ function _M.cguide(role, pms) elseif id == 2 then role:updateProperty({field = "funcGuide", value = ""}) end + + role:log("gm_action", {desc = "cguide", int1 = id, key1 = pms.sender}) return "成功" end diff --git a/src/actions/HangAction.lua b/src/actions/HangAction.lua index 94ba056..bbf3708 100644 --- a/src/actions/HangAction.lua +++ b/src/actions/HangAction.lua @@ -102,6 +102,8 @@ function _M.startRpc( agent, data ) end role:updateProperty({field = "hangInfo", value = hangInfo}) + role:log("hang_action", {desc = "startHang", int1 = carbonId}) + SendPacket(actionCodes.Hang_startRpc, '') return true end @@ -184,12 +186,15 @@ function _M.endBattleRpc(agent, data) for itemId, count in pairs(carbonData.item_clear:toNumMap()) do reward[itemId] = count end - reward = role:award(reward) + reward = role:award(reward, {log = {desc = "hangBattle", int1 = carbonId}}) role:checkTaskEnter("HangPass", {id = carbonId}) end hangInfo.key = nil role:updateProperty({field = "hangInfo", value = hangInfo}) + + role:log("hang_action", {desc = "hangBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = carbonId}) + SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({ starNum = msg.starNum, reward = reward, @@ -232,7 +237,7 @@ function _M.getRewardRpc(agent , data) checkReward(role) local items = role:getProperty("hangBag") if not next(items) then return end - local reward = role:award(items) + local reward = role:award(items, {log = {desc = "hangReward"}}) table.clear(items) local hangInfo = role:getProperty("hangInfo") local nowTime = skynet.timex() @@ -323,7 +328,7 @@ function _M.quickRpc(agent , data) if not costs[curCount] then return end if costs[curCount] > 0 then if not role:checkItemEnough({[ItemId.Diamond] = costs[curCount]}) then return end - role:costItems({[ItemId.Diamond] = costs[curCount]}) + role:costItems({[ItemId.Diamond] = costs[curCount]}, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) end role.dailyData:updateProperty({field = "hangQC", value = curCount}) @@ -345,7 +350,7 @@ function _M.quickRpc(agent , data) reward[cur[1]] = (reward[cur[1]] or 0) + cur[2] end - reward = role:award(reward) + reward = role:award(reward, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) if reward[ItemId.Gold] then role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) end @@ -393,16 +398,16 @@ function _M.buyBonusCountRpc(agent, data) local count = msg.count local btype = msg.type - if math.illegalNum(btype, 1, 2) then return 0 end + if not TimeReset["DailyBattle" .. btype] then return end local bonusC = role.dailyData:getProperty("bonusC") bonusC[btype] = bonusC[btype] or {c = 0, b = 0} local lastCount = globalCsv.bonus_daily_buy_count - bonusC[btype]["b"] if math.illegalNum(count, 1, lastCount) then return 1 end - if not role:checkItemEnough({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}) then return end + if not role:checkItemEnough({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}) then return 2 end - role:costItems({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}) + role:costItems({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}, {log = {desc = "buyBonusCount", short1 = btype, int1 = count}}) bonusC[btype]["b"] = bonusC[btype]["b"] + count bonusC[btype]["c"] = bonusC[btype]["c"] - count @@ -457,10 +462,12 @@ function _M.endBonusBattleRpc(agent, data) local reward if starNum and starNum > 0 then - reward = role:award(bonusData.reward) + reward = role:award(bonusData.reward, {log = {desc = "bonusBattle", int1 = id}}) role:checkTaskEnter("BonusPass", {id = id}) end + role:log("hang_action", {desc = "bonusBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id}) + SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({ starNum = starNum, reward = reward})) diff --git a/src/actions/HeroAction.lua b/src/actions/HeroAction.lua index ea685e6..9181da1 100644 --- a/src/actions/HeroAction.lua +++ b/src/actions/HeroAction.lua @@ -27,9 +27,11 @@ function _M.levelUpRpc( agent, data ) local curData = csvdb["unit_expCsv"][hero:getProperty("level")] local cost = {[ItemId.Exp] = curData.exp, [ItemId.Gold] = curData.gold} if not role:checkItemEnough(cost) then return 3 end - role:costItems(cost) + role:costItems(cost, {log = {desc = "heroLevelUp", int1 = msg.id, int2 = hero:getProperty("type")}}) hero:updateProperty({field = "level", delta = 1}) + hero:log({desc = "levelUp", int1 = hero:getProperty("level")}) + role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")}) SendPacket(actionCodes.Hero_levelUpRpc, '') return true @@ -46,9 +48,11 @@ function _M.breakRpc( agent, data ) local curData = csvdb["unit_breakCsv"][hero:getProperty("breakL")] local cost = {[ItemId.BreakCost] = curData.cost, [ItemId.Gold] = curData.gold} if not role:checkItemEnough(cost) then return 4 end - role:costItems(cost) + role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}}) hero:updateProperty({field = "breakL", delta = 1}) + hero:log({desc = "break", int1 = hero:getProperty("breakL")}) + SendPacket(actionCodes.Hero_breakRpc, '') return true end @@ -82,7 +86,7 @@ function _M.wakeRpc(agent, data) end end - role:costItems(cost) + role:costItems(cost, {log = {desc = "heroWake", int1 = msg.id, int2 = hero:getProperty("type")}}) for k,v in pairs(skills) do hero:updateProperty({field = "skillL", value = hero:getProperty("skillL"):setv(k, v)}) end @@ -93,6 +97,8 @@ function _M.wakeRpc(agent, data) if curLevel == 4 then -- 解锁cg role:checkTaskEnter("WakeCG", {heroType = typ}) end + hero:log({desc = "wake", int1 = hero:getProperty("wakeL")}) + SendPacket(actionCodes.Hero_wakeRpc, '') return true @@ -109,6 +115,8 @@ function _M.skillUpRpc(agent, data) if hero:getLSPoint() <= 0 or curLevel >= #hero:getSkillData(index) then return end hero:updateProperty({field = "skillL", value = hero:getProperty("skillL"):setv(index, curLevel + 1)}) + hero:log({desc = "skillUp", int1 = index, int2 = curLevel + 1}) + SendPacket(actionCodes.Hero_skillUpRpc, '') return true end @@ -141,7 +149,7 @@ function _M.talentRpc(agent, data) cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][k]] = v end if not role:checkItemEnough(cost) then return 6 end - role:costItems(cost) + role:costItems(cost, {log = {desc = "heroTalent", int1 = msg.id, int2 = hero:getProperty("type")}}) talent = talent:incrv(index, 1) --是否进阶 @@ -167,6 +175,8 @@ function _M.talentRpc(agent, data) role:checkTaskEnter("HeroTalent", {heroType = hero:getProperty("type"), alv = aheadLevel}) + hero:log({desc = "talent", int1 = index, int2 = talent:getv(index, 0)}) + SendPacket(actionCodes.Hero_talentRpc, '') return true end @@ -491,8 +501,8 @@ function _M.createHeroRpc(agent, data) if hero:getProperty("type") == heroType then return end end - role:costItems({[heroType] = cost}) - role:award({[heroType + ItemStartId.Hero] = 1}) + role:costItems({[heroType] = cost}, {log = {desc = "createHero"}}) + role:award({[heroType + ItemStartId.Hero] = 1}, {log = {desc = "createHero"}}) SendPacket(actionCodes.Hero_createHeroRpc, "") return true @@ -522,12 +532,12 @@ function _M.referEquipsRpc(agent, data) if equips[typ] == 0 then curEquip = curEquip:delk(typ) else - role:addEquip(typ, equips[typ], -1) -- 穿上 + role:addEquip(typ, equips[typ], -1, {log = {desc = "refer"}}) -- 穿上 curEquip = curEquip:setv(typ, equips[typ]) end if cur ~= 0 then - role:addEquip(typ, cur, 1) -- 脱掉 + role:addEquip(typ, cur, 1, {log = {desc = "refer"}}) -- 脱掉 end end end @@ -602,8 +612,8 @@ function _M.createHeroRandomRpc(agent, data) else reward = {[temp[1] + ItemStartId.Hero] = 1} end - role:costItems({[itemId] = cost}) - reward = role:award(reward) + role:costItems({[itemId] = cost}, {log = {desc = "createHeroRandom"}}) + reward = role:award(reward, {log = {desc = "createHeroRandom"}}) SendPacket(actionCodes.Hero_createHeroRandomRpc, MsgPack.pack({reward = reward})) return true end @@ -668,11 +678,12 @@ function _M.getResetRewardRpc(agent, data) hero:updateProperty({field = "level", value = level}) hero:updateProperty({field = "breakL", value = breakL}) hero:updateProperty({field = "talent", value = ""}) + hero:log({desc = "resetHero"}) for itemId, count in pairs(reward) do reward[itemId] = math.floor(count * globalCsv.unit_back_discount) end - reward = role:award(reward) + reward = role:award(reward, {log = {desc = "resetHero", int1 = msg.id, int2 = hero:getProperty("type")}}) SendPacket(actionCodes.Hero_getResetRewardRpc, MsgPack.pack({reward = reward})) return true @@ -784,7 +795,7 @@ function _M.drawHeroRpc(agent, data) end, } - role:costItems(cost) + role:costItems(cost, {log = {desc = "drawHero", short1 = pool}}) local floorHeroCount = role:getProperty("floorHero")[pool] or 0 local ssrCount = 0 @@ -823,10 +834,10 @@ function _M.drawHeroRpc(agent, data) local fragId = itemData.id - ItemStartId.Hero local heroData = csvdb["unitCsv"][fragId] local count = globalCsv.draw_unit_tofragment[heroData.rare] * temp[2] - role:award({[fragId] = count}) + role:award({[fragId] = count}, {log = {desc = "drawHero", short1 = pool}}) table.insert(reward, {id = fragId, count = count, from = temp[1], fcount = temp[2]}) else - role:award({[temp[1]] = temp[2]}) + role:award({[temp[1]] = temp[2]}, {log = {desc = "drawHero", short1 = pool}}) table.insert(reward, {id = temp[1], count = temp[2]}) end end @@ -847,7 +858,7 @@ function _M.drawHeroRpc(agent, data) if ssrCount > 0 then role:checkTaskEnter("DrawSSR", {count = ssrCount}) end - + role:log("hero_action", {desc = "drawHero", short1 = pool, int1 = drawCount[drawType]}) SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 return true end @@ -869,13 +880,13 @@ function _M.repayHeroRpc(agent, data) local fragId = itemData.id - ItemStartId.Hero local heroData = csvdb["unitCsv"][fragId] local count = globalCsv.draw_unit_tofragment[heroData.rare] - role:award({[fragId] = count}) + role:award({[fragId] = count}, {log = {desc = "heroRepay"}}) reward = {id = fragId, count = count, from = id, fcount = 1} else - role:award({[id] = 1}) + role:award({[id] = 1}, {log = {desc = "heroRepay"}}) reward = {id = id, count = 1} end - + role:log("hero_action", {desc = "heroRepay"}) SendPacket(actionCodes.Hero_repayHeroRpc, MsgPack.pack({reward = reward})) return true end diff --git a/src/actions/HttpAction.lua b/src/actions/HttpAction.lua index f2910ed..5f6ce30 100644 --- a/src/actions/HttpAction.lua +++ b/src/actions/HttpAction.lua @@ -179,7 +179,11 @@ function _M.gm_action(query) return "角色不存在" end role:loadAll() - return gmFuncs[query.cmd](role, query) + role:startActionUcode() + local status = gmFuncs[query.cmd](role, query) + role:endActionUcode() + + return status end function _M.broadcast(query) diff --git a/src/actions/PvpAction.lua b/src/actions/PvpAction.lua index 76c4e54..9ded4e7 100644 --- a/src/actions/PvpAction.lua +++ b/src/actions/PvpAction.lua @@ -235,8 +235,8 @@ function _M.buyCountRpc(agent, data) local cost = {[ItemId.Diamond] = globalCsv.pvp_buy_cost * count} if not role:checkItemEnough(cost) then return 2 end - role:costItems(cost) - role:award({[ItemId.PvpKey] = count}) + role:costItems(cost, {log = {desc = "buyPvpKey"}}) + role:award({[ItemId.PvpKey] = count}, {log = {desc = "buyPvpKey"}}) SendPacket(actionCodes.Pvp_buyCountRpc, '') return true @@ -287,7 +287,7 @@ function _M.startBattleRpc(agent, data) if pvpFree >= globalCsv.pvp_battle_free_count then local cost = {[ItemId.PvpKey] = 1} if not role:checkItemEnough(cost) then return 5 end - role:costItems(cost) + role:costItems(cost, {log = {desc = "startPvp", short1 = 1}}) else role.dailyData:updateProperty({field = "pvpFree", delta = 1}) end @@ -296,6 +296,9 @@ function _M.startBattleRpc(agent, data) _pvpStartBattleCacheC = {idx = idx, key = key, revenge = revenge} role:checkTaskEnter("PvpBattle") + + + role:log("pvp_action", {desc = "startBattle", short1 = 1, int1 = revenge and 1 or 0}) end SendPacket(actionCodes.Pvp_startBattleRpc, MsgPack.pack({matchInfo = matchInfo, key = key, result = result, wait = wait})) @@ -331,7 +334,7 @@ function _M.endBattleRpc(agent, data) if not match then return end local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpBonus, true) - local reward = role:award({[temp[1]] = temp[2]}) + local reward = role:award({[temp[1]] = temp[2]}, {log = {desc = "pvpBattleC"}}) local myScore, matchScore, oldmyScore, oldMatchScore, myRank, oldMyRank = role:changePvpScoreCommon(match.t == 1 and match.id or -1, isWin) _pvpBattleInfoCacheC = {} --重新发阵容了 没毛病 @@ -384,6 +387,8 @@ function _M.endBattleRpc(agent, data) if isWin then role:checkTaskEnter("PvpWin", {score = myScore}) end + + role:log("pvp_action", {desc = "battleEnd", short1 = 1, int1 = isWin and 1 or 0, int2 = revenge and 1 or 0}) SendPacket(actionCodes.Pvp_endBattleRpc, MsgPack.pack({ reward = reward, @@ -483,7 +488,7 @@ function _M.startBattleHRpc(agent, data) if pvpFreeH >= globalCsv.pvp_battle_free_count_high then local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost} if not role:checkItemEnough(cost) then return 5 end - role:costItems(cost) + role:costItems(cost, {log = {desc = "startPvp", short1 = 2}}) else role.dailyData:updateProperty({field = "pvpFreeH", delta = 1}) end @@ -508,6 +513,9 @@ function _M.startBattleHRpc(agent, data) } role:checkTaskEnter("PvpBattle") + + role:log("pvp_action", {desc = "startBattle", short1 = 2, int1 = revenge and 1 or 0}) + end SendPacket(actionCodes.Pvp_startBattleHRpc, MsgPack.pack({ @@ -607,7 +615,7 @@ function _M.endBattleHRpc(agent, data) -- 战斗结束了发奖 local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpgroupBonus, true) - local reward = role:award({[temp[1]] = temp[2]}) + local reward = role:award({[temp[1]] = temp[2]}, {log = {desc = "pvpBattleH"}}) local myScore, matchScore, oldmyScore, oldMatchScore, myRank, oldMyRank = 0, 0, 0, 0, 0, 0 if role:isTimeResetOpen(TimeReset.PvpHight) then myScore, matchScore, oldmyScore, oldMatchScore, myRank, oldMyRank = role:changePvpScoreHigh(match.t == 1 and match.id or -1, isWin) @@ -675,6 +683,7 @@ function _M.endBattleHRpc(agent, data) if isWin then role:checkTaskEnter("PvpWin", {score = myScore}) end + role:log("pvp_action", {desc = "battleEnd", short1 = 2, int1 = isWin and 1 or 0, int2 = revenge and 1 or 0}) SendPacket(actionCodes.Pvp_endBattleHRpc, MsgPack.pack({ reward = reward, @@ -829,7 +838,8 @@ function _M.highDivisionGiftRpc(agent, data) pvpHGift = {}, }) - local reward = role:award(newReward) + local reward = role:award(newReward, {log = {desc = "pvpDivisionH"}}) + role:log("pvp_action", {desc = "pvpDivisionH"}) SendPacket(actionCodes.Pvp_highDivisionGiftRpc, MsgPack.pack({reward = reward})) return true @@ -853,7 +863,7 @@ function _M.shopBuyRpc(agent, data) if not role:checkItemEnough({[ItemId.PvpCoin] = csvData.cost * count}) then return end - role:costItems({[ItemId.PvpCoin] = csvData.cost * count}) + role:costItems({[ItemId.PvpCoin] = csvData.cost * count}, {log = {desc = "pvpShop", int1 = id, int2 = count}}) if csvData.limit > 0 then role:changeUpdates({{type = "pvpShop", field = id, value = (pvpShop[id] or 0) + count}}) end @@ -862,8 +872,9 @@ function _M.shopBuyRpc(agent, data) for id, c in pairs(gift) do gift[id] = c * count end - local reward = role:award(gift) + local reward = role:award(gift, {log = {desc = "pvpShop", int1 = id, int2 = count}}) + role:log("pvp_action", {desc = "pvpShop", int1 = id, int2 = count}) SendPacket(actionCodes.Pvp_shopBuyRpc, MsgPack.pack({reward = reward})) return true @@ -953,9 +964,10 @@ function _M.crossBetRpc(agent, data) if not role:isTimeResetOpen(TimeReset.PvpCross) then return end if msg.idx ~= 1 and msg.idx ~= 2 then return end - local result = role:getCrossServerPvpBet(msg.idx) + local result = role:setCrossServerPvpBet(msg.idx) if not result then return end - + + role:log("pvp_action", {desc = "crossBet"}) SendPacket(actionCodes.Pvp_crossBetRpc, MsgPack.pack(result)) return true end diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index 1bea077..e450c61 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -293,7 +293,7 @@ function _M.createRpc(agent, data) return true end newRole:startActionUcode() - newRole:award(globalCsv.birthItem) + newRole:award(globalCsv.birthItem, {log = {desc = "birth"}}) -- 欢迎邮件 redisproxy:insertEmail({roleId = roleId, emailId = 1}) @@ -900,7 +900,7 @@ function _M.drawCodeRpc(agent, data) if ret == 0 then local giftId = tonumber(result.giftId) role:setProperty("codeStr", codestr:setv(giftId, 1)) - local reward = role:award(result.gift, {desc = "drawCode", key1 = code, int1 = giftId}) + local reward = role:award(result.gift, {log = {desc = "drawCode", key1 = code, int1 = giftId}}) SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({ result = ret, @@ -965,7 +965,7 @@ function _M.guideRpc(agent, data) if master < 0 or slave < 0 then return end newerGuide = string.format("%d=%d",master,slave) role:updateProperty({field = "newerGuide", value = newerGuide}) - role:log("guide", {int1 = master*1000+slave}) + role:log("guide", {desc = "guide_new",int1 = master*1000+slave}) elseif cmdType == 2 then -- 系统引导 if not msg.skip then return end @@ -978,7 +978,7 @@ function _M.guideRpc(agent, data) if msg.funcType then funcGuide = funcGuide:setv(msg.funcType, 1) - role:log("guide_sys", {int1 = msg.funcType}) + role:log("guide", {desc = "guide_sys", int1 = msg.funcType}) end role:updateProperty({field = "funcGuide", value = funcGuide}) elseif cmdType == 3 then @@ -986,7 +986,7 @@ function _M.guideRpc(agent, data) if msg.funcType then local value = msg.value or 1 for _, funcIdx in pairs(msg.funcType:toArray(true,"=")) do - role:log("guide_weak", {int1 = funcIdx}) + role:log("guide", {desc = "guide_weak", int1 = funcIdx}) funcGuide = funcGuide:setv(funcIdx, value) end role:updateProperty({field = "funcGuide", value = funcGuide}) diff --git a/src/actions/StoreAction.lua b/src/actions/StoreAction.lua index dd97555..4b99b79 100644 --- a/src/actions/StoreAction.lua +++ b/src/actions/StoreAction.lua @@ -15,7 +15,7 @@ function _M.rechargeRpc(agent , data) rechargeF[id] = 1 role:updateProperty({field = "rechargeF", value = rechargeF}) end - role:gainDiamond({count = diamondCount, isRecharge = true}) + role:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}}) elseif dataSet.type == 1 then --月卡 return elseif dataSet.type == 2 then -- 赛季通行证 @@ -28,6 +28,8 @@ function _M.rechargeRpc(agent , data) local rmb = dataSet.rmb role:updateProperty({field = "rmbC", delta = rmb}) + role:log("role_action", {desc = "recharge", int1 = id}) + SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({diamond = diamondCount})) return true end @@ -57,7 +59,7 @@ function _M.dailyBuyRpc(agent , data) return 3 end - if not role:costDiamond({count = cost * count}) then + if not role:costDiamond({count = cost * count}, {log = {desc = "dailyShop", int1 = id, int2 = count}}) then return 4 end @@ -65,7 +67,9 @@ function _M.dailyBuyRpc(agent , data) dailySDC[id] = (dailySDC[id] or 0) + count role.dailyData:updateProperty({field = "dailySDC", value = dailySDC}) end - local reward = role:award(dataSet.gift) + local reward = role:award(dataSet.gift, {log = {desc = "dailyShop", int1 = id, int2 = count}}) + + role:log("role_action", {desc = "dailyShop", int1 = id, int2 = count}) SendPacket(actionCodes.Store_dailyBuyRpc, MsgPack.pack({reward = reward})) return true @@ -92,13 +96,15 @@ function _M.dinerBuyRpc(agent , data) role:updateProperty({field = "dinerS", value = dinerS}) end - role:costItems(cost) + role:costItems(cost, {log = {desc = "dinerShop", int1 = id, int2 = count}}) local gift = {} for _id, _count in pairs(dataSet.gift:toNumMap()) do gift[_id] = _count * count end - local reward = role:award(gift) + local reward = role:award(gift, {log = {desc = "dinerShop", int1 = id, int2 = count}}) + + role:log("role_action", {desc = "dinerShop", int1 = id, int2 = count}) SendPacket(actionCodes.Store_dinerBuyRpc, MsgPack.pack({reward = reward})) return true diff --git a/src/actions/TowerAction.lua b/src/actions/TowerAction.lua index cc06a80..2717ada 100644 --- a/src/actions/TowerAction.lua +++ b/src/actions/TowerAction.lua @@ -32,6 +32,7 @@ function _M.roleFormatRpc(agent , data) towerTeam.leader = msg.leader towerTeam.supports = supports + role:updateProperty({field = "towerF", value = towerTeam}) SendPacket(actionCodes.Tower_roleFormatRpc, '') return true @@ -74,6 +75,9 @@ function _M.startBattleRpc(agent, data) role:updateProperty({field = "towerInfo", value = towerInfo}) role:checkTaskEnter("TowerBattle", {level = towerInfo.l}) + + role:log("tower_action", {desc = "startBattle", int1 = id}) + SendPacket(actionCodes.Tower_startBattleRpc, '') return true end @@ -100,7 +104,7 @@ function _M.endBattleRpc(agent, data) role:setTowerRank(towerInfo.l) towerInfo.l = towerInfo.l + 1 - reward = role:award(curTower.reward) + reward = role:award(curTower.reward, {log = {desc = "towerBattle", int1 = id}}) role:checkTaskEnter("TowerPass", {level = towerInfo.l - 1}) end @@ -108,6 +112,9 @@ function _M.endBattleRpc(agent, data) towerInfo.t = nextTime towerInfo.k = nil role:updateProperty({field = "towerInfo", value = towerInfo}) + + role:log("tower_action", {desc = "startBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id}) + SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({reward = reward})) return true end @@ -124,12 +131,14 @@ function _M.bugCountRpc(agent, data) cost[k] = v * needCount end if not role:checkItemEnough(cost) then return end - role:costItems(cost) + role:costItems(cost, {log = {desc = "towerCount"}}) curCount = globalCsv.tower_count_limit end towerInfo.c = curCount towerInfo.t = nextTime role:updateProperty({field = "towerInfo", value = towerInfo}) + role:log("tower_action", {desc = "bugCount"}) + SendPacket(actionCodes.Tower_bugCountRpc, '') return true end diff --git a/src/adv/Adv.lua b/src/adv/Adv.lua index f98ff8f..039d33a 100644 --- a/src/adv/Adv.lua +++ b/src/adv/Adv.lua @@ -23,6 +23,17 @@ function Adv:ctor(owner) self:initByInfo(self.owner:getProperty("advInfo")) end +function Adv:log(contents) + contents = contents or {} + if contents["cint1"] or contents["cint2"] or contents["cint3"] then + print("advLog error log have cint1 or cint2 or cint3 ", debug.traceback()) + end + contents["cint1"] = self.chapterId + contents["cint2"] = self.level + + self.owner:log("adv_action", contents) +end + --初始化adv 信息 function Adv:initByInfo(advInfo) if not next(advInfo) then return end --还没有 开始新地图 @@ -244,7 +255,7 @@ end function Adv:activeSomeSupport() -- 奖励物品 if self.support[1] then - self:award(self.support[1]) + self:award(self.support[1], {log = {desc = "support"}}) self.support[1] = nil end @@ -274,7 +285,7 @@ function Adv:activeSomeSupport() end for i = 1, math.min(self.support[6], #pool) do local idx = math.randomInt(1, #pool) - self:award({[pool[idx]] = 1}) + self:award({[pool[idx]] = 1}, {log = {desc = "support"}}) table.remove(pool, idx) end self.support[6] = nil @@ -317,7 +328,7 @@ end -- 强制结束 function Adv:forceOver(notNotify) if self:isRunning() then - self:clear() + local advTeam = self.owner:getProperty("advTeam") advTeam.player = nil @@ -325,8 +336,9 @@ function Adv:forceOver(notNotify) for itemId, count in pairs(reward) do reward[itemId] = math.ceil(count * globalCsv.adv_fail_reward_ratio / 100) -- 奖励相当于失败 end - self.owner:award(reward) + self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) + self:clear() self.owner:updateProperties({ advInfo = {}, advTeam = advTeam, @@ -355,7 +367,7 @@ function Adv:checkAdvUnlock(utype, value) end end if next(reward) then - self.owner:award(reward) + self.owner:award(reward, {log = {desc = "advUnlock", int1 = self.chapterId}}) end end @@ -365,7 +377,7 @@ function Adv:clearAdvUnlockCache() reward[itemId] = 1 end if next(reward) then - self.owner:award(reward) + self.owner:award(reward, {log = {desc = "advUnlock", int1 = self.chapterId}}) end self.cacheUnlock = {} end @@ -427,6 +439,21 @@ function Adv:awardArtifact(id, params) if self:isHaveArtifact(id) then return end self.owner:changeUpdates({{type = "advAFGet", field = id, value = 1}}, params.notNotify) self:checkAchievement(Adv.AchievType.GetMWeapon, 1, id) + + + if params.log then + local log = clone(params.log) + if log["cint1"] or log["cint2"] or log["cint3"] then + print("awardArtifact error log have cint1 or cint2 or cint3 ", debug.traceback()) + end + log["cint1"] = self.chapterId + log["cint2"] = self.level + log["cint3"] = id + self.owner:log("in_artifact", log) + else + print("awardArtifact no log ", debug.traceback()) + end + self:pushBackEvent(AdvBackEventType.Artifact, {id = id}) end @@ -513,6 +540,7 @@ function Adv:wearArtifact(slot, id) else id = nil end + self:log({desc = "wearArtifact", int1 = id}) self.owner:changeUpdates({{type = "advAFWear", field = slot, value = id}}) return true @@ -571,6 +599,9 @@ function Adv:artifactLevelUp(id, level) end if newLv == advAFGet[id] then return end + self:log({desc = "artifactLevelUp", int1 = id, int2 = level}) + + local status = 0 if curWear[id] then -- 穿着呢 local oldData = csvdb["adv_artifactCsv"][id][advAFGet[id]] @@ -595,7 +626,7 @@ function Adv:waitChooseArtifact() end end if #pool == 0 then - self:award({[ItemId.AdvPoint] = 48}) + self:award({[ItemId.AdvPoint] = 48}, {log = {desc = "chooseArtifact"}}) else for i = 1, math.min(count, #pool) do local idx = math.randomInt(1, #pool) @@ -613,7 +644,10 @@ end function Adv:chooseArtifact(index) if not self.waitArtifact or not self.waitArtifact[index] then return end - self:award({[self.waitArtifact[index]] = 1}) + self:award({[self.waitArtifact[index]] = 1}, {log = {desc = "chooseArtifact"}}) + + self:log({desc = "chooseArtifact", int1 = self.waitArtifact[index]}) + self.waitArtifact = nil -- 支援效果继续选择 @@ -657,7 +691,7 @@ function Adv:over(success, rewardRatio, overType) local scoreInfo = self.score local scoreReward = math.floor(score / chapterData.scoreAward) - self.owner:award({[ItemId.OldCoin] = scoreReward}) + self.owner:award({[ItemId.OldCoin] = scoreReward}, {log = {desc = "advOver", int1 = self.chapterId}}) -- 被动技会影响奖励 self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level}) @@ -671,7 +705,7 @@ function Adv:over(success, rewardRatio, overType) reward[itemId] = math.ceil(count * rewardRatio / 100) end end - reward = self.owner:award(reward) + reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) if success then self.owner:checkTaskEnter("AdvPass", {id = self.chapterId, level = self.level, score = score}) @@ -699,6 +733,9 @@ function Adv:over(success, rewardRatio, overType) end end self:clearAdvUnlockCache() + + self:log({desc = "over", short1 = success and 1 or 0, int1 = overType}) + self:clear() self.owner:checkTaskEnter("AdvScore", {score = score}) @@ -788,6 +825,22 @@ function Adv:award(gift, params) else items = items:setv(itemId, nums) end + + if params.log then + local log = clone(params.log) + if log["cint1"] or log["cint2"] or log["cint3"] then + print("addAdvItem error log have cint1 or cint2 or cint3 ", debug.traceback()) + end + log["cint1"] = origin + log["cint2"] = math.abs(count) + if count >= 0 then + self.owner:log("in_adv", log) + else + self.owner:log("out_adv", log) + end + else + print("addAdvItem no log ", debug.traceback()) + end end end if items ~= oldItems then @@ -862,7 +915,7 @@ local function clickOut(self, room, block, params) self.battle.player:triggerPassive(Passive.DOWN_LAYER) if curFloorData then - self:backReward(self:award({[ItemId.AdvPoint] = curFloorData.exp})) + self:backReward(self:award({[ItemId.AdvPoint] = curFloorData.exp}, {log = {desc = "passReward", int1 = self.chapterId, int2 = self.level}})) end local isHaveRelay = self:isHaveRelay(self.level) @@ -870,6 +923,7 @@ local function clickOut(self, room, block, params) if isHaveRelay and not self.isRelay then self:initByChapter(self.chapterId, self.level, true, true, true, false) else + self:log({desc = "pass"}) self:initByChapter(self.chapterId, self.level + 1, true, true, false, false) end self:backNext() --下一关 @@ -985,7 +1039,7 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) local item = csvdb["event_dropCsv"][effect[2]]["range"]:randWeight(true) reward[item[1]] = (reward[item[1]] or 0) + item[2] end - self:backReward(self:award(reward, {}), {roomId = room.roomId, blockId = block.blockId}) + self:backReward(self:award(reward, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}), {roomId = room.roomId, blockId = block.blockId}) end, [2] = function() --获得冒险buff local layer = effect[3] or 1 @@ -1137,7 +1191,7 @@ local function clickDrop(self, room, block, params) local reward = {} if not block.event.item then return end self.battle.player:triggerPassive(Passive.CLICK_DROP) - local reward = self:award({[block.event.item[1]] = block.event.item[2]}) + local reward = self:award({[block.event.item[1]] = block.event.item[2]}, {log = {desc = "clickDrop"}}) -- local reward = self:award({[5801] = 1}) block:clear() self:backReward(reward, {roomId = room.roomId, blockId = block.blockId}) @@ -1161,7 +1215,7 @@ local function clickTrader(self, room, block, params) local costCount = math.ceil(goodsData.price * (block.event.shop[buyId][2] or 100) / 100) if not self:cost({[goodsData.currency] = costCount}, {}) then return false, 6 end --不够 self:backCost({[goodsData.currency] = costCount}) - local reward = self:award({[goodsData.item] = goodsData.num}) + local reward = self:award({[goodsData.item] = goodsData.num}, {log = {desc = "clickTrader", int1 = block.event.id}}) if goodsData.restrict == 1 then self.shopStatus[goodsData.goods] = (self.shopStatus[goodsData.goods] or 0) + 1 elseif goodsData.restrict == 2 then @@ -1214,7 +1268,7 @@ local function clickClick(self, room, block, params) local item = csvdb["event_dropCsv"][dropId]["range"]:randWeight(true) reward[item[1]] = (reward[item[1]] or 0) + item[2] end - self:backReward(self:award(reward, {}), {roomId = room.roomId, blockId = block.blockId}) + self:backReward(self:award(reward, {log = {desc = "clickClick", int1 = block.event.id}}), {roomId = room.roomId, blockId = block.blockId}) end, [3] = function() for _, buffId in ipairs(clickData.effect:toArray(true, "=")) do diff --git a/src/adv/AdvPassive.lua b/src/adv/AdvPassive.lua index 8a411f8..dafb339 100644 --- a/src/adv/AdvPassive.lua +++ b/src/adv/AdvPassive.lua @@ -447,7 +447,7 @@ function Passive:effect8(dropId) skynet.error(string.format("CSVDATA Error adv_map_passive %s effect 8 not id %s in event_drop", self.id, dropId)) end local item = dropData["range"]:randWeight(true) - self.owner.battle.adv:award({[item[1]] = item[2]}) + self.owner.battle.adv:award({[item[1]] = item[2]}, {log = {desc = "passive", int1 = self.id}}) end --9=直接获得item(可在结算触发时使用) @@ -461,13 +461,13 @@ function Passive:effect9(itemId, triggerPms, ratio, max) return end if not cond then return end - self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio)))}) + self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio)))}, {log = {desc = "passive", int1 = self.id}}) end --10=战斗额外掉落次数 function Passive:effect10(count, triggerPms) if triggerPms.count then - self.owner.battle.adv:award({[triggerPms.itemId] = triggerPms.count * count}) + self.owner.battle.adv:award({[triggerPms.itemId] = triggerPms.count * count}, {log = {desc = "passive", int1 = self.id}}) end end diff --git a/src/adv/AdvTask.lua b/src/adv/AdvTask.lua index 011ea45..7b7d07f 100644 --- a/src/adv/AdvTask.lua +++ b/src/adv/AdvTask.lua @@ -137,7 +137,7 @@ function AdvTask.bind(Adv) local item = csvdb["event_dropCsv"][taskData.drop]["range"]:randWeight(true) reward[item[1]] = (reward[item[1]] or 0) + item[2] - reward = self:award(reward) + reward = self:award(reward, {log = {desc = "finishTask", int1 = taskId}}) self:scoreChange(AdvScoreType.Task, taskData.advScore) --增加加分 @@ -155,7 +155,7 @@ function AdvTask.bind(Adv) local mainTaskData = csvdb["adv_questCsv"][self.advMTask.id] if not mainTaskData then return end if mainTaskData.reward == 1 then - reward = self.owner:award(mainTaskData.rewardValue) + reward = self.owner:award(mainTaskData.rewardValue, {log = {desc = "advMainTask", int1 = self.advMTask.id}}) end self.advMTask.id = self.advMTask.id + 1 self.advMTask.status = 0 @@ -347,7 +347,7 @@ function AdvTask.bind(Adv) insertChange(chapterId, -1, count) -- 发放奖励 - reward = self.owner:award(achievData.reward) + reward = self.owner:award(achievData.reward, {log = {desc = "advAchiev", int1 = chapterId, int2 = taskId}}) return true, reward end end @@ -359,7 +359,7 @@ function AdvTask.bind(Adv) local status = ((self.owner:getProperty(achievField)[chapterId] or {})["pts"] or {})[taskId] or 0 if status == -1 or count < achievData.pt then return end - local reward = self.owner:award(achievData.reward) + local reward = self.owner:award(achievData.reward, {log = {desc = "advAchievReward", int1 = chapterId, int2 = taskId}}) insertChange(chapterId, taskId, -1, true) return true, reward end diff --git a/src/agent.lua b/src/agent.lua index eb2e5e6..367e928 100644 --- a/src/agent.lua +++ b/src/agent.lua @@ -287,7 +287,12 @@ local function routeGM(cmd, params) return "指令失败" end local _M = require "actions.GmAction" - return _M[cmd](agentInfo.role, params) + + agentInfo.role:startActionUcode() + local status = _M[cmd](agentInfo.role, params) + agentInfo.role:endActionUcode() + + return status end skynet.start(function() diff --git a/src/models/HeroPlugin.lua b/src/models/HeroPlugin.lua index 81d28a7..548e4c3 100644 --- a/src/models/HeroPlugin.lua +++ b/src/models/HeroPlugin.lua @@ -3,6 +3,17 @@ local HeroPlugin = {} function HeroPlugin.bind(Hero) + function Hero:log(contents) + contents = contents or {} + if contents["cint1"] or contents["cint2"] or contents["cint3"] then + print("heroLog error log have cint1 or cint2 or cint3 ", debug.traceback()) + end + contents["cint1"] = self:getProperty("id") + contents["cint2"] = self:getProperty("type") + + self.owner:log("hero_action", contents) + end + function Hero:getMaxLevel() return math.min(#csvdb["unit_expCsv"], csvdb["unit_breakCsv"][self:getProperty("breakL")].levelLimit) end diff --git a/src/models/RoleCross.lua b/src/models/RoleCross.lua index 64509cc..5db70d3 100644 --- a/src/models/RoleCross.lua +++ b/src/models/RoleCross.lua @@ -73,7 +73,7 @@ RoleCross.bind = function (Role) for k , v in pairs(initData.items or {}) do reward[tonumber(k)] = v end - self:award(reward) + self:award(reward, {log = {desc = "gm"}}) -- 英雄 local breakL = 0 @@ -95,7 +95,7 @@ RoleCross.bind = function (Role) local hero = self:isHaveHero(heroId) local status if not hero then - status, hero = self:addHero({type = heroId}) + status, hero = self:addHero({type = heroId, log = {desc = "gm"}}) else status = true end @@ -103,7 +103,7 @@ RoleCross.bind = function (Role) local rune = "" for slot , runeId in pairs(initData.heros.rune) do slot = tonumber(slot) - local status, rune_ = self:addRune({type = slot, id = runeId}) + local status, rune_ = self:addRune({type = slot, id = runeId, log = {desc = "gm"}}) if status == 0 then rune = rune:setv(slot, rune_:getProperty("uid")) if initData.heros.runeL and initData.heros.runeL > 0 then diff --git a/src/models/RoleLog.lua b/src/models/RoleLog.lua index 8993d38..3864173 100644 --- a/src/models/RoleLog.lua +++ b/src/models/RoleLog.lua @@ -4,8 +4,8 @@ local LogType = { create = "common", login = "common", logout = "common", - gm = "common", - mail_actions = "common", + guide = "common", + in_item = "common", out_item = "common", in_diamond = "common", @@ -18,10 +18,20 @@ local LogType = { out_rune = "common", player_exp = "common", func_open = "common", + in_adv = "common", + out_adv = "common", + in_artifact = "common", + + mail_action = "common", role_action = "common", - guide = "common", - guide_sys = "common", - guide_weak = "common", + hang_action = "common", + hero_action = "common", + adv_action = "common", + rune_action = "common", + pvp_action = "common", + diner_action = "common", + tower_action = "common", + gm_action = "common", } -- 如要修改 要提前修改 _template mapping -- 对应 mapping 为 gamelog-* diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index cb569a7..441bac5 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -669,7 +669,7 @@ function RolePlugin.bind(Role) end if heartWarning < 50 and heartWarning % 5 == 0 then self:sendGmMsg("server_accountBanned_warning") - self:log("gm",{desc = "heartWarning", int1 = heartWarning}) + self:log("role_action",{desc = "heartWarning", int1 = heartWarning}) end end @@ -682,11 +682,11 @@ function RolePlugin.bind(Role) self:setProperty("banType", 0) self:setProperty("heartWarning", 0) - self:log("gm", {desc = "ban_rm"}) + self:log("role_action", {desc = "ban_rm"}) else self:setProperty("banTime", now + 86400 * time) self:setProperty("banType", banType) - self:log("gm",{desc = "ban", int1 = time, int2 = banType}) + self:log("role_action", {desc = "ban", int1 = time, int2 = banType}) end end diff --git a/src/models/RolePvp.lua b/src/models/RolePvp.lua index 71b0c75..518bee2 100644 --- a/src/models/RolePvp.lua +++ b/src/models/RolePvp.lua @@ -467,7 +467,7 @@ function Role:getCrossServerPvpBetInfo() end end -function Role:getCrossServerPvpBet(idx) +function Role:setCrossServerPvpBet(idx) if not self:isTimeResetOpen(TimeReset.PvpCross) then return end local crossTime = skynet.timex() - self:getTimeResetStartTime(TimeReset.PvpCross) local aday = 3600 * 24 @@ -486,7 +486,7 @@ function Role:getCrossServerPvpBet(idx) local ok, result = pcall(skynet.call, pvpd, "lua", "setBet", idx) if ok then if result then - self:costItems(cost) + self:costItems(cost, {log = {desc = "crossPvpBet", short1 = day}}) pvpBet[day] = {idx, cost[ItemId.Gold]} self:setProperty("pvpBet", pvpBet) end diff --git a/src/models/Rune.lua b/src/models/Rune.lua index ff8a6d6..872f1ec 100644 --- a/src/models/Rune.lua +++ b/src/models/Rune.lua @@ -26,6 +26,18 @@ function Rune:notifyUpdateProperty(field, newValue, oldValue) self:notifyUpdateProperties(datas) end +function Rune:log(contents) + contents = contents or {} + if contents["cint1"] or contents["cint2"] or contents["cint3"] then + print("heroLog error log have cint1 or cint2 or cint3 ", debug.traceback()) + end + contents["cint1"] = self:getProperty("uid") + contents["cint2"] = self:getProperty("type") + contents["cint3"] = self:getProperty("id") + + self.owner:log("rune_action", contents) +end + function Rune:notifyUpdateProperties(params) local updateData = { uid = self:getProperty("uid"), -- libgit2 0.21.2