Commit 4aa21a1dd9096fe6a192477b1195981f853d67f1

Authored by zhouhaihai
2 parents 0a12fdaf c4817e41

Merge branch 'develop' into player

# Conflicts:
#	src/nodenames.lua
docs/日志说明.xlsx 0 → 100644
No preview for this file type
src/GlobalVar.lua
... ... @@ -162,7 +162,6 @@ AdvEventType = {
162 162 Trap = 6, --陷阱
163 163 Click = 7, --点击生效
164 164 Layer = 8, --切换层的点
165   - Task = 9, --任务
166 165 }
167 166  
168 167 AdvBackEventType = {
... ...
src/actions/AdvAction.lua
... ... @@ -163,6 +163,8 @@ function _M.startAdvRpc( agent, data )
163 163 role:checkTaskEnter("AdvStart", {id = chapterId})
164 164 role:checkTaskEnter("AdvStartSelf", {id = chapterId})
165 165 role:getAdvData():popBackEvents() -- 清一下事件
  166 + role:getAdvData():log({desc = "start", int1 = supportIdx})
  167 +
166 168 SendPacket(actionCodes.Adv_startAdvRpc, '')
167 169 return true
168 170 end
... ... @@ -215,6 +217,8 @@ function _M.startHangRpc(agent, data)
215 217  
216 218 role.dailyData:updateProperty({field = "advC", delta = 1})
217 219 role:checkTaskEnter("AdvStart", {id = chapterId})
  220 + role:log("adv_action", {desc = "startHang", int1 = chapterId})
  221 +
218 222 SendPacket(actionCodes.Adv_startHangRpc, '')
219 223 return true
220 224 end
... ... @@ -238,10 +242,12 @@ function _M.quickHangRpc(agent, data)
238 242 local cost = math.ceil((info.time - skynet.timex()) / chapterData.idleTime * chapterData.accelerate)
239 243  
240 244 if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return end
241   - role:costItems({[ItemId.Diamond] = cost})
  245 + role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "quickHang", int1 = chapterId}})
242 246 info.time = 0
243 247 role:changeUpdates({{type = "advHang", field = chapterId, value = info}})
244 248  
  249 + role:log("adv_action", {desc = "quickHang", int1 = chapterId})
  250 +
245 251 SendPacket(actionCodes.Adv_quickHangRpc, '')
246 252 return true
247 253 end
... ... @@ -262,7 +268,7 @@ function _M.endHangRpc(agent, data)
262 268  
263 269 local reward, isFull
264 270 if skynet.timex() >= info.time then
265   - reward = role:award(chapterData.idleReward)
  271 + reward = role:award(chapterData.idleReward, {log = {desc = "advHang", int1 = chapterId}})
266 272 else
267 273 if cancel then
268 274 if role.dailyData:getProperty("advC") <= 0 then
... ... @@ -277,6 +283,8 @@ function _M.endHangRpc(agent, data)
277 283  
278 284 role:changeUpdates({{type = "advHang", field = chapterId, value = nil}})
279 285  
  286 + role:log("adv_action", {desc = "endHang", int1 = chapterId, short1 = cancel and 1 or 0})
  287 +
280 288 SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, isFull = isFull}))
281 289 return true
282 290 end
... ... @@ -298,7 +306,7 @@ function _M.buyAdvCountRpc(agent , data)
298 306  
299 307  
300 308 if not role:checkItemEnough(cost) then return end
301   - role:costItems(cost)
  309 + role:costItems(cost, {log = {desc = "buyAdvCount", short1 = isEl and 1 or 0, int1 = count}})
302 310 if isEl then
303 311 role.dailyData:updateProperty({field = "advElC", delta = -count})
304 312 role.dailyData:updateProperty({field = "advElBC", delta = count})
... ... @@ -306,6 +314,7 @@ function _M.buyAdvCountRpc(agent , data)
306 314 role.dailyData:updateProperty({field = "advC", delta = -count})
307 315 role.dailyData:updateProperty({field = "advBC", delta = count})
308 316 end
  317 + role:log("adv_action", {desc = "buyAdvCount", short1 = isEl and 1 or 0, int1 = count})
309 318  
310 319 SendPacket(actionCodes.Adv_buyAdvCountRpc, '')
311 320 return true
... ... @@ -329,6 +338,9 @@ function _M.finishTaskRpc(agent, data)
329 338 adv:updateTask()
330 339 if not status then return end
331 340 role:checkTaskEnter("AdvOverTask", {id = taskId})
  341 +
  342 + adv:log({desc = "finishTask", int1 = taskId})
  343 +
332 344 SendPacket(actionCodes.Adv_finishTaskRpc, MsgPack.pack({reward = reward}))
333 345 return true
334 346 end
... ... @@ -342,8 +354,12 @@ function _M.clickBlockRpc(agent, data)
342 354 local adv = role:getAdvData()
343 355  
344 356 if adv:isWaitChooseArtifact() then return end
  357 +
  358 + adv:log({desc = "clickBlock", int1 = msg.roomId, int2 = msg.blockId})
  359 +
345 360 local status, errorCode = adv:clickBlock(msg.roomId, msg.blockId, msg)
346 361 if not status then return errorCode end
  362 +
347 363 SendPacket(actionCodes.Adv_clickBlockRpc, MsgPack.pack({events = adv:popBackEvents()}))
348 364 return true
349 365 end
... ... @@ -369,11 +385,12 @@ function _M.useItemRpc(agent, data)
369 385  
370 386 --消耗
371 387 if itemData["function"] == 0 or itemData["function"] == 1 then
372   - adv:cost({[itemId] = count}, {})
  388 + adv:cost({[itemId] = count}, {log = {desc = "useItem", int1 = itemId, int2 = count}})
373 389 adv:backUse({[itemId] = count})
374 390 end
375 391  
376 392 adv:checkAchievement(adv.AchievType.UseItem, count, itemId)
  393 + adv:log({desc = "useItem", int1 = itemId, int2 = count})
377 394  
378 395 for i = 1, count do
379 396 adv:doActive(itemData.effect, target) -- target
... ... @@ -409,6 +426,8 @@ function _M.usePotionRpc(agent, data)
409 426 local adv = role:getAdvData()
410 427 if adv:isWaitChooseArtifact() then return end
411 428  
  429 + adv:log({desc = "usePotion", int1 = potionId})
  430 +
412 431 local status = adv:doActive(potionData.effect, target) -- target
413 432 if not status then return end
414 433  
... ... @@ -436,7 +455,7 @@ function _M.chooseArtifactRpc(agent, data)
436 455 local status = adv:chooseArtifact(msg.idx)
437 456 if not status then return end
438 457 adv:saveDB()
439   -
  458 +
440 459 SendPacket(actionCodes.Adv_chooseArtifactRpc, '')
441 460 return true
442 461 end
... ... @@ -481,7 +500,7 @@ function _M.upArtifactRpc(agent, data)
481 500  
482 501 local status = adv:artifactLevelUp(id)
483 502 if not status then return 5 end
484   - adv:cost(cost, {})
  503 + adv:cost(cost, {log = {desc = "upArtifact", int1 = id}})
485 504 adv:backCost(cost)
486 505 if status == 1 then -- 现在穿着呢。更新下
487 506 adv:saveDB()
... ... @@ -497,6 +516,7 @@ function _M.exitAdvRpc(agent, data)
497 516 if not isCanContinue(role) then return end
498 517  
499 518 local adv = role:getAdvData()
  519 + adv:log({desc = "exit"})
500 520 local status = adv:exit() -- target {roomId = 1, blockId = 1} 选择的目标
501 521 SendPacket(actionCodes.Adv_exitAdvRpc, MsgPack.pack({events = adv:popBackEvents()}))
502 522 return true
... ... @@ -555,8 +575,9 @@ function _M.endBattleRpc(agent, data)
555 575 if enemy.monsterId ~= monsterId or enemy.roomId ~= roomId or enemy.blockId ~= blockId then return end
556 576 adv.__battleCache = nil
557 577  
558   -
  578 + adv:log({desc = "endBattle"})
559 579 local status = adv:clickBlock(roomId, blockId, {player = player, bySkill = bySkill})
  580 +
560 581 if not status then return end
561 582 SendPacket(actionCodes.Adv_endBattleRpc, MsgPack.pack({events = adv:popBackEvents()}))
562 583 return true
... ... @@ -621,7 +642,7 @@ function _M.wheelSurfRpc(agent, data)
621 642 end
622 643  
623 644 if not role:checkItemEnough(costs) then return 5 end
624   - role:costItems(costs)
  645 + role:costItems(costs, {log = {desc = "advWheelSurf", int1 = ptype}})
625 646 role:addAdvLvExp(costs[ItemId.OldCoin] or 0)
626 647 local advDrawB = role:getProperty("advDrawB")
627 648 advDrawB[ptype] = (advDrawB[ptype] or 0) + count
... ... @@ -635,8 +656,11 @@ function _M.wheelSurfRpc(agent, data)
635 656 reward[gift[1]] = (reward[gift[1]] or 0) + gift[2]
636 657 table.insert(backReward, gift)
637 658 end
638   - role:award(reward)
  659 + role:award(reward, {log = {desc = "advWheelSurf", int1 = ptype}})
  660 +
639 661 role:checkTaskEnter("AdvDraw", {count = count, ptype = ptype})
  662 + role:log("adv_action", {desc = "advWheelSurf", int1 = ptype, int2 = count})
  663 +
640 664 SendPacket(actionCodes.Adv_wheelSurfRpc, MsgPack.pack({reward = backReward}))
641 665 return true
642 666 end
... ... @@ -663,7 +687,8 @@ function _M.repayWheelSurfRpc(agent, data)
663 687 role:updateProperty({field = "advDrawB", value = advDrawB})
664 688 local gift = drawData["pool3"]:randWeight(true)
665 689 local reward = {[gift[1]] = gift[2]}
666   - reward = role:award(reward)
  690 + reward = role:award(reward, {log = {desc = "advRepayWheelSurf", int1 = ptype}})
  691 + role:log("adv_action", {desc = "advRepayWheelSurf", int1 = ptype})
667 692  
668 693 SendPacket(actionCodes.Adv_repayWheelSurfRpc, MsgPack.pack({reward = reward}))
669 694 return true
... ... @@ -686,6 +711,8 @@ function _M.finishAchievRpc(agent, data)
686 711 end
687 712 if not status then return end
688 713 adv:updateAchievement()
  714 + role:log("adv_action", {desc = "finishAchiev", short1 = ctype, int1 = chapterId, int2 = taskId})
  715 +
689 716 SendPacket(actionCodes.Adv_finishAchievRpc, MsgPack.pack({reward = reward}))
690 717 return true
691 718 end
... ... @@ -737,10 +764,11 @@ function _M.refreshSupportRpc(agent, data)
737 764 role.dailyData:updateProperty({field = "advSupRe", delta = 1})
738 765 else -- 付费
739 766 if not role:checkItemEnough({[ItemId.Diamond] = globalCsv.adv_support_refresh_cost}) then return end
740   - role:costItems({[ItemId.Diamond] = globalCsv.adv_support_refresh_cost})
  767 + role:costItems({[ItemId.Diamond] = globalCsv.adv_support_refresh_cost}, {log = {desc = "advReSupport"}})
741 768 end
742 769  
743 770 role:advRandomSupportEffect()
  771 + role:log("adv_action", {desc = "advSupRe", short1 = cr < al and 0 or 1})
744 772  
745 773 SendPacket(actionCodes.Adv_refreshSupportRpc, '')
746 774 return true
... ...
src/actions/CarAction.lua
... ... @@ -35,10 +35,12 @@ function _M.makePotionRpc( agent, data )
35 35 return 5
36 36 end
37 37  
38   - role:costItems(cost)
  38 + role:costItems(cost, {log = {desc = "makePotion", int1 = potionId, int2 = count}})
39 39 potionBag[potionId] = own + count
40 40 role:updateProperty({field = "potionBag", value = potionBag})
41 41 role:checkTaskEnter("PotionMake", {count = count, id = potionId})
  42 +
  43 + role:log("role_action", {desc = "makePotion", int1 = potionId, int2 = count})
42 44 SendPacket(actionCodes.Car_makePotionRpc, MsgPack.pack({potionBag = potionBag}))
43 45 return true
44 46 end
... ... @@ -84,10 +86,13 @@ function _M.equipUpRpc( agent, data )
84 86 return 4
85 87 end
86 88  
87   - role:costItems(cost)
88   - role:addEquip(typ, lv, -costCount)
89   - role:addEquip(typ, nextLv ,count)
  89 + role:costItems(cost, {log = {desc = "equipUp", int1 = id, int2 = count}})
  90 + role:addEquip(typ, lv, -costCount, {log = {desc = "equipUp"}})
  91 + role:addEquip(typ, nextLv ,count, {log = {desc = "equipUp"}})
90 92 role:checkTaskEnter("EquipUp", {count = count})
  93 +
  94 + role:log("role_action", {desc = "equipUp", int1 = id, int2 = count})
  95 +
91 96 SendPacket(actionCodes.Car_equipUpRpc, '')
92 97 return true
93 98 end
... ... @@ -117,9 +122,12 @@ function _M.runeUpRpc( agent, data )
117 122 return 7
118 123 end
119 124  
120   - role:costItems(cost)
  125 + role:costItems(cost, {log = {desc = "runeUp", int1 = uid, int2 = level}})
121 126 ownRune:updateProperty({field = "level",value = level+1})
122 127 role:checkTaskEnter("RuneUp")
  128 +
  129 + ownRune:log({desc = "runeUp", int1 = level + 1})
  130 +
123 131 SendPacket(actionCodes.Car_runeUpRpc, '')
124 132 return true
125 133 end
... ... @@ -143,7 +151,7 @@ function _M.saleEquipRpc(agent, data )
143 151 local itemData = csvdb["itemCsv"][id]
144 152 local typ = math.floor((id-7000)/100)
145 153 local lv = (id-7000)%100
146   - role:addEquip(typ, lv, -count) -- 删掉装备
  154 + role:addEquip(typ, lv, -count, {log = {desc = "saleEquip"}}) -- 删掉装备
147 155 -- 发奖励
148 156 local one = itemData.sell_effect:toNumMap()
149 157 for k ,v in pairs(one) do
... ... @@ -151,7 +159,10 @@ function _M.saleEquipRpc(agent, data )
151 159 end
152 160 end
153 161 role:checkTaskEnter("SaleEquip", {count = allCount})
154   - reward = role:award(reward)
  162 + reward = role:award(reward, {log = {desc = "saleEquip"}})
  163 +
  164 + role:log("role_action", {desc = "saleEquip", int1 = allCount})
  165 +
155 166 SendPacket(actionCodes.Car_saleEquipRpc, MsgPack.pack({reward = reward}))
156 167 return true
157 168 end
... ... @@ -177,10 +188,10 @@ function _M.saleRuneRpc(agent, data )
177 188 end
178 189 end
179 190  
180   - role:delRunes(backs)
  191 + role:delRunes(backs, {log = {desc = "saleRune"}})
181 192 role:checkTaskEnter("DecoRune", {count = count})
182   - reward = role:award(reward)
183   -
  193 + reward = role:award(reward, {log = {desc = "saleRune"}})
  194 +
184 195 SendPacket(actionCodes.Car_saleRuneRpc, MsgPack.pack({reward = reward}))
185 196 return true
186 197 end
... ...
src/actions/DinerAction.lua
... ... @@ -54,7 +54,7 @@ function _M.addSellRpc( agent, data )
54 54 return 6
55 55 end
56 56  
57   - role:costItems(cost)
  57 + role:costItems(cost, {log = {desc = "addSell"}})
58 58 role.dinerData:updateSell(slot)
59 59  
60 60 role:checkTaskEnter("MakeFood", {id = dish, count = count})
... ... @@ -105,6 +105,8 @@ function _M.addSellRpc( agent, data )
105 105 role.dinerData:updateProperty({field = "customer", value = customer})
106 106 end
107 107  
  108 + role:log("diner_action", {desc = "addSell", int1 = dish, int2 = count})
  109 +
108 110 role.dinerData:updateProperty({field = "sells", value = json.encode(sells)})
109 111 SendPacket(actionCodes.Diner_addSellRpc, "")
110 112 return true
... ... @@ -143,10 +145,13 @@ function _M.removeSellRpc( agent, data )
143 145 local cost = dishData.material:toNumMap()
144 146 for k, n in pairs(cost) do
145 147 local sum = n*sell.count
146   - role:addItem({itemId = k,count = sum})
147 148 reward[k] = sum
148 149 end
  150 + reward = role:award(reward, {log = {desc = "removeSell"}})
149 151 sells[slot].count = 0
  152 +
  153 + role:log("diner_action", {desc = "removeSell", int1 = dish})
  154 +
150 155 role.dinerData:updateProperty({field = "sells", value = json.encode(sells)})
151 156 SendPacket(actionCodes.Diner_removeSellRpc, MsgPack.pack({reward = reward}))
152 157 return true
... ... @@ -184,18 +189,23 @@ function _M.getSellRewardRpc( agent, data )
184 189 sells[slot].popular = 0
185 190 end
186 191 role.dinerData:updateProperty({field = "sells", value = json.encode(sells)})
187   - for k, v in pairs(reward:toNumMap()) do
188   - role:addItem({itemId = k,count = v})
  192 + local gift = reward:toNumMap()
  193 + for k, v in pairs(gift) do
189 194 if k == ItemId.Gold then
190 195 role:checkTaskEnter("FoodSellGold", {count = v})
191 196 end
192 197 end
  198 + role:award(gift, {log = {desc = "dinerSell"}})
  199 +
193 200  
194 201 role.dinerData:popularAdd(popular)
195 202  
196 203 if dirty then
197 204 role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order"))
198 205 end
  206 +
  207 + role:log("diner_action", {desc = "sell"})
  208 +
199 209 SendPacket(actionCodes.Diner_getSellRewardRpc, MsgPack.pack({reward = reward}))
200 210 return true
201 211 end
... ... @@ -213,7 +223,7 @@ function _M.expediteSellRpc( agent, data )
213 223 if not role:checkItemEnough(cost) then
214 224 return 2
215 225 end
216   - role:costItems(cost)
  226 + role:costItems(cost, {log = {desc = "dinerSellQ"}})
217 227 end
218 228  
219 229 local dirty = false
... ... @@ -250,12 +260,14 @@ function _M.expediteSellRpc( agent, data )
250 260 role.dinerData:notifyUpdateProperty("sells", role.dinerData:getProperty("sells"))
251 261 role.dinerData:setProperty("expedite",count+1)
252 262 role.dinerData:notifyUpdateProperty("expedite", count+1)
253   - for k, v in pairs(reward:toNumMap()) do
254   - role:addItem({itemId = k,count = v})
  263 + local gift = reward:toNumMap()
  264 + for k, v in pairs(gift) do
255 265 if k == ItemId.Gold then
256 266 role:checkTaskEnter("FoodSellGold", {count = v})
257 267 end
258 268 end
  269 + role:award(gift, {log = {desc = "dinerSell"}})
  270 +
259 271  
260 272 role.dinerData:popularAdd(popular)
261 273  
... ... @@ -263,6 +275,9 @@ function _M.expediteSellRpc( agent, data )
263 275 role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order"))
264 276 end
265 277 role:checkTaskEnter("FoodSellQuick")
  278 +
  279 + role:log("diner_action", {desc = "sellQ"})
  280 +
266 281 SendPacket(actionCodes.Diner_expediteSellRpc, MsgPack.pack({reward = reward,popular = popular}))
267 282 return true
268 283 end
... ... @@ -298,9 +313,12 @@ function _M.levelUpRpc( agent, data )
298 313 return
299 314 end
300 315  
301   - role:costItems(cost)
  316 + role:costItems(cost, {log = {desc = "dinerBuildUp", int1 = index}})
302 317 role.dinerData:updateProperty({field = "buildL", value = buildL:setv(index, curLevel + 1)})
303 318 role:checkTaskEnter("DinerLevelUp", {type = index, level = curLevel + 1})
  319 +
  320 + role:log("diner_action", {desc = "buildUp", int1 = index, int2 = curLevel + 1})
  321 +
304 322 SendPacket(actionCodes.Diner_levelUpRpc, '')
305 323 return true
306 324 end
... ... @@ -374,7 +392,7 @@ function _M.talentUpRpc( agent, data )
374 392 -- if next(role:getProperty("advTeam")) then return 8 end
375 393 -- end
376 394  
377   - role:costItems(cost)
  395 + role:costItems(cost, {log = {desc = "talentUp", int1 = dish, int2 = dishLevel + 1}})
378 396 role.dinerData:updateProperty({field = "dishTree", value = dishTree:setv(dish, dishLevel + 1)})
379 397 -- local treePoint = talentData.tree_point:toNumMap()
380 398 -- if next(treePoint) then
... ... @@ -383,6 +401,8 @@ function _M.talentUpRpc( agent, data )
383 401  
384 402 role:checkTaskEnter("DinerTalentUp", {type = talentData.effect:toArray(true,"=")[1]})
385 403  
  404 + role:log("diner_action", {desc = "talentUp", int1 = dish, int2 = dishLevel + 1})
  405 +
386 406 SendPacket(actionCodes.Diner_talentUpRpc, '')
387 407 return true
388 408 end
... ... @@ -414,8 +434,9 @@ function _M.skillUpRpc( agent, data )
414 434 return
415 435 end
416 436  
417   - role:costItems(cost)
  437 + role:costItems(cost, {log = {desc = "dinerSkillUp", int1 = skill, int2 = skillLevel + 1}})
418 438 role.dinerData:updateProperty({field = "skillTree", value = skillTree:setv(skill, skillLevel + 1)})
  439 + role:log("diner_action", {desc = "skillUp", int1 = skill, int2 = skillLevel + 1})
419 440  
420 441 SendPacket(actionCodes.Diner_skillUpRpc, '')
421 442 return true
... ... @@ -442,6 +463,9 @@ function _M.lockTaskRpc( agent, data )
442 463 order.lock = 0
443 464 end
444 465 role.dinerData:updateProperty({field = "order", value = json.encode(orders)})
  466 +
  467 + role:log("diner_action", {desc = "lockTask", int1 = order.id})
  468 +
445 469 SendPacket(actionCodes.Diner_lockTaskRpc, MsgPack.pack({lock = order.lock}))
446 470 return true
447 471 end
... ... @@ -477,6 +501,9 @@ function _M.updateTaskRpc( agent, data )
477 501 end
478 502 orders[index].status = 1
479 503 orders[index].lock = 1
  504 +
  505 + role:log("diner_action", {desc = "getTask", int1 = order.id})
  506 +
480 507 role:checkTaskEnter("GetOderTask", {rarity = taskSet.rarity})
481 508 elseif cmd == 1 then
482 509 if order.status ~= 1 then
... ... @@ -484,6 +511,9 @@ function _M.updateTaskRpc( agent, data )
484 511 end
485 512 orders[index].status = 0
486 513 orders[index].lock = 0
  514 +
  515 + role:log("diner_action", {desc = "deleteTask", int1 = order.id})
  516 +
487 517 elseif cmd == 2 then
488 518 if order.status ~= 1 then
489 519 return 32
... ... @@ -491,9 +521,9 @@ function _M.updateTaskRpc( agent, data )
491 521 if order.n < taskData.value then
492 522 return 6
493 523 end
494   - for typ, count in pairs(taskData.reward:toNumMap()) do
495   - role:addItem({itemId = typ, count = count})
496   - end
  524 + role:log("diner_action", {desc = "finishTask", int1 = order.id})
  525 +
  526 + role:award(taskData.reward, {log = {desc = "dinerFinishTask", int1 = order.id}})
497 527 table.remove(orders,index)
498 528 role:checkTaskEnter("OverOderTask", {rarity = taskSet.rarity})
499 529 else
... ... @@ -550,7 +580,7 @@ function _M.refreshTaskRpc( agent, data )
550 580 end
551 581 if not role:checkItemEnough(cost) then return end
552 582  
553   - role:costItems(cost)
  583 + role:costItems(cost, {log = {desc = "dinerReTask"}})
554 584  
555 585  
556 586 for idx, order in ipairs(orders) do
... ... @@ -565,6 +595,8 @@ function _M.refreshTaskRpc( agent, data )
565 595 end
566 596 end
567 597  
  598 + role:log("diner_action", {desc = "reTask"})
  599 +
568 600 role.dinerData:updateProperty({field = "order", value = json.encode(orders)})
569 601  
570 602 SendPacket(actionCodes.Diner_refreshTaskRpc, '')
... ... @@ -605,6 +637,8 @@ function _M.addWantFoodRpc(agent , data)
605 637 gfood[slot] = {id = itemId, st = skynet.timex()}
606 638 end
607 639  
  640 + role:log("diner_action", {desc = "wantFood"})
  641 +
608 642 role.dinerData:updateProperty({field = "gfood", value = gfood})
609 643  
610 644 SendPacket(actionCodes.Diner_addWantFoodRpc, '')
... ... @@ -640,8 +674,11 @@ function _M.getGreenhouseRpc( agent, data )
640 674 end
641 675 end
642 676 role.dinerData:updateProperty({field = "gfood", value = gfood})
643   - local reward = role:award(reward)
  677 + local reward = role:award(reward, {log = {desc = "greenHourse"}})
644 678 role:checkTaskEnter("FoodMGet")
  679 +
  680 + role:log("diner_action", {desc = "greenHourse"})
  681 +
645 682 SendPacket(actionCodes.Diner_getGreenhouseRpc, MsgPack.pack({reward = reward}))
646 683 return true
647 684 end
... ... @@ -751,24 +788,25 @@ function _M.entrustRpc(agent , data)
751 788 local ctype = msg.ctype
752 789  
753 790 local entrust = role.dinerData:getProperty("entrust")
754   - if not entrust[1] then return end
  791 + local entrustId = entrust[1]
  792 + if not entrustId then return end
755 793  
756 794 local reward
757 795 if ctype == 1 then -- 完成
758   - local curData = csvdb["diner_missionCsv"][entrust[1]]
  796 + local curData = csvdb["diner_missionCsv"][entrustId]
759 797 if not curData then return end
760 798  
761 799 if curData.type == 1 then
762 800 local cost = curData.condition:toNumMap()
763 801 if not role:checkItemEnough(cost) then return end
764   - role:costItems(cost)
  802 + role:costItems(cost, {log = {desc = "dinerEntrus", int1 = entrustId}})
765 803 elseif curData.type == 2 then
766 804 -- todo 数据校验
767 805 else
768 806 return
769 807 end
770 808  
771   - reward = role:award(curData.reward)
  809 + reward = role:award(curData.reward, {log = {desc = "dinerEntrus", int1 = entrustId}})
772 810 table.remove(entrust, 1)
773 811 elseif ctype == 2 then -- 放弃
774 812 table.remove(entrust, 1)
... ... @@ -777,6 +815,8 @@ function _M.entrustRpc(agent , data)
777 815 end
778 816 role.dinerData:updateProperty({field = "entrust", value = entrust})
779 817  
  818 + role:log("diner_action", {desc = "entrus", short1 = ctype, int1 = entrustId})
  819 +
780 820 SendPacket(actionCodes.Diner_entrustRpc, MsgPack.pack({reward = reward}))
781 821 return true
782 822 end
... ... @@ -798,9 +838,10 @@ function _M.collectRpc(agent , data)
798 838 for slot, _ in pairs(sells) do
799 839 role.dinerData:updateSell(slot)
800 840 end
801   - local reward = role:award(customerData.reward)
  841 + local reward = role:award(customerData.reward, {log = {desc = "dinerCollect", int1 = id}})
802 842 customer[id] = 1
803 843 role.dinerData:updateProperty({field = "customer", value = customer}) -- 解锁了
  844 + role:log("diner_action", {desc = "collect", int1 = id})
804 845  
805 846 SendPacket(actionCodes.Diner_collectRpc, MsgPack.pack({reward = reward}))
806 847 return true
... ... @@ -826,10 +867,12 @@ function _M.comboRewardRpc(agent , data)
826 867 end
827 868  
828 869 comboStatus[id] = 1
829   - local reward = role:award(comboData.reward)
  870 + local reward = role:award(comboData.reward, {log = {desc = "dinerCombo", int1 = id}})
830 871  
831 872 role.dinerData:updateProperty({field = "comboStatus", value = comboStatus}) -- 解锁了
832 873  
  874 + role:log("diner_action", {desc = "combo", int1 = id})
  875 +
833 876 SendPacket(actionCodes.Diner_comboRewardRpc, MsgPack.pack({reward = reward}))
834 877 return true
835 878 end
... ...
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_action", {desc = "get_global", key1 = email.title, key2 = email.attachments})
57 57 end
58 58 end
59 59 end
... ... @@ -95,10 +95,10 @@ function _M.drawAllAttachRpc(agent, data)
95 95 local attachments = getEmailAttachments(email)
96 96 if attachments ~= "" then
97 97 local emailId = email:getProperty("id")
98   - local items = role:award(attachments)
  98 + local items = role:award(attachments, {log = {desc = "draw_attach", int1 = emailId, key1 = email:getProperty("title")}})
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_action", {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
... ... @@ -125,11 +125,11 @@ function _M.drawAttachRpc(agent, data)
125 125 local attachments = getEmailAttachments(email)
126 126 if attachments == "" then return end
127 127  
128   - local reward = role:award(attachments)
  128 + local reward = role:award(attachments, {log = {desc = "draw_attach", int1 = emailId, key1 = email:getProperty("title")}})
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_action", {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_action", {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_action", {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/FriendAction.lua
... ... @@ -110,6 +110,8 @@ function _M.searchRpc(agent, data)
110 110  
111 111 }))
112 112 end
  113 +
  114 + role:log("role_action", {desc = "searchFriend"})
113 115 SendPacket(actionCodes.Friend_searchRpc, MsgPack.pack({searchList = searchList}))
114 116 return true
115 117 end
... ... @@ -175,8 +177,14 @@ function _M.applyRpc(agent, data)
175 177 myInfo.roleId = roleId
176 178 myInfo.online = true
177 179 myInfo.hadApply = true
  180 +
  181 + role:log("role_action", {desc = "addFriend", int1 = 1})
  182 +
178 183 rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newApply = 1, info = {myInfo}})) -- 通知对方
179 184 end
  185 +
  186 +
  187 +
180 188 SendPacket(actionCodes.Friend_applyRpc, MsgPack.pack({result = result}))
181 189 return true
182 190 end
... ... @@ -268,6 +276,9 @@ function _M.handleApplyRpc(agent, data)
268 276 otherInfo.isFriend = true
269 277 otherInfo.pGet = redret[2] == 1 and 1 or nil
270 278 SendPacket(actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = {otherInfo}}))
  279 +
  280 + role:log("role_action", {desc = "addFriend", int1 = 1})
  281 +
271 282 end
272 283  
273 284 elseif cmd == 0 then -- 不同意
... ... @@ -322,6 +333,8 @@ function _M.handleApplyRpc(agent, data)
322 333 rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = {myInfo}})) -- 通知对方
323 334 end
324 335 if next(needAdd) then
  336 + role:log("role_action", {desc = "addFriend", int1 = #needAdd})
  337 +
325 338 SendPacket(actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = needAddInfo}))
326 339 else
327 340 result = 1
... ... @@ -520,6 +533,8 @@ function _M.pointRpc(agent, data)
520 533 role.dailyData:updateProperty({field = "giveFP", value = giveP})
521 534 role:checkTaskEnter("GiveFriendP", {count = 1})
522 535 rpcRole(objId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newPoint = 1, roleId = roleId}))
  536 +
  537 + role:log("role_action", {desc = "giveFPoint", int1 = 1})
523 538 end
524 539 elseif cmd == 2 then -- 领取
525 540 local objId = msg.roleId
... ... @@ -535,9 +550,11 @@ function _M.pointRpc(agent, data)
535 550 end
536 551 if not result then
537 552 getP[objId] = 1
538   - reward = role:award({[ItemId.FriendPoint] = 1})
  553 + reward = role:award({[ItemId.FriendPoint] = 1}, {log = {desc = "friendPoint"}})
539 554 role.dailyData:updateProperty({field = "getFP", value = getP})
540 555 role:checkTaskEnter("GetFriendP", {count = 1})
  556 +
  557 + role:log("role_action", {desc = "getFPoint", int1 = 1})
541 558 end
542 559 elseif cmd == 3 then -- 一键赠送领取
543 560 -- 赠送
... ... @@ -558,6 +575,9 @@ function _M.pointRpc(agent, data)
558 575 if change > 0 then
559 576 role.dailyData:updateProperty({field = "giveFP", value = giveP})
560 577 role:checkTaskEnter("GiveFriendP", {count = change})
  578 +
  579 + role:log("role_action", {desc = "giveFPoint", int1 = change})
  580 +
561 581 else
562 582 result = 1
563 583 end
... ... @@ -579,9 +599,10 @@ function _M.pointRpc(agent, data)
579 599 end
580 600 end
581 601 if getCount > 0 then
582   - reward = role:award({[ItemId.FriendPoint] = getCount})
  602 + reward = role:award({[ItemId.FriendPoint] = getCount}, {log = {desc = "friendPoint"}})
583 603 role.dailyData:updateProperty({field = "getFP", value = getP})
584 604 role:checkTaskEnter("GetFriendP", {count = getCount})
  605 + role:log("role_action", {desc = "getFPoint", int1 = getCount})
585 606 else
586 607 result = (result or 0) + 2
587 608 end
... ...
src/actions/GmAction.lua
... ... @@ -19,14 +19,15 @@ function _M.testhotfix(role, pms)
19 19 return csvdb["itemCsv"][1]["name"] .. " -=- " .. csvdb["itemCsv"][2]["name"] .. " -=- " .. role:getItemCount(123) .. " -=- " .. table.pack(next(role.heros))[2]:getBattleValue()
20 20 end
21 21  
22   -function _M.ignoreout(role, params)
23   - params = params or {}
24   - local status = tonum(params.pm1, 1)
  22 +function _M.ignoreout(role, pms)
  23 + pms = pms or {}
  24 + local status = tonum(pms.pm1, 1)
25 25 if status == 1 then -- 忽视
26 26 role:updateProperty({field = "ignoreMt", value = 1})
27 27 else -- 解除
28 28 role:updateProperty({field = "ignoreMt", value = 0})
29 29 end
  30 + role:log("gm_action", {desc = "ignoreout", key1 = pms.sender})
30 31 return "指令生效"
31 32 end
32 33  
... ... @@ -46,11 +47,17 @@ function _M.ban(role, pms)
46 47 end)
47 48 end
48 49 end
  50 +
  51 + role:log("gm_action", {desc = "ban", int1 = time, int2 = ctype, key1 = pms.sender})
  52 +
49 53 return isBan and "解封杀成功" or "封杀成功"
50 54 end
51 55  
52 56 function _M.unban(role, pms)
53 57 role:setBan(0, 0)
  58 +
  59 + role:log("gm_action", {desc = "unban", key1 = pms.sender})
  60 +
54 61 return "解封杀成功"
55 62 end
56 63  
... ... @@ -63,6 +70,7 @@ function _M.gmmsg(role, pms)
63 70 skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd)
64 71 end)
65 72 end
  73 + role:log("gm_action", {desc = "gmmsg", text1 = pms.pm1, key1 = pms.sender})
66 74  
67 75 return "指令成功"
68 76 end
... ... @@ -74,6 +82,8 @@ function _M.silent(role, pms)
74 82 return "解禁言成功"
75 83 end
76 84 role:updateProperty({field = "silent", value = specTime({hour = 0}, skynet.timex()) + pm1 * 86400})
  85 +
  86 + role:log("gm_action", {desc = "silent", int1 = pms.pm1, key1 = pms.sender})
77 87 return "禁言成功"
78 88 end
79 89  
... ... @@ -83,9 +93,11 @@ local helpDes = {{&quot;描述&quot;, &quot;指令&quot;, &quot;参数1&quot;, &quot;参数2&quot; ,&quot;参数3&quot;}}
83 93 table.insert(helpDes, {"获得角色" , "hero", "角色类型"})
84 94 function _M.hero(role, pms)
85 95 local heroType = tonum(pms.pm1)
86   - if not role:addHero({type = heroType}) then
  96 + if not role:addHero({type = heroType, log = {desc = "gm"}}) then
87 97 return "失败"
88 98 end
  99 +
  100 + role:log("gm_action", {desc = "hero", int1 = heroType, key1 = pms.sender})
89 101 return "成功"
90 102 end
91 103  
... ... @@ -117,6 +129,9 @@ function _M.herol(role, pms)
117 129 addLevel = math.min(hero:getMaxLevel() - hero:getProperty("level"), addLevel)
118 130 hero:updateProperty({field = "level", delta = addLevel})
119 131 role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")})
  132 +
  133 + role:log("gm_action", {desc = "herol", int1 = heroType, int2 = addLevel, key1 = pms.sender})
  134 +
120 135 return "成功"
121 136 end
122 137  
... ... @@ -127,6 +142,9 @@ function _M.herola(role, pms)
127 142 for _, hero in pairs(role.heros) do
128 143 _M.herol(role, {pm1 = hero:getProperty("type"), pm2 = addLevel})
129 144 end
  145 +
  146 + role:log("gm_action", {desc = "herola", int1 = addLevel, key1 = pms.sender})
  147 +
130 148 return "成功"
131 149 end
132 150  
... ... @@ -136,7 +154,8 @@ function _M.equip(role, pms)
136 154 local typ = tonum(pms.pm1)
137 155 local level = tonum(pms.pm2)
138 156 local count = tonum(pms.pm3)
139   - role:addEquip({type = typ,level = level,count = count})
  157 + role:addEquip(typ, level, count, {log = {desc = "gm"}})
  158 + role:log("gm_action", {desc = "equip", int1 = typ, int2 = level, long1 = count, key1 = pms.sender})
140 159 return "成功"
141 160 end
142 161  
... ... @@ -144,7 +163,9 @@ table.insert(helpDes, {&quot;获得零件&quot; , &quot;rune&quot;, &quot;零件类型&quot;, &quot;零件id&quot;})
144 163 function _M.rune(role, pms)
145 164 local typ = tonum(pms.pm1)
146 165 local id = tonum(pms.pm2)
147   - local result = role:addRune({type = typ,id = id})
  166 + local result = role:addRune({type = typ,id = id, log = {desc = "gm"}})
  167 + role:log("gm_action", {desc = "rune", int1 = typ, int2 = id, key1 = pms.sender})
  168 +
148 169 return result
149 170 end
150 171  
... ... @@ -165,6 +186,9 @@ function _M.fb(role, pms) -- 直接通关
165 186 passCarbon[carbonId] = 1
166 187 addPre(carbonId)
167 188 role:updateProperty({field = "hangPass", value = passCarbon})
  189 +
  190 + role:log("gm_action", {desc = "fb", int1 = carbonId, key1 = pms.sender})
  191 +
168 192 role:checkTaskEnter("HangPass", {id = carbonId})
169 193 return "成功"
170 194 end
... ... @@ -187,6 +211,9 @@ function _M.fbc(role, pms) -- 直接通关
187 211 role:updateProperty({field = "hangInfo", value = {}})
188 212 role:updateProperty({field = "hangPass", value = passCarbon})
189 213 role:checkTaskEnter("HangPass", {id = carbonId})
  214 +
  215 + role:log("gm_action", {desc = "fbc", int1 = carbonId, key1 = pms.sender})
  216 +
190 217 return "成功"
191 218 end
192 219  
... ... @@ -217,7 +244,10 @@ table.insert(helpDes, {&quot;玩家经验&quot;, &quot;exp&quot;, &quot;经验&quot;})
217 244 function _M.exp(role, pms)
218 245 local exp = tonum(pms.pm1)
219 246 exp = math.floor(math.max(exp, 0))
220   - role:addPlayExp(exp)
  247 + role:addPlayExp(exp, {log = {desc = "gm"}})
  248 +
  249 + role:log("gm_action", {desc = "exp", int1 = exp, key1 = pms.sender})
  250 +
221 251 return "成功"
222 252 end
223 253  
... ... @@ -236,35 +266,35 @@ function _M.get(role, pms)
236 266 reward[id] = data.number
237 267 end
238 268 end
239   - role:award(reward)
  269 + role:award(reward, {log = {desc = "gm"}})
240 270 elseif pms.pm1 == "EQUIP" then
241 271 for itemId = 7000 , 8000 do
242 272 if csvdb["itemCsv"][itemId] then
243   - role:award({[itemId] = 100})
  273 + role:award({[itemId] = 100}, {log = {desc = "gm"}})
244 274 end
245 275 end
246 276 elseif pms.pm1 == "RUNE" then
247 277 for itemId = 2000 , 3000 do
248 278 if csvdb["itemCsv"][itemId] then
249   - role:award({[itemId] = 1})
  279 + role:award({[itemId] = 1}, {log = {desc = "gm"}})
250 280 end
251 281 end
252 282 elseif pms.pm1 == "FRAG" then
253 283 for itemId = 100 , 400 do
254 284 if csvdb["itemCsv"][itemId] then
255   - role:award({[itemId] = 100})
  285 + role:award({[itemId] = 100}, {log = {desc = "gm"}})
256 286 end
257 287 end
258 288 elseif pms.pm1 == "FOOD" then
259 289 for itemId = 4000 , 5000 do
260 290 if csvdb["itemCsv"][itemId] then
261   - role:award({[itemId] = 100})
  291 + role:award({[itemId] = 100}, {log = {desc = "gm"}})
262 292 end
263 293 end
264 294 elseif pms.pm1 == "HERO" then
265 295 for itemId = 400 , 700 do
266 296 if csvdb["itemCsv"][itemId] then
267   - role:award({[itemId] = 1})
  297 + role:award({[itemId] = 1}, {log = {desc = "gm"}})
268 298 end
269 299 end
270 300 else
... ... @@ -273,7 +303,8 @@ function _M.get(role, pms)
273 303 return "物品不存在"
274 304 end
275 305 local count = tonum(pms.pm2, 1)
276   - role:award({[itemId] = count})
  306 + role:award({[itemId] = count}, {log = {desc = "gm"}})
  307 + role:log("gm_action", {desc = "get", int1 = itemId, int2 = count, key1 = pms.sender})
277 308 end
278 309 return "成功"
279 310 end
... ... @@ -287,7 +318,7 @@ function _M.advc(role, pms)
287 318 for itemId, count in pairs(reward) do
288 319 reward[itemId] = math.ceil(count * globalCsv.adv_fail_reward_ratio / 100) -- 奖励相当于失败
289 320 end
290   - role:award(reward)
  321 + role:award(reward, {log = {desc = "gm"}})
291 322  
292 323 role:updateProperties({
293 324 advInfo = {},
... ... @@ -297,6 +328,9 @@ function _M.advc(role, pms)
297 328 advAFWear = {},
298 329 }, notNotify)
299 330 role.advData = nil
  331 +
  332 + role:log("gm_action", {desc = "advc", key1 = pms.sender})
  333 +
300 334 return "成功"
301 335 end
302 336  
... ... @@ -304,6 +338,9 @@ table.insert(helpDes, {&quot;冒险次数恢复&quot;, &quot;advf&quot;})
304 338 function _M.advf(role, pms)
305 339 role.dailyData:updateProperty({field = "advC", value = 0})
306 340 role.dailyData:updateProperty({field = "advElC", value = 0})
  341 +
  342 + role:log("gm_action", {desc = "advf", key1 = pms.sender})
  343 +
307 344 return "成功"
308 345 end
309 346  
... ... @@ -331,6 +368,7 @@ function _M.adv(role, pms)
331 368 addPre(chapterId)
332 369 role:updateProperty({field = "advPass", value = advPass})
333 370 end
  371 + role:log("gm_action", {desc = "advf", int1 = chapterId, int2 = layer, key1 = pms.sender})
334 372  
335 373 return "成功"
336 374 end
... ... @@ -355,6 +393,7 @@ function _M.advt(role, pms)
355 393 advData.level = layer
356 394  
357 395 advData:saveDB()
  396 + role:log("gm_action", {desc = "advt", int1 = chapterId, int2 = layer, key1 = pms.sender})
358 397  
359 398 return "成功"
360 399 end
... ... @@ -363,6 +402,9 @@ table.insert(helpDes, {&quot;冒险队等级增加&quot;, &quot;advl&quot;, &quot;经验&quot;})
363 402 function _M.advl(role, pms)
364 403 local exp = tonum(pms.pm1)
365 404 role:addAdvLvExp(math.max(0, exp))
  405 +
  406 + role:log("gm_action", {desc = "advl", int1 = exp, key1 = pms.sender})
  407 +
366 408 return "成功"
367 409 end
368 410  
... ... @@ -376,7 +418,8 @@ function _M.advcl(role, pms)
376 418 end
377 419 advData.battle.player:addExp(exp)
378 420 advData:saveDB()
379   -
  421 + role:log("gm_action", {desc = "advcl", int1 = exp, key1 = pms.sender})
  422 +
380 423 return "成功"
381 424 end
382 425  
... ... @@ -385,6 +428,8 @@ function _M.idlec(role, pms)
385 428 role:updateProperty({field = "hangTeam", value = {}})
386 429 role:updateProperty({field = "hangInfo", value = {}})
387 430 role:updateProperty({field = "hangBag", value = {}})
  431 + role:log("gm_action", {desc = "idlec", key1 = pms.sender})
  432 +
388 433 role.advData = nil
389 434 return "成功"
390 435 end
... ... @@ -408,11 +453,13 @@ function _M.advit(role, pms)
408 453 local itemId = tonum(pms.pm1)
409 454 local count = tonum(pms.pm2)
410 455 reward[itemId] = count
  456 +
  457 + role:log("gm_action", {desc = "advit", int1 = itemId, int2 = count, key1 = pms.sender})
411 458 end
412 459  
413 460  
414 461 local adv = role:getAdvData()
415   - adv:award(reward)
  462 + adv:award(reward, {log = {desc = "gm"}})
416 463 return "成功"
417 464 end
418 465  
... ... @@ -422,6 +469,9 @@ function _M.tower(role, pms)
422 469 local level = tonum(pms.pm1, 1)
423 470 if not csvdb["tower_battleCsv"][level] then return "不存在" end
424 471 role:updateProperty({field = "towerInfo", value = {c = globalCsv.tower_count_limit, l = level}})
  472 +
  473 + role:log("gm_action", {desc = "tower", int1 = level, key1 = pms.sender})
  474 +
425 475 return "成功"
426 476 end
427 477  
... ... @@ -439,6 +489,9 @@ function _M.email(role, pms)
439 489 attachments = id == 0 and reward or nil,
440 490 rewardPms = id ~= 0 and reward or nil,
441 491 })
  492 +
  493 + role:log("gm_action", {desc = "email", int1 = id, key1 = pms.sender})
  494 +
442 495 return "成功"
443 496 end
444 497  
... ... @@ -455,6 +508,8 @@ function _M.cguide(role, pms)
455 508 elseif id == 2 then
456 509 role:updateProperty({field = "funcGuide", value = ""})
457 510 end
  511 +
  512 + role:log("gm_action", {desc = "cguide", int1 = id, key1 = pms.sender})
458 513 return "成功"
459 514 end
460 515  
... ...
src/actions/HangAction.lua
... ... @@ -102,6 +102,8 @@ function _M.startRpc( agent, data )
102 102 end
103 103 role:updateProperty({field = "hangInfo", value = hangInfo})
104 104  
  105 + role:log("hang_action", {desc = "startHang", int1 = carbonId})
  106 +
105 107 SendPacket(actionCodes.Hang_startRpc, '')
106 108 return true
107 109 end
... ... @@ -184,12 +186,15 @@ function _M.endBattleRpc(agent, data)
184 186 for itemId, count in pairs(carbonData.item_clear:toNumMap()) do
185 187 reward[itemId] = count
186 188 end
187   - reward = role:award(reward)
  189 + reward = role:award(reward, {log = {desc = "hangBattle", int1 = carbonId}})
188 190  
189 191 role:checkTaskEnter("HangPass", {id = carbonId})
190 192 end
191 193 hangInfo.key = nil
192 194 role:updateProperty({field = "hangInfo", value = hangInfo})
  195 +
  196 + role:log("hang_action", {desc = "hangBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = carbonId})
  197 +
193 198 SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({
194 199 starNum = msg.starNum,
195 200 reward = reward,
... ... @@ -232,7 +237,7 @@ function _M.getRewardRpc(agent , data)
232 237 checkReward(role)
233 238 local items = role:getProperty("hangBag")
234 239 if not next(items) then return end
235   - local reward = role:award(items)
  240 + local reward = role:award(items, {log = {desc = "hangReward"}})
236 241 table.clear(items)
237 242 local hangInfo = role:getProperty("hangInfo")
238 243 local nowTime = skynet.timex()
... ... @@ -323,7 +328,7 @@ function _M.quickRpc(agent , data)
323 328 if not costs[curCount] then return end
324 329 if costs[curCount] > 0 then
325 330 if not role:checkItemEnough({[ItemId.Diamond] = costs[curCount]}) then return end
326   - role:costItems({[ItemId.Diamond] = costs[curCount]})
  331 + role:costItems({[ItemId.Diamond] = costs[curCount]}, {log = {desc = "quickHang", int1 = hangInfo.carbonId}})
327 332 end
328 333  
329 334 role.dailyData:updateProperty({field = "hangQC", value = curCount})
... ... @@ -345,7 +350,7 @@ function _M.quickRpc(agent , data)
345 350 reward[cur[1]] = (reward[cur[1]] or 0) + cur[2]
346 351 end
347 352  
348   - reward = role:award(reward)
  353 + reward = role:award(reward, {log = {desc = "quickHang", int1 = hangInfo.carbonId}})
349 354 if reward[ItemId.Gold] then
350 355 role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]})
351 356 end
... ... @@ -393,16 +398,16 @@ function _M.buyBonusCountRpc(agent, data)
393 398 local count = msg.count
394 399 local btype = msg.type
395 400  
396   - if math.illegalNum(btype, 1, 2) then return 0 end
  401 + if not TimeReset["DailyBattle" .. btype] then return end
397 402  
398 403 local bonusC = role.dailyData:getProperty("bonusC")
399 404 bonusC[btype] = bonusC[btype] or {c = 0, b = 0}
400 405 local lastCount = globalCsv.bonus_daily_buy_count - bonusC[btype]["b"]
401 406 if math.illegalNum(count, 1, lastCount) then return 1 end
402 407  
403   - if not role:checkItemEnough({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}) then return end
  408 + if not role:checkItemEnough({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}) then return 2 end
404 409  
405   - role:costItems({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count})
  410 + role:costItems({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}, {log = {desc = "buyBonusCount", short1 = btype, int1 = count}})
406 411 bonusC[btype]["b"] = bonusC[btype]["b"] + count
407 412 bonusC[btype]["c"] = bonusC[btype]["c"] - count
408 413  
... ... @@ -457,10 +462,12 @@ function _M.endBonusBattleRpc(agent, data)
457 462  
458 463 local reward
459 464 if starNum and starNum > 0 then
460   - reward = role:award(bonusData.reward)
  465 + reward = role:award(bonusData.reward, {log = {desc = "bonusBattle", int1 = id}})
461 466 role:checkTaskEnter("BonusPass", {id = id})
462 467 end
463 468  
  469 + role:log("hang_action", {desc = "bonusBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id})
  470 +
464 471 SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({
465 472 starNum = starNum,
466 473 reward = reward}))
... ...
src/actions/HeroAction.lua
... ... @@ -27,9 +27,11 @@ function _M.levelUpRpc( agent, data )
27 27 local curData = csvdb["unit_expCsv"][hero:getProperty("level")]
28 28 local cost = {[ItemId.Exp] = curData.exp, [ItemId.Gold] = curData.gold}
29 29 if not role:checkItemEnough(cost) then return 3 end
30   - role:costItems(cost)
  30 + role:costItems(cost, {log = {desc = "heroLevelUp", int1 = msg.id, int2 = hero:getProperty("type")}})
31 31 hero:updateProperty({field = "level", delta = 1})
32 32  
  33 + hero:log({desc = "levelUp", int1 = hero:getProperty("level")})
  34 +
33 35 role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")})
34 36 SendPacket(actionCodes.Hero_levelUpRpc, '')
35 37 return true
... ... @@ -46,9 +48,11 @@ function _M.breakRpc( agent, data )
46 48 local curData = csvdb["unit_breakCsv"][hero:getProperty("breakL")]
47 49 local cost = {[ItemId.BreakCost] = curData.cost, [ItemId.Gold] = curData.gold}
48 50 if not role:checkItemEnough(cost) then return 4 end
49   - role:costItems(cost)
  51 + role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}})
50 52 hero:updateProperty({field = "breakL", delta = 1})
51 53  
  54 + hero:log({desc = "break", int1 = hero:getProperty("breakL")})
  55 +
52 56 SendPacket(actionCodes.Hero_breakRpc, '')
53 57 return true
54 58 end
... ... @@ -82,7 +86,7 @@ function _M.wakeRpc(agent, data)
82 86 end
83 87 end
84 88  
85   - role:costItems(cost)
  89 + role:costItems(cost, {log = {desc = "heroWake", int1 = msg.id, int2 = hero:getProperty("type")}})
86 90 for k,v in pairs(skills) do
87 91 hero:updateProperty({field = "skillL", value = hero:getProperty("skillL"):setv(k, v)})
88 92 end
... ... @@ -93,6 +97,8 @@ function _M.wakeRpc(agent, data)
93 97 if curLevel == 4 then -- 解锁cg
94 98 role:checkTaskEnter("WakeCG", {heroType = typ})
95 99 end
  100 + hero:log({desc = "wake", int1 = hero:getProperty("wakeL")})
  101 +
96 102  
97 103 SendPacket(actionCodes.Hero_wakeRpc, '')
98 104 return true
... ... @@ -109,6 +115,8 @@ function _M.skillUpRpc(agent, data)
109 115 if hero:getLSPoint() <= 0 or curLevel >= #hero:getSkillData(index) then return end
110 116 hero:updateProperty({field = "skillL", value = hero:getProperty("skillL"):setv(index, curLevel + 1)})
111 117  
  118 + hero:log({desc = "skillUp", int1 = index, int2 = curLevel + 1})
  119 +
112 120 SendPacket(actionCodes.Hero_skillUpRpc, '')
113 121 return true
114 122 end
... ... @@ -141,7 +149,7 @@ function _M.talentRpc(agent, data)
141 149 cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][k]] = v
142 150 end
143 151 if not role:checkItemEnough(cost) then return 6 end
144   - role:costItems(cost)
  152 + role:costItems(cost, {log = {desc = "heroTalent", int1 = msg.id, int2 = hero:getProperty("type")}})
145 153 talent = talent:incrv(index, 1)
146 154  
147 155 --是否进阶
... ... @@ -167,6 +175,8 @@ function _M.talentRpc(agent, data)
167 175  
168 176 role:checkTaskEnter("HeroTalent", {heroType = hero:getProperty("type"), alv = aheadLevel})
169 177  
  178 + hero:log({desc = "talent", int1 = index, int2 = talent:getv(index, 0)})
  179 +
170 180 SendPacket(actionCodes.Hero_talentRpc, '')
171 181 return true
172 182 end
... ... @@ -491,8 +501,8 @@ function _M.createHeroRpc(agent, data)
491 501 if hero:getProperty("type") == heroType then return end
492 502 end
493 503  
494   - role:costItems({[heroType] = cost})
495   - role:award({[heroType + ItemStartId.Hero] = 1})
  504 + role:costItems({[heroType] = cost}, {log = {desc = "createHero"}})
  505 + role:award({[heroType + ItemStartId.Hero] = 1}, {log = {desc = "createHero"}})
496 506  
497 507 SendPacket(actionCodes.Hero_createHeroRpc, "")
498 508 return true
... ... @@ -522,12 +532,12 @@ function _M.referEquipsRpc(agent, data)
522 532 if equips[typ] == 0 then
523 533 curEquip = curEquip:delk(typ)
524 534 else
525   - role:addEquip(typ, equips[typ], -1) -- 穿上
  535 + role:addEquip(typ, equips[typ], -1, {log = {desc = "refer"}}) -- 穿上
526 536 curEquip = curEquip:setv(typ, equips[typ])
527 537 end
528 538  
529 539 if cur ~= 0 then
530   - role:addEquip(typ, cur, 1) -- 脱掉
  540 + role:addEquip(typ, cur, 1, {log = {desc = "refer"}}) -- 脱掉
531 541 end
532 542 end
533 543 end
... ... @@ -602,8 +612,8 @@ function _M.createHeroRandomRpc(agent, data)
602 612 else
603 613 reward = {[temp[1] + ItemStartId.Hero] = 1}
604 614 end
605   - role:costItems({[itemId] = cost})
606   - reward = role:award(reward)
  615 + role:costItems({[itemId] = cost}, {log = {desc = "createHeroRandom"}})
  616 + reward = role:award(reward, {log = {desc = "createHeroRandom"}})
607 617 SendPacket(actionCodes.Hero_createHeroRandomRpc, MsgPack.pack({reward = reward}))
608 618 return true
609 619 end
... ... @@ -668,11 +678,12 @@ function _M.getResetRewardRpc(agent, data)
668 678 hero:updateProperty({field = "level", value = level})
669 679 hero:updateProperty({field = "breakL", value = breakL})
670 680 hero:updateProperty({field = "talent", value = ""})
  681 + hero:log({desc = "resetHero"})
671 682  
672 683 for itemId, count in pairs(reward) do
673 684 reward[itemId] = math.floor(count * globalCsv.unit_back_discount)
674 685 end
675   - reward = role:award(reward)
  686 + reward = role:award(reward, {log = {desc = "resetHero", int1 = msg.id, int2 = hero:getProperty("type")}})
676 687  
677 688 SendPacket(actionCodes.Hero_getResetRewardRpc, MsgPack.pack({reward = reward}))
678 689 return true
... ... @@ -784,7 +795,7 @@ function _M.drawHeroRpc(agent, data)
784 795 end,
785 796 }
786 797  
787   - role:costItems(cost)
  798 + role:costItems(cost, {log = {desc = "drawHero", short1 = pool}})
788 799 local floorHeroCount = role:getProperty("floorHero")[pool] or 0
789 800  
790 801 local ssrCount = 0
... ... @@ -823,10 +834,10 @@ function _M.drawHeroRpc(agent, data)
823 834 local fragId = itemData.id - ItemStartId.Hero
824 835 local heroData = csvdb["unitCsv"][fragId]
825 836 local count = globalCsv.draw_unit_tofragment[heroData.rare] * temp[2]
826   - role:award({[fragId] = count})
  837 + role:award({[fragId] = count}, {log = {desc = "drawHero", short1 = pool}})
827 838 table.insert(reward, {id = fragId, count = count, from = temp[1], fcount = temp[2]})
828 839 else
829   - role:award({[temp[1]] = temp[2]})
  840 + role:award({[temp[1]] = temp[2]}, {log = {desc = "drawHero", short1 = pool}})
830 841 table.insert(reward, {id = temp[1], count = temp[2]})
831 842 end
832 843 end
... ... @@ -847,7 +858,7 @@ function _M.drawHeroRpc(agent, data)
847 858 if ssrCount > 0 then
848 859 role:checkTaskEnter("DrawSSR", {count = ssrCount})
849 860 end
850   -
  861 + role:log("hero_action", {desc = "drawHero", short1 = pool, int1 = drawCount[drawType]})
851 862 SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组
852 863 return true
853 864 end
... ... @@ -869,13 +880,13 @@ function _M.repayHeroRpc(agent, data)
869 880 local fragId = itemData.id - ItemStartId.Hero
870 881 local heroData = csvdb["unitCsv"][fragId]
871 882 local count = globalCsv.draw_unit_tofragment[heroData.rare]
872   - role:award({[fragId] = count})
  883 + role:award({[fragId] = count}, {log = {desc = "heroRepay"}})
873 884 reward = {id = fragId, count = count, from = id, fcount = 1}
874 885 else
875   - role:award({[id] = 1})
  886 + role:award({[id] = 1}, {log = {desc = "heroRepay"}})
876 887 reward = {id = id, count = 1}
877 888 end
878   -
  889 + role:log("hero_action", {desc = "heroRepay"})
879 890 SendPacket(actionCodes.Hero_repayHeroRpc, MsgPack.pack({reward = reward}))
880 891 return true
881 892 end
... ...
src/actions/HttpAction.lua
... ... @@ -179,7 +179,11 @@ function _M.gm_action(query)
179 179 return "角色不存在"
180 180 end
181 181 role:loadAll()
182   - return gmFuncs[query.cmd](role, query)
  182 + role:startActionUcode()
  183 + local status = gmFuncs[query.cmd](role, query)
  184 + role:endActionUcode()
  185 +
  186 + return status
183 187 end
184 188  
185 189 function _M.broadcast(query)
... ...
src/actions/PvpAction.lua
... ... @@ -235,8 +235,8 @@ function _M.buyCountRpc(agent, data)
235 235  
236 236 local cost = {[ItemId.Diamond] = globalCsv.pvp_buy_cost * count}
237 237 if not role:checkItemEnough(cost) then return 2 end
238   - role:costItems(cost)
239   - role:award({[ItemId.PvpKey] = count})
  238 + role:costItems(cost, {log = {desc = "buyPvpKey"}})
  239 + role:award({[ItemId.PvpKey] = count}, {log = {desc = "buyPvpKey"}})
240 240  
241 241 SendPacket(actionCodes.Pvp_buyCountRpc, '')
242 242 return true
... ... @@ -287,7 +287,7 @@ function _M.startBattleRpc(agent, data)
287 287 if pvpFree >= globalCsv.pvp_battle_free_count then
288 288 local cost = {[ItemId.PvpKey] = 1}
289 289 if not role:checkItemEnough(cost) then return 5 end
290   - role:costItems(cost)
  290 + role:costItems(cost, {log = {desc = "startPvp", short1 = 1}})
291 291 else
292 292 role.dailyData:updateProperty({field = "pvpFree", delta = 1})
293 293 end
... ... @@ -296,6 +296,9 @@ function _M.startBattleRpc(agent, data)
296 296 _pvpStartBattleCacheC = {idx = idx, key = key, revenge = revenge}
297 297  
298 298 role:checkTaskEnter("PvpBattle")
  299 +
  300 +
  301 + role:log("pvp_action", {desc = "startBattle", short1 = 1, int1 = revenge and 1 or 0})
299 302 end
300 303  
301 304 SendPacket(actionCodes.Pvp_startBattleRpc, MsgPack.pack({matchInfo = matchInfo, key = key, result = result, wait = wait}))
... ... @@ -331,7 +334,7 @@ function _M.endBattleRpc(agent, data)
331 334 if not match then return end
332 335  
333 336 local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpBonus, true)
334   - local reward = role:award({[temp[1]] = temp[2]})
  337 + local reward = role:award({[temp[1]] = temp[2]}, {log = {desc = "pvpBattleC"}})
335 338 local myScore, matchScore, oldmyScore, oldMatchScore, myRank, oldMyRank = role:changePvpScoreCommon(match.t == 1 and match.id or -1, isWin)
336 339  
337 340 _pvpBattleInfoCacheC = {} --重新发阵容了 没毛病
... ... @@ -384,6 +387,8 @@ function _M.endBattleRpc(agent, data)
384 387 if isWin then
385 388 role:checkTaskEnter("PvpWin", {score = myScore})
386 389 end
  390 +
  391 + role:log("pvp_action", {desc = "battleEnd", short1 = 1, int1 = isWin and 1 or 0, int2 = revenge and 1 or 0})
387 392  
388 393 SendPacket(actionCodes.Pvp_endBattleRpc, MsgPack.pack({
389 394 reward = reward,
... ... @@ -483,7 +488,7 @@ function _M.startBattleHRpc(agent, data)
483 488 if pvpFreeH >= globalCsv.pvp_battle_free_count_high then
484 489 local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost}
485 490 if not role:checkItemEnough(cost) then return 5 end
486   - role:costItems(cost)
  491 + role:costItems(cost, {log = {desc = "startPvp", short1 = 2}})
487 492 else
488 493 role.dailyData:updateProperty({field = "pvpFreeH", delta = 1})
489 494 end
... ... @@ -508,6 +513,9 @@ function _M.startBattleHRpc(agent, data)
508 513 }
509 514  
510 515 role:checkTaskEnter("PvpBattle")
  516 +
  517 + role:log("pvp_action", {desc = "startBattle", short1 = 2, int1 = revenge and 1 or 0})
  518 +
511 519 end
512 520  
513 521 SendPacket(actionCodes.Pvp_startBattleHRpc, MsgPack.pack({
... ... @@ -607,7 +615,7 @@ function _M.endBattleHRpc(agent, data)
607 615  
608 616 -- 战斗结束了发奖
609 617 local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpgroupBonus, true)
610   - local reward = role:award({[temp[1]] = temp[2]})
  618 + local reward = role:award({[temp[1]] = temp[2]}, {log = {desc = "pvpBattleH"}})
611 619 local myScore, matchScore, oldmyScore, oldMatchScore, myRank, oldMyRank = 0, 0, 0, 0, 0, 0
612 620 if role:isTimeResetOpen(TimeReset.PvpHight) then
613 621 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)
675 683 if isWin then
676 684 role:checkTaskEnter("PvpWin", {score = myScore})
677 685 end
  686 + role:log("pvp_action", {desc = "battleEnd", short1 = 2, int1 = isWin and 1 or 0, int2 = revenge and 1 or 0})
678 687  
679 688 SendPacket(actionCodes.Pvp_endBattleHRpc, MsgPack.pack({
680 689 reward = reward,
... ... @@ -829,7 +838,8 @@ function _M.highDivisionGiftRpc(agent, data)
829 838 pvpHGift = {},
830 839 })
831 840  
832   - local reward = role:award(newReward)
  841 + local reward = role:award(newReward, {log = {desc = "pvpDivisionH"}})
  842 + role:log("pvp_action", {desc = "pvpDivisionH"})
833 843  
834 844 SendPacket(actionCodes.Pvp_highDivisionGiftRpc, MsgPack.pack({reward = reward}))
835 845 return true
... ... @@ -853,7 +863,7 @@ function _M.shopBuyRpc(agent, data)
853 863  
854 864 if not role:checkItemEnough({[ItemId.PvpCoin] = csvData.cost * count}) then return end
855 865  
856   - role:costItems({[ItemId.PvpCoin] = csvData.cost * count})
  866 + role:costItems({[ItemId.PvpCoin] = csvData.cost * count}, {log = {desc = "pvpShop", int1 = id, int2 = count}})
857 867 if csvData.limit > 0 then
858 868 role:changeUpdates({{type = "pvpShop", field = id, value = (pvpShop[id] or 0) + count}})
859 869 end
... ... @@ -862,8 +872,9 @@ function _M.shopBuyRpc(agent, data)
862 872 for id, c in pairs(gift) do
863 873 gift[id] = c * count
864 874 end
865   - local reward = role:award(gift)
  875 + local reward = role:award(gift, {log = {desc = "pvpShop", int1 = id, int2 = count}})
866 876  
  877 + role:log("pvp_action", {desc = "pvpShop", int1 = id, int2 = count})
867 878  
868 879 SendPacket(actionCodes.Pvp_shopBuyRpc, MsgPack.pack({reward = reward}))
869 880 return true
... ... @@ -953,9 +964,10 @@ function _M.crossBetRpc(agent, data)
953 964 if not role:isTimeResetOpen(TimeReset.PvpCross) then return end
954 965 if msg.idx ~= 1 and msg.idx ~= 2 then return end
955 966  
956   - local result = role:getCrossServerPvpBet(msg.idx)
  967 + local result = role:setCrossServerPvpBet(msg.idx)
957 968 if not result then return end
958   -
  969 +
  970 + role:log("pvp_action", {desc = "crossBet"})
959 971 SendPacket(actionCodes.Pvp_crossBetRpc, MsgPack.pack(result))
960 972 return true
961 973 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,8 +292,8 @@ function _M.createRpc(agent, data)
291 292 SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response))
292 293 return true
293 294 end
294   -
295   - newRole:award(globalCsv.birthItem)
  295 + newRole:startActionUcode()
  296 + newRole:award(globalCsv.birthItem, {log = {desc = "birth"}})
296 297 -- 欢迎邮件
297 298 redisproxy:insertEmail({roleId = roleId, emailId = 1})
298 299  
... ... @@ -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, {log = {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", {desc = "guide_new",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", {desc = "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", {desc = "guide_weak", int1 = funcIdx})
982 990 funcGuide = funcGuide:setv(funcIdx, value)
983 991 end
984 992 role:updateProperty({field = "funcGuide", value = funcGuide})
... ...
src/actions/StoreAction.lua
... ... @@ -15,7 +15,7 @@ function _M.rechargeRpc(agent , data)
15 15 rechargeF[id] = 1
16 16 role:updateProperty({field = "rechargeF", value = rechargeF})
17 17 end
18   - role:gainDiamond({count = diamondCount, isRecharge = true})
  18 + role:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}})
19 19 elseif dataSet.type == 1 then --月卡
20 20 return
21 21 elseif dataSet.type == 2 then -- 赛季通行证
... ... @@ -28,6 +28,8 @@ function _M.rechargeRpc(agent , data)
28 28 local rmb = dataSet.rmb
29 29 role:updateProperty({field = "rmbC", delta = rmb})
30 30  
  31 + role:log("role_action", {desc = "recharge", int1 = id})
  32 +
31 33 SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({diamond = diamondCount}))
32 34 return true
33 35 end
... ... @@ -57,7 +59,7 @@ function _M.dailyBuyRpc(agent , data)
57 59 return 3
58 60 end
59 61  
60   - if not role:costDiamond({count = cost * count}) then
  62 + if not role:costDiamond({count = cost * count}, {log = {desc = "dailyShop", int1 = id, int2 = count}}) then
61 63 return 4
62 64 end
63 65  
... ... @@ -65,7 +67,9 @@ function _M.dailyBuyRpc(agent , data)
65 67 dailySDC[id] = (dailySDC[id] or 0) + count
66 68 role.dailyData:updateProperty({field = "dailySDC", value = dailySDC})
67 69 end
68   - local reward = role:award(dataSet.gift)
  70 + local reward = role:award(dataSet.gift, {log = {desc = "dailyShop", int1 = id, int2 = count}})
  71 +
  72 + role:log("role_action", {desc = "dailyShop", int1 = id, int2 = count})
69 73  
70 74 SendPacket(actionCodes.Store_dailyBuyRpc, MsgPack.pack({reward = reward}))
71 75 return true
... ... @@ -92,13 +96,15 @@ function _M.dinerBuyRpc(agent , data)
92 96 role:updateProperty({field = "dinerS", value = dinerS})
93 97 end
94 98  
95   - role:costItems(cost)
  99 + role:costItems(cost, {log = {desc = "dinerShop", int1 = id, int2 = count}})
96 100  
97 101 local gift = {}
98 102 for _id, _count in pairs(dataSet.gift:toNumMap()) do
99 103 gift[_id] = _count * count
100 104 end
101   - local reward = role:award(gift)
  105 + local reward = role:award(gift, {log = {desc = "dinerShop", int1 = id, int2 = count}})
  106 +
  107 + role:log("role_action", {desc = "dinerShop", int1 = id, int2 = count})
102 108  
103 109 SendPacket(actionCodes.Store_dinerBuyRpc, MsgPack.pack({reward = reward}))
104 110 return true
... ...
src/actions/TowerAction.lua
... ... @@ -32,6 +32,7 @@ function _M.roleFormatRpc(agent , data)
32 32 towerTeam.leader = msg.leader
33 33 towerTeam.supports = supports
34 34  
  35 +
35 36 role:updateProperty({field = "towerF", value = towerTeam})
36 37 SendPacket(actionCodes.Tower_roleFormatRpc, '')
37 38 return true
... ... @@ -74,6 +75,9 @@ function _M.startBattleRpc(agent, data)
74 75  
75 76 role:updateProperty({field = "towerInfo", value = towerInfo})
76 77 role:checkTaskEnter("TowerBattle", {level = towerInfo.l})
  78 +
  79 + role:log("tower_action", {desc = "startBattle", int1 = id})
  80 +
77 81 SendPacket(actionCodes.Tower_startBattleRpc, '')
78 82 return true
79 83 end
... ... @@ -100,7 +104,7 @@ function _M.endBattleRpc(agent, data)
100 104 role:setTowerRank(towerInfo.l)
101 105  
102 106 towerInfo.l = towerInfo.l + 1
103   - reward = role:award(curTower.reward)
  107 + reward = role:award(curTower.reward, {log = {desc = "towerBattle", int1 = id}})
104 108 role:checkTaskEnter("TowerPass", {level = towerInfo.l - 1})
105 109 end
106 110  
... ... @@ -108,6 +112,9 @@ function _M.endBattleRpc(agent, data)
108 112 towerInfo.t = nextTime
109 113 towerInfo.k = nil
110 114 role:updateProperty({field = "towerInfo", value = towerInfo})
  115 +
  116 + role:log("tower_action", {desc = "startBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id})
  117 +
111 118 SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({reward = reward}))
112 119 return true
113 120 end
... ... @@ -124,12 +131,14 @@ function _M.bugCountRpc(agent, data)
124 131 cost[k] = v * needCount
125 132 end
126 133 if not role:checkItemEnough(cost) then return end
127   - role:costItems(cost)
  134 + role:costItems(cost, {log = {desc = "towerCount"}})
128 135 curCount = globalCsv.tower_count_limit
129 136 end
130 137 towerInfo.c = curCount
131 138 towerInfo.t = nextTime
132 139 role:updateProperty({field = "towerInfo", value = towerInfo})
  140 + role:log("tower_action", {desc = "bugCount"})
  141 +
133 142 SendPacket(actionCodes.Tower_bugCountRpc, '')
134 143 return true
135 144 end
... ...
src/adv/Adv.lua
... ... @@ -23,6 +23,17 @@ function Adv:ctor(owner)
23 23 self:initByInfo(self.owner:getProperty("advInfo"))
24 24 end
25 25  
  26 +function Adv:log(contents)
  27 + contents = contents or {}
  28 + if contents["cint1"] or contents["cint2"] or contents["cint3"] then
  29 + print("advLog error log have cint1 or cint2 or cint3 ", debug.traceback())
  30 + end
  31 + contents["cint1"] = self.chapterId
  32 + contents["cint2"] = self.level
  33 +
  34 + self.owner:log("adv_action", contents)
  35 +end
  36 +
26 37 --初始化adv 信息
27 38 function Adv:initByInfo(advInfo)
28 39 if not next(advInfo) then return end --还没有 开始新地图
... ... @@ -84,6 +95,7 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt
84 95  
85 96 if isEnter then -- 把 支援效果初始化为易用用的形式
86 97 self:initSupport(support or {})
  98 + self.owner:setProperty("advLimit", {}) -- 清掉 Limit
87 99 end
88 100  
89 101 -- 随机出地图
... ... @@ -244,7 +256,7 @@ end
244 256 function Adv:activeSomeSupport()
245 257 -- 奖励物品
246 258 if self.support[1] then
247   - self:award(self.support[1])
  259 + self:award(self.support[1], {log = {desc = "support"}})
248 260 self.support[1] = nil
249 261 end
250 262  
... ... @@ -274,7 +286,7 @@ function Adv:activeSomeSupport()
274 286 end
275 287 for i = 1, math.min(self.support[6], #pool) do
276 288 local idx = math.randomInt(1, #pool)
277   - self:award({[pool[idx]] = 1})
  289 + self:award({[pool[idx]] = 1}, {log = {desc = "support"}})
278 290 table.remove(pool, idx)
279 291 end
280 292 self.support[6] = nil
... ... @@ -317,7 +329,7 @@ end
317 329 -- 强制结束
318 330 function Adv:forceOver(notNotify)
319 331 if self:isRunning() then
320   - self:clear()
  332 +
321 333 local advTeam = self.owner:getProperty("advTeam")
322 334 advTeam.player = nil
323 335  
... ... @@ -325,8 +337,9 @@ function Adv:forceOver(notNotify)
325 337 for itemId, count in pairs(reward) do
326 338 reward[itemId] = math.ceil(count * globalCsv.adv_fail_reward_ratio / 100) -- 奖励相当于失败
327 339 end
328   - self.owner:award(reward)
  340 + self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}})
329 341  
  342 + self:clear()
330 343 self.owner:updateProperties({
331 344 advInfo = {},
332 345 advTeam = advTeam,
... ... @@ -355,7 +368,7 @@ function Adv:checkAdvUnlock(utype, value)
355 368 end
356 369 end
357 370 if next(reward) then
358   - self.owner:award(reward)
  371 + self.owner:award(reward, {log = {desc = "advUnlock", int1 = self.chapterId}})
359 372 end
360 373 end
361 374  
... ... @@ -365,7 +378,7 @@ function Adv:clearAdvUnlockCache()
365 378 reward[itemId] = 1
366 379 end
367 380 if next(reward) then
368   - self.owner:award(reward)
  381 + self.owner:award(reward, {log = {desc = "advUnlock", int1 = self.chapterId}})
369 382 end
370 383 self.cacheUnlock = {}
371 384 end
... ... @@ -427,6 +440,21 @@ function Adv:awardArtifact(id, params)
427 440 if self:isHaveArtifact(id) then return end
428 441 self.owner:changeUpdates({{type = "advAFGet", field = id, value = 1}}, params.notNotify)
429 442 self:checkAchievement(Adv.AchievType.GetMWeapon, 1, id)
  443 +
  444 +
  445 + if params.log then
  446 + local log = clone(params.log)
  447 + if log["cint1"] or log["cint2"] or log["cint3"] then
  448 + print("awardArtifact error log have cint1 or cint2 or cint3 ", debug.traceback())
  449 + end
  450 + log["cint1"] = self.chapterId
  451 + log["cint2"] = self.level
  452 + log["cint3"] = id
  453 + self.owner:log("in_artifact", log)
  454 + else
  455 + print("awardArtifact no log ", debug.traceback())
  456 + end
  457 +
430 458 self:pushBackEvent(AdvBackEventType.Artifact, {id = id})
431 459 end
432 460  
... ... @@ -513,6 +541,7 @@ function Adv:wearArtifact(slot, id)
513 541 else
514 542 id = nil
515 543 end
  544 + self:log({desc = "wearArtifact", int1 = id})
516 545  
517 546 self.owner:changeUpdates({{type = "advAFWear", field = slot, value = id}})
518 547 return true
... ... @@ -571,6 +600,9 @@ function Adv:artifactLevelUp(id, level)
571 600 end
572 601 if newLv == advAFGet[id] then return end
573 602  
  603 + self:log({desc = "artifactLevelUp", int1 = id, int2 = level})
  604 +
  605 +
574 606 local status = 0
575 607 if curWear[id] then -- 穿着呢
576 608 local oldData = csvdb["adv_artifactCsv"][id][advAFGet[id]]
... ... @@ -595,7 +627,7 @@ function Adv:waitChooseArtifact()
595 627 end
596 628 end
597 629 if #pool == 0 then
598   - self:award({[ItemId.AdvPoint] = 48})
  630 + self:award({[ItemId.AdvPoint] = 48}, {log = {desc = "chooseArtifact"}})
599 631 else
600 632 for i = 1, math.min(count, #pool) do
601 633 local idx = math.randomInt(1, #pool)
... ... @@ -613,7 +645,10 @@ end
613 645  
614 646 function Adv:chooseArtifact(index)
615 647 if not self.waitArtifact or not self.waitArtifact[index] then return end
616   - self:award({[self.waitArtifact[index]] = 1})
  648 + self:award({[self.waitArtifact[index]] = 1}, {log = {desc = "chooseArtifact"}})
  649 +
  650 + self:log({desc = "chooseArtifact", int1 = self.waitArtifact[index]})
  651 +
617 652 self.waitArtifact = nil
618 653  
619 654 -- 支援效果继续选择
... ... @@ -657,7 +692,7 @@ function Adv:over(success, rewardRatio, overType)
657 692 local scoreInfo = self.score
658 693  
659 694 local scoreReward = math.floor(score / chapterData.scoreAward)
660   - self.owner:award({[ItemId.OldCoin] = scoreReward})
  695 + self.owner:award({[ItemId.OldCoin] = scoreReward}, {log = {desc = "advOver", int1 = self.chapterId}})
661 696  
662 697 -- 被动技会影响奖励
663 698 self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level})
... ... @@ -671,7 +706,7 @@ function Adv:over(success, rewardRatio, overType)
671 706 reward[itemId] = math.ceil(count * rewardRatio / 100)
672 707 end
673 708 end
674   - reward = self.owner:award(reward)
  709 + reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}})
675 710  
676 711 if success then
677 712 self.owner:checkTaskEnter("AdvPass", {id = self.chapterId, level = self.level, score = score})
... ... @@ -699,6 +734,9 @@ function Adv:over(success, rewardRatio, overType)
699 734 end
700 735 end
701 736 self:clearAdvUnlockCache()
  737 +
  738 + self:log({desc = "over", short1 = success and 1 or 0, int1 = overType})
  739 +
702 740 self:clear()
703 741 self.owner:checkTaskEnter("AdvScore", {score = score})
704 742  
... ... @@ -788,6 +826,22 @@ function Adv:award(gift, params)
788 826 else
789 827 items = items:setv(itemId, nums)
790 828 end
  829 +
  830 + if params.log then
  831 + local log = clone(params.log)
  832 + if log["cint1"] or log["cint2"] or log["cint3"] then
  833 + print("addAdvItem error log have cint1 or cint2 or cint3 ", debug.traceback())
  834 + end
  835 + log["cint1"] = origin
  836 + log["cint2"] = math.abs(count)
  837 + if count >= 0 then
  838 + self.owner:log("in_adv", log)
  839 + else
  840 + self.owner:log("out_adv", log)
  841 + end
  842 + else
  843 + print("addAdvItem no log ", debug.traceback())
  844 + end
791 845 end
792 846 end
793 847 if items ~= oldItems then
... ... @@ -862,7 +916,7 @@ local function clickOut(self, room, block, params)
862 916 self.battle.player:triggerPassive(Passive.DOWN_LAYER)
863 917  
864 918 if curFloorData then
865   - self:backReward(self:award({[ItemId.AdvPoint] = curFloorData.exp}))
  919 + self:backReward(self:award({[ItemId.AdvPoint] = curFloorData.exp}, {log = {desc = "passReward", int1 = self.chapterId, int2 = self.level}}))
866 920 end
867 921 local isHaveRelay = self:isHaveRelay(self.level)
868 922  
... ... @@ -870,6 +924,7 @@ local function clickOut(self, room, block, params)
870 924 if isHaveRelay and not self.isRelay then
871 925 self:initByChapter(self.chapterId, self.level, true, true, true, false)
872 926 else
  927 + self:log({desc = "pass"})
873 928 self:initByChapter(self.chapterId, self.level + 1, true, true, false, false)
874 929 end
875 930 self:backNext() --下一关
... ... @@ -903,7 +958,7 @@ local function chooseCommon(self, room, block, chooseData, choose, tag)
903 958 end,
904 959 -- 拥有道具
905 960 [1] = function(_, itemId, count)
906   - if self:cost({[itemId] = count}, {}, true) then
  961 + if self:cost({[itemId] = count}, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}, true) then
907 962 return true
908 963 end
909 964 end,
... ... @@ -935,7 +990,7 @@ local function chooseCommon(self, room, block, chooseData, choose, tag)
935 990 end,
936 991 -- 提交一个物品
937 992 [5] = function (_, itemId, count)
938   - if self:cost({[itemId] = count}, {}) then
  993 + if self:cost({[itemId] = count}, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}) then
939 994 self:backCost({[itemId] = count})
940 995 return true
941 996 end
... ... @@ -985,7 +1040,7 @@ local function chooseCommon(self, room, block, chooseData, choose, tag)
985 1040 local item = csvdb["event_dropCsv"][effect[2]]["range"]:randWeight(true)
986 1041 reward[item[1]] = (reward[item[1]] or 0) + item[2]
987 1042 end
988   - self:backReward(self:award(reward, {}), {roomId = room.roomId, blockId = block.blockId})
  1043 + self:backReward(self:award(reward, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}), {roomId = room.roomId, blockId = block.blockId})
989 1044 end,
990 1045 [2] = function() --获得冒险buff
991 1046 local layer = effect[3] or 1
... ... @@ -1137,7 +1192,7 @@ local function clickDrop(self, room, block, params)
1137 1192 local reward = {}
1138 1193 if not block.event.item then return end
1139 1194 self.battle.player:triggerPassive(Passive.CLICK_DROP)
1140   - local reward = self:award({[block.event.item[1]] = block.event.item[2]})
  1195 + local reward = self:award({[block.event.item[1]] = block.event.item[2]}, {log = {desc = "clickDrop"}})
1141 1196 -- local reward = self:award({[5801] = 1})
1142 1197 block:clear()
1143 1198 self:backReward(reward, {roomId = room.roomId, blockId = block.blockId})
... ... @@ -1159,9 +1214,9 @@ local function clickTrader(self, room, block, params)
1159 1214 if not goodsData then return false, 5 end
1160 1215  
1161 1216 local costCount = math.ceil(goodsData.price * (block.event.shop[buyId][2] or 100) / 100)
1162   - if not self:cost({[goodsData.currency] = costCount}, {}) then return false, 6 end --不够
  1217 + if not self:cost({[goodsData.currency] = costCount}, {log = {desc = "clickTrader", int1 = block.event.id}}) then return false, 6 end --不够
1163 1218 self:backCost({[goodsData.currency] = costCount})
1164   - local reward = self:award({[goodsData.item] = goodsData.num})
  1219 + local reward = self:award({[goodsData.item] = goodsData.num}, {log = {desc = "clickTrader", int1 = block.event.id}})
1165 1220 if goodsData.restrict == 1 then
1166 1221 self.shopStatus[goodsData.goods] = (self.shopStatus[goodsData.goods] or 0) + 1
1167 1222 elseif goodsData.restrict == 2 then
... ... @@ -1214,7 +1269,7 @@ local function clickClick(self, room, block, params)
1214 1269 local item = csvdb["event_dropCsv"][dropId]["range"]:randWeight(true)
1215 1270 reward[item[1]] = (reward[item[1]] or 0) + item[2]
1216 1271 end
1217   - self:backReward(self:award(reward, {}), {roomId = room.roomId, blockId = block.blockId})
  1272 + self:backReward(self:award(reward, {log = {desc = "clickClick", int1 = block.event.id}}), {roomId = room.roomId, blockId = block.blockId})
1218 1273 end,
1219 1274 [3] = function()
1220 1275 for _, buffId in ipairs(clickData.effect:toArray(true, "=")) do
... ... @@ -1249,13 +1304,6 @@ local function clickLayer(self, room, block, params)
1249 1304 return true
1250 1305 end
1251 1306  
1252   -local function clickTask(self, room, block, params)
1253   - if self:addTask(block.event.id) then --增加任务
1254   - block:clear()
1255   - return true
1256   - end
1257   -end
1258   -
1259 1307 local eventCallFunc = {
1260 1308 [AdvEventType.Out] = clickOut,
1261 1309 [AdvEventType.InOut] = clickOut,
... ... @@ -1269,7 +1317,6 @@ local eventCallFunc = {
1269 1317 [AdvEventType.Build] = clickBuild,
1270 1318 [AdvEventType.Click] = clickClick,
1271 1319 [AdvEventType.Layer] = clickLayer,
1272   - [AdvEventType.Task] = clickTask,
1273 1320 }
1274 1321  
1275 1322 --点击处理 roomId, blockId
... ... @@ -1452,9 +1499,7 @@ function Adv:doActive(activeId, target)
1452 1499 doActiveEffect[5] = function(_)
1453 1500 for _, target in ipairs(targers) do
1454 1501 if not target.lock and not target.isDead then
1455   - self.battle:removeEnemyById(target.id)
1456   - local block = self:getBlock(target.roomId, target.blockId)
1457   - block:clear()
  1502 + target.isDead = true
1458 1503 self:backBlockChange(target.roomId, target.blockId)
1459 1504 end
1460 1505 end
... ...
src/adv/AdvBlock.lua
... ... @@ -198,7 +198,6 @@ function Block:getEventData()
198 198 [AdvEventType.Trap] = "event_trapCsv",
199 199 [AdvEventType.Click] = "event_clickCsv",
200 200 [AdvEventType.Layer] = "event_layerCsv",
201   - [AdvEventType.Task] = "event_questCsv",
202 201 [AdvEventType.LinkChoose] = "event_linkchooseCsv",
203 202 }
204 203  
... ...
src/adv/AdvBuff.lua
... ... @@ -303,22 +303,14 @@ local BuffFactory = {
303 303  
304 304 [Buff.SP_MAX_CHANGE] = function(_Buff)
305 305 _Buff._init = function(self) --初始化变化值
306   - self:_spChange()
  306 + self.owner:reSetSpMax()
307 307 end
308 308 _Buff._overlay = function(self)
309   - self:_spChange()
310   - end
311   -
312   - _Buff._uncover = function(self)
313 309 self.owner:reSetSpMax()
314 310 end
315 311  
316   - _Buff._spChange = function(self)
317   - local oldSpMax = self.owner.spMax
  312 + _Buff._uncover = function(self)
318 313 self.owner:reSetSpMax()
319   -
320   - local curValue = self.owner.spMax - oldSpMax
321   - self.owner:changeSp(curValue)
322 314 end
323 315  
324 316 _Buff._endBuff = function(self)
... ...
src/adv/AdvMap.lua
... ... @@ -60,7 +60,7 @@ function Map:checkOver()
60 60 local mapCsv = csvdb["mapCsv"][self.mapId]
61 61  
62 62 if mapCsv.clearType == 1 then -- 消耗
63   - if self.adv:cost(mapCsv.clear:toNumMap()) then return true end
  63 + if self.adv:cost(mapCsv.clear:toNumMap(), {log = {desc = "overCost", int1 = self.mapId}}) then return true end
64 64 elseif mapCsv.clearType == 2 then -- 杀光
65 65 if #self.adv.battle.player:getTeam(2) == 0 then return true end
66 66 elseif mapCsv.clearType == 3 then -- 持有
... ... @@ -224,8 +224,6 @@ function Map:getBlocksBySize(roomId, blockId, size)
224 224 return blocks
225 225 end
226 226  
227   -
228   -
229 227 -----------------------------随机地图-----------------------------
230 228  
231 229 -- isEnter isNewRelay 区分中继层的类型 --是否是开始进入 是否是第一次进入
... ... @@ -245,6 +243,7 @@ createMap = function(self, mapId, isEnter, isNewRelay)
245 243 local haveBoss = false
246 244 local haveLChoose = false
247 245  
  246 + local eventLimit = self.adv.owner:getProperty("advLimit")
248 247  
249 248 local function randomEvent(roomId, blockId, eventType)
250 249 if mapInfo.rooms[roomId]["event"][blockId] then return end --已经有事件了 不覆盖
... ... @@ -261,6 +260,14 @@ createMap = function(self, mapId, isEnter, isNewRelay)
261 260 if not eventLib[etype] or not next(eventLib[etype]) or not eventLib[etype][especial] or not next(eventLib[etype][especial]) then return false end
262 261 event.id = math.randWeight(eventLib[etype][especial], "showup")
263 262 if not event.id then return false end
  263 +
  264 + -- 不是 0 才会记录
  265 + if eventLib[etype][especial][event.id].dlimit ~= 0 then
  266 + eventLimit[etype] = eventLimit[etype] or {}
  267 + eventLimit[etype][event.id] = (eventLimit[etype][event.id] or 0) + 1
  268 + end
  269 +
  270 + -- 消除
264 271 if eventLib[etype][especial][event.id].limit > 1 then
265 272 eventLib[etype][especial][event.id].limit = eventLib[etype][especial][event.id].limit - 1
266 273 elseif eventLib[etype][especial][event.id].limit == 1 then
... ... @@ -295,6 +302,7 @@ createMap = function(self, mapId, isEnter, isNewRelay)
295 302 return false
296 303 end
297 304 haveBoss = true
  305 + self.haveBoss = true -- 刷新任务用的临时变量
298 306 end
299 307 randomFunc[AdvEventType.LinkChoose] = function()
300 308 if haveLChoose then return false end
... ... @@ -337,9 +345,6 @@ createMap = function(self, mapId, isEnter, isNewRelay)
337 345 randomFunc[AdvEventType.Click] = randomCommon
338 346 --跨层点
339 347 randomFunc[AdvEventType.Layer] = randomCommon
340   - --层级任务
341   - randomFunc[AdvEventType.Task] = randomCommon
342   -
343 348  
344 349 if randomFunc[etype] then
345 350 if randomFunc[etype]() ~= false then
... ... @@ -499,6 +504,7 @@ createMap = function(self, mapId, isEnter, isNewRelay)
499 504 event.item = mapCsvData.clear:toArray(true, "=") --掉落钥匙
500 505 end
501 506 end
  507 + self.adv.owner:setProperty("advLimit", eventLimit)
502 508 return mapInfo
503 509 end
504 510  
... ... @@ -517,14 +523,14 @@ getEventLib = function(self, needEventType) -- needEventType 需要的事件
517 523 ["event_trapCsv"] = AdvEventType.Trap,
518 524 ["event_clickCsv"] = AdvEventType.Click,
519 525 ["event_layerCsv"] = AdvEventType.Layer,
520   - ["event_questCsv"] = AdvEventType.Task,
521 526 ["event_linkchooseCsv"] = AdvEventType.LinkChoose,
522   -
523 527 }
524 528 local eventLib = {}
525 529  
526 530 local advEventOpenStatus = self.adv.owner:advEventOpenStatus()
527 531  
  532 + local eventLimit = self.adv.owner:getProperty("advLimit")
  533 +
528 534 for lib, eventType in pairs(libsToType) do
529 535 -- init eventLib
530 536 if type(eventType) == "table" then
... ... @@ -546,10 +552,24 @@ getEventLib = function(self, needEventType) -- needEventType 需要的事件
546 552 add = false
547 553 end
548 554 end
  555 +
  556 + -- data.limit 改为 整个冒险全程
  557 + local limit = data.limit
  558 + if data.limit ~= 0 then
  559 + limit = data.limit - ((eventLimit[etype] or {})[id] or 0)
  560 + if limit <= 0 then
  561 + add = false
  562 + end
  563 + end
  564 +
  565 + if add and (etype == AdvEventType.LinkChoose or etype == AdvEventType.Choose) then --只能有一次
  566 + limit = 1
  567 + end
  568 +
549 569 if add then
550 570 if AdvCommon.checkIsIn(level, data.leveltype, data.levellimit) then
551 571 eventLib[etype][data.BlockEventType] = eventLib[etype][data.BlockEventType] or {}
552   - eventLib[etype][data.BlockEventType][id] = {showup = data.showup, limit = data.limit}
  572 + eventLib[etype][data.BlockEventType][id] = {showup = data.showup, limit = limit, dlimit = data.limit}
553 573 end
554 574 end
555 575 end
... ...
src/adv/AdvPassive.lua
... ... @@ -447,7 +447,7 @@ function Passive:effect8(dropId)
447 447 skynet.error(string.format("CSVDATA Error adv_map_passive %s effect 8 not id %s in event_drop", self.id, dropId))
448 448 end
449 449 local item = dropData["range"]:randWeight(true)
450   - self.owner.battle.adv:award({[item[1]] = item[2]})
  450 + self.owner.battle.adv:award({[item[1]] = item[2]}, {log = {desc = "passive", int1 = self.id}})
451 451 end
452 452  
453 453 --9=直接获得item(可在结算触发时使用)
... ... @@ -461,13 +461,13 @@ function Passive:effect9(itemId, triggerPms, ratio, max)
461 461 return
462 462 end
463 463 if not cond then return end
464   - self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio)))})
  464 + self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio)))}, {log = {desc = "passive", int1 = self.id}})
465 465 end
466 466  
467 467 --10=战斗额外掉落次数
468 468 function Passive:effect10(count, triggerPms)
469 469 if triggerPms.count then
470   - self.owner.battle.adv:award({[triggerPms.itemId] = triggerPms.count * count})
  470 + self.owner.battle.adv:award({[triggerPms.itemId] = triggerPms.count * count}, {log = {desc = "passive", int1 = self.id}})
471 471 end
472 472 end
473 473  
... ...
src/adv/AdvPlayer.lua
... ... @@ -252,7 +252,7 @@ function BaseObject:getBuffEffectChange(classify)
252 252 end
253 253 local effect = 0
254 254 for _, buff in ipairs(self.buffs) do
255   - if not buff.isDel and buff:getType() == Buff_EFFECT_CHANGE then
  255 + if not buff.isDel and buff:getType() == Buff.Buff_EFFECT_CHANGE then
256 256 local cType, value = buff:effect()
257 257 if cType and had[cType] then
258 258 effect = effect + value
... ...
src/adv/AdvTask.lua
... ... @@ -83,6 +83,7 @@ function AdvTask.bind(Adv)
83 83 end
84 84 end
85 85 end
  86 + self:addTask()
86 87 end
87 88  
88 89 function Adv:checkTask(taskType, count, cond)
... ... @@ -109,7 +110,26 @@ function AdvTask.bind(Adv)
109 110 end
110 111  
111 112 -- 点击任务地块领取任务
112   - function Adv:addTask(taskId)
  113 + function Adv:addTask()
  114 + if self.isRelay or self.haveBoss then return end
  115 +
  116 + local chapterId, level = self.chapterId, self.level
  117 + if self:isEndless() then
  118 + level = AdvCommon.getEndlessDataLv(chapterId, level)
  119 + end
  120 + local advEventOpenStatus = self.owner:advEventOpenStatus()
  121 + local pool = {}
  122 + for id, data in pairs(csvdb["event_questCsv"]) do
  123 + if data.levelchapter == chapterId and (data.unlockType == 0 or (advEventOpenStatus[etype] or {})[data.unlockType]) then
  124 + if AdvCommon.checkIsIn(level, data.leveltype, data.levellimit) then
  125 + pool[id] = {showup = data.showup}
  126 + end
  127 + end
  128 + end
  129 +
  130 + if not next(pool) then return end
  131 +
  132 + local taskId = math.randWeight(pool, "showup")
113 133 local taskData = csvdb["event_questCsv"][taskId]
114 134 if taskData then
115 135 self.advTask[taskId] = 0
... ... @@ -137,7 +157,7 @@ function AdvTask.bind(Adv)
137 157  
138 158 local item = csvdb["event_dropCsv"][taskData.drop]["range"]:randWeight(true)
139 159 reward[item[1]] = (reward[item[1]] or 0) + item[2]
140   - reward = self:award(reward)
  160 + reward = self:award(reward, {log = {desc = "finishTask", int1 = taskId}})
141 161  
142 162 self:scoreChange(AdvScoreType.Task, taskData.advScore) --增加加分
143 163  
... ... @@ -155,7 +175,7 @@ function AdvTask.bind(Adv)
155 175 local mainTaskData = csvdb["adv_questCsv"][self.advMTask.id]
156 176 if not mainTaskData then return end
157 177 if mainTaskData.reward == 1 then
158   - reward = self.owner:award(mainTaskData.rewardValue)
  178 + reward = self.owner:award(mainTaskData.rewardValue, {log = {desc = "advMainTask", int1 = self.advMTask.id}})
159 179 end
160 180 self.advMTask.id = self.advMTask.id + 1
161 181 self.advMTask.status = 0
... ... @@ -347,7 +367,7 @@ function AdvTask.bind(Adv)
347 367 insertChange(chapterId, -1, count)
348 368  
349 369 -- 发放奖励
350   - reward = self.owner:award(achievData.reward)
  370 + reward = self.owner:award(achievData.reward, {log = {desc = "advAchiev", int1 = chapterId, int2 = taskId}})
351 371 return true, reward
352 372 end
353 373 end
... ... @@ -359,7 +379,7 @@ function AdvTask.bind(Adv)
359 379 local status = ((self.owner:getProperty(achievField)[chapterId] or {})["pts"] or {})[taskId] or 0
360 380 if status == -1 or count < achievData.pt then return end
361 381  
362   - local reward = self.owner:award(achievData.reward)
  382 + local reward = self.owner:award(achievData.reward, {log = {desc = "advAchievReward", int1 = chapterId, int2 = taskId}})
363 383 insertChange(chapterId, taskId, -1, true)
364 384 return true, reward
365 385 end
... ...
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
... ... @@ -275,7 +287,12 @@ local function routeGM(cmd, params)
275 287 return "指令失败"
276 288 end
277 289 local _M = require "actions.GmAction"
278   - return _M[cmd](agentInfo.role, params)
  290 +
  291 + agentInfo.role:startActionUcode()
  292 + local status = _M[cmd](agentInfo.role, params)
  293 + agentInfo.role:endActionUcode()
  294 +
  295 + return status
279 296 end
280 297  
281 298 skynet.start(function()
... ...
src/models/Diner.lua
... ... @@ -266,7 +266,7 @@ function Diner:expediteSell(slot)
266 266 end
267 267 local dishData = csvdb["diner_dishCsv"][sell.dish][sell.level]
268 268 local expediteCount = 0
269   - local expediteTime = 7200
  269 + local expediteTime = globalCsv.diner_sell_expediteTime
270 270 local sellTime = dishData.sell_time
271 271 expediteCount = math.floor(expediteTime / sellTime)
272 272 expediteCount = math.min(expediteCount, sell.count)
... ...
src/models/HeroPlugin.lua
... ... @@ -3,6 +3,17 @@ local HeroPlugin = {}
3 3  
4 4 function HeroPlugin.bind(Hero)
5 5  
  6 + function Hero:log(contents)
  7 + contents = contents or {}
  8 + if contents["cint1"] or contents["cint2"] or contents["cint3"] then
  9 + print("heroLog error log have cint1 or cint2 or cint3 ", debug.traceback())
  10 + end
  11 + contents["cint1"] = self:getProperty("id")
  12 + contents["cint2"] = self:getProperty("type")
  13 +
  14 + self.owner:log("hero_action", contents)
  15 + end
  16 +
6 17 function Hero:getMaxLevel()
7 18 return math.min(#csvdb["unit_expCsv"], csvdb["unit_breakCsv"][self:getProperty("breakL")].levelLimit)
8 19 end
... ...
src/models/Role.lua
... ... @@ -83,6 +83,7 @@ Role.schema = {
83 83 advEAchiev = {"table", {}}, -- 冒险无尽冒险手册
84 84 advRelay = {"table", {}}, -- 冒险中继点记录 {[chapter] = {[level] = 1}, [-1] = {[level] = 1}} -- -1 无尽 方便重置
85 85 advSup = {"table", {}}, -- 冒险支援效果 待选项
  86 + advLimit = {"table", {}}, -- 冒险事件每次的limit
86 87  
87 88 --挂机相关
88 89 hangPass = {"table", {}}, -- 挂机通过的最大关卡
... ...
src/models/RoleCross.lua
... ... @@ -73,7 +73,7 @@ RoleCross.bind = function (Role)
73 73 for k , v in pairs(initData.items or {}) do
74 74 reward[tonumber(k)] = v
75 75 end
76   - self:award(reward)
  76 + self:award(reward, {log = {desc = "gm"}})
77 77  
78 78 -- 英雄
79 79 local breakL = 0
... ... @@ -95,7 +95,7 @@ RoleCross.bind = function (Role)
95 95 local hero = self:isHaveHero(heroId)
96 96 local status
97 97 if not hero then
98   - status, hero = self:addHero({type = heroId})
  98 + status, hero = self:addHero({type = heroId, log = {desc = "gm"}})
99 99 else
100 100 status = true
101 101 end
... ... @@ -103,7 +103,7 @@ RoleCross.bind = function (Role)
103 103 local rune = ""
104 104 for slot , runeId in pairs(initData.heros.rune) do
105 105 slot = tonumber(slot)
106   - local status, rune_ = self:addRune({type = slot, id = runeId})
  106 + local status, rune_ = self:addRune({type = slot, id = runeId, log = {desc = "gm"}})
107 107 if status == 0 then
108 108 rune = rune:setv(slot, rune_:getProperty("uid"))
109 109 if initData.heros.runeL and initData.heros.runeL > 0 then
... ...
src/models/RoleLog.lua
... ... @@ -4,7 +4,34 @@ local LogType = {
4 4 create = "common",
5 5 login = "common",
6 6 logout = "common",
7   - gm = "common",
  7 + guide = "common",
  8 +
  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 + in_adv = "common",
  22 + out_adv = "common",
  23 + in_artifact = "common",
  24 +
  25 + mail_action = "common",
  26 + role_action = "common",
  27 + hang_action = "common",
  28 + hero_action = "common",
  29 + adv_action = "common",
  30 + rune_action = "common",
  31 + pvp_action = "common",
  32 + diner_action = "common",
  33 + tower_action = "common",
  34 + gm_action = "common",
8 35 }
9 36  
10 37 -- 如要修改 要提前修改 _template mapping -- 对应 mapping 为 gamelog-*
... ... @@ -23,6 +50,11 @@ local Mapping = {
23 50 int2 = "integer",
24 51 long1 = "long",
25 52 float1 = "float",
  53 +
  54 + -- 底层使用的 一些参数
  55 + cint1 = "integer",
  56 + cint2 = "integer",
  57 + cint3 = "integer",
26 58 }
27 59 }
28 60  
... ... @@ -156,6 +188,9 @@ function RoleLog.bind(Role)
156 188 end
157 189  
158 190 local mapping = Mapping[_logType]
  191 + if mapping["ucode"] and not contents["ucode"] then
  192 + contents["ucode"] = self:getActionUcode()
  193 + end
159 194  
160 195 for field, value in pairs(contents) do
161 196 local ftype = mapping[field]
... ... @@ -168,5 +203,24 @@ function RoleLog.bind(Role)
168 203 if not logd then return end
169 204 pcall(skynet.send, logd, "lua", "log", logType, doc, _logType)
170 205 end
  206 +
  207 + function Role:startActionUcode()
  208 + if not self._uniqueCount then
  209 + self._uniqueCount = 0
  210 + end
  211 + local action = {self:getProperty("id"), skynet.timex(), self._uniqueCount}
  212 + self._uniqueCount = self._uniqueCount + 1
  213 +
  214 + self._actionUcode = table.concat(action, "_")
  215 + end
  216 +
  217 + function Role:endActionUcode()
  218 + self._actionUcode = nil
  219 + end
  220 +
  221 + function Role:getActionUcode()
  222 + return self._actionUcode
  223 + end
  224 +
171 225 end
172 226 return RoleLog
173 227 \ 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,14 +663,13 @@ 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
537 671 self:sendGmMsg("server_accountBanned_warning")
538   - self:log("gm",{desc = "heartWarning", int1 = heartWarning})
  672 + self:log("role_action",{desc = "heartWarning", int1 = heartWarning})
539 673 end
540 674 end
541 675  
... ... @@ -548,11 +682,11 @@ function RolePlugin.bind(Role)
548 682 self:setProperty("banType", 0)
549 683 self:setProperty("heartWarning", 0)
550 684  
551   - self:log("gm", {desc = "ban_rm"})
  685 + self:log("role_action", {desc = "ban_rm"})
552 686 else
553 687 self:setProperty("banTime", now + 86400 * time)
554 688 self:setProperty("banType", banType)
555   - self:log("gm",{desc = "ban", int1 = time, int2 = banType})
  689 + self:log("role_action", {desc = "ban", int1 = time, int2 = banType})
556 690 end
557 691 end
558 692  
... ... @@ -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 -- 解锁神器
... ...
src/models/RolePvp.lua
... ... @@ -467,7 +467,7 @@ function Role:getCrossServerPvpBetInfo()
467 467 end
468 468 end
469 469  
470   -function Role:getCrossServerPvpBet(idx)
  470 +function Role:setCrossServerPvpBet(idx)
471 471 if not self:isTimeResetOpen(TimeReset.PvpCross) then return end
472 472 local crossTime = skynet.timex() - self:getTimeResetStartTime(TimeReset.PvpCross)
473 473 local aday = 3600 * 24
... ... @@ -486,7 +486,7 @@ function Role:getCrossServerPvpBet(idx)
486 486 local ok, result = pcall(skynet.call, pvpd, "lua", "setBet", idx)
487 487 if ok then
488 488 if result then
489   - self:costItems(cost)
  489 + self:costItems(cost, {log = {desc = "crossPvpBet", short1 = day}})
490 490 pvpBet[day] = {idx, cost[ItemId.Gold]}
491 491 self:setProperty("pvpBet", pvpBet)
492 492 end
... ...
src/models/Rune.lua
... ... @@ -26,6 +26,18 @@ function Rune:notifyUpdateProperty(field, newValue, oldValue)
26 26 self:notifyUpdateProperties(datas)
27 27 end
28 28  
  29 +function Rune:log(contents)
  30 + contents = contents or {}
  31 + if contents["cint1"] or contents["cint2"] or contents["cint3"] then
  32 + print("heroLog error log have cint1 or cint2 or cint3 ", debug.traceback())
  33 + end
  34 + contents["cint1"] = self:getProperty("uid")
  35 + contents["cint2"] = self:getProperty("type")
  36 + contents["cint3"] = self:getProperty("id")
  37 +
  38 + self.owner:log("rune_action", contents)
  39 +end
  40 +
29 41 function Rune:notifyUpdateProperties(params)
30 42 local updateData = {
31 43 uid = self:getProperty("uid"),
... ...
src/python/adv_season.py deleted
... ... @@ -1,12 +0,0 @@
1   -
2   -from redisCommon import redis, pipe, decode, encode
3   -
4   -import time, datetime
5   -
6   -
7   -lastOverTime = int(time.mktime(datetime.date.today().timetuple())) + 3600 * 24 * 14 #取当天0点
8   -
9   -
10   -
11   -
12   -
src/python/redisCommon.py deleted
... ... @@ -1,78 +0,0 @@
1   -from redis import Redis
2   -import msgpack
3   -
4   -redisConf = {
5   - "host" : "127.0.0.1",
6   - "port" : 6100,
7   - "db" : 1,
8   - "password" : None,
9   -}
10   -
11   -
12   -def numberUnpack(n) :
13   - if isinstance(n, bytes) :
14   - try:
15   - return int(n)
16   - except ValueError:
17   - try:
18   - return float(n)
19   - except ValueError:
20   - pass
21   - return n.decode()
22   - else :
23   - return n
24   -
25   -def stringUnpack(s) :
26   - if isinstance(s, bytes) :
27   - return n.decode()
28   - else :
29   - return s
30   -
31   -def tableUnpack(t) :
32   - if isinstance(t, bytes) :
33   - return msgpack.unpackb(t, raw = False) #解包
34   - else :
35   - return t
36   -
37   -redisUnpack = {
38   - "number" : numberUnpack,
39   - "string" : stringUnpack,
40   - "table" : tableUnpack,
41   - "default" : numberUnpack,
42   -}
43   -def commonPack(w) :
44   - return w
45   -
46   -def tablePack(t):
47   - return msgpack.packb(t, use_bin_type = True)
48   -
49   -redisPack = {
50   - "default" : commonPack,
51   - "table" : tablePack,
52   -}
53   -
54   -
55   -
56   -
57   -redis = Redis(
58   - host = redisConf["host"],
59   - port = redisConf["port"],
60   - db = redisConf["db"],
61   - password = redisConf["password"]
62   -)
63   -
64   -pipe = redis.pipeline()
65   -
66   -def decode(w, t = "default"):
67   - return redisUnpack[t](w)
68   -
69   -def encode(w, t = "default") :
70   - return redisPack[t](w)
71   -
72   -
73   -
74   -
75   -
76   -
77   -
78   -
src/python/requirements.txt deleted
... ... @@ -1,2 +0,0 @@
1   -redis
2   -msgpack
3 0 \ No newline at end of file