Commit 1ee53494f40981c2b8e2fcf5c750b26ace08895c

Authored by zhouhaihai
2 parents 479673cf f49ec714

Merge branch 'develop' into qa

* develop: (22 commits)
  日志bug
  修改每日礼包检测开启bug
  log缺失 ucode
  nokey
  修改引导, 抽卡阶段奖励修改
  gm增加跳过引导的命令 guide skip
  自己的日志
  自动挂机下一关
  去除日志
  拾荒引导拾取探险点后服务器设置当前引导步骤,而不是客户端指定
  付费签到,抽卡阶段奖励,探索指令
  自选箱子协议
  保底日志
  quest 增加定制
  bug
  一些 bug
  付费签到,应用市场反馈
  twd
  拾荒引导结束要设定引导步骤为成就引导
  返还
  ...
config/develop.lua
@@ -15,5 +15,3 @@ redis_host = "127.0.0.1" @@ -15,5 +15,3 @@ redis_host = "127.0.0.1"
15 redis_port = 6100 15 redis_port = 6100
16 redis_db = 1 16 redis_db = 1
17 redis_auth = nil 17 redis_auth = nil
18 -  
19 -pay_url = ""  
20 \ No newline at end of file 18 \ No newline at end of file
@@ -68,6 +68,7 @@ ItemType = { @@ -68,6 +68,7 @@ ItemType = {
68 AdvItem = 14, -- 冒险道具 68 AdvItem = 14, -- 冒险道具
69 FuncOpen = 15, -- 管理功能开放 69 FuncOpen = 15, -- 管理功能开放
70 SpeedBox = 16, -- 加速箱子 70 SpeedBox = 16, -- 加速箱子
  71 + SelectItemBox = 17, -- 自选箱子
71 } 72 }
72 73
73 --在这个里面的会记录的是功能开放 对应类型open 而不是 ID 74 --在这个里面的会记录的是功能开放 对应类型open 而不是 ID
@@ -274,6 +275,8 @@ CardType = { @@ -274,6 +275,8 @@ CardType = {
274 PrivilegeCard = 3, --特权卡 275 PrivilegeCard = 3, --特权卡
275 GrowFund = 4, --成长助力 276 GrowFund = 4, --成长助力
276 BattleCard = 5, --赛季卡 277 BattleCard = 5, --赛季卡
  278 + PaySignCard = 6, -- 付费签到卡
  279 + BattlePassCard = 7, -- 探索指令
277 } 280 }
278 281
279 HeroQuality = { 282 HeroQuality = {
@@ -290,6 +293,8 @@ MailId = { @@ -290,6 +293,8 @@ MailId = {
290 SuperMonthCardEx = 204, 293 SuperMonthCardEx = 204,
291 BattleCardAward = 210, 294 BattleCardAward = 210,
292 295
  296 + PaySignAward = 222,
  297 +
293 ActSellFood = 231, 298 ActSellFood = 231,
294 ActDrawCard = 232, 299 ActDrawCard = 232,
295 ActAdvDraw = 233, 300 ActAdvDraw = 233,
src/ProtocolCode.lua
@@ -45,6 +45,8 @@ actionCodes = { @@ -45,6 +45,8 @@ actionCodes = {
45 Role_getRandomNameRpc = 130, 45 Role_getRandomNameRpc = 130,
46 Role_goldBuyRpc = 131, 46 Role_goldBuyRpc = 131,
47 Role_getDownloadCvRewardRpc = 132, 47 Role_getDownloadCvRewardRpc = 132,
  48 + Role_updateFeedbackInfoRpc = 133,
  49 + Role_useSelectItemRpc = 134, -- 使用多选一礼包
48 50
49 Adv_startAdvRpc = 151, 51 Adv_startAdvRpc = 151,
50 Adv_startHangRpc = 152, 52 Adv_startHangRpc = 152,
@@ -91,6 +93,7 @@ actionCodes = { @@ -91,6 +93,7 @@ actionCodes = {
91 Hero_repayHeroRpc = 221, 93 Hero_repayHeroRpc = 221,
92 Hero_unlockPoolRpc = 222, 94 Hero_unlockPoolRpc = 222,
93 Hero_changeCrown = 223, 95 Hero_changeCrown = 223,
  96 + Hero_drawHeroExtraRewardNtf = 224,
94 97
95 Hang_startRpc = 251, 98 Hang_startRpc = 251,
96 Hang_checkRpc = 252, 99 Hang_checkRpc = 252,
@@ -191,6 +194,7 @@ actionCodes = { @@ -191,6 +194,7 @@ actionCodes = {
191 Store_getFreeChestRpc = 560, 194 Store_getFreeChestRpc = 560,
192 Store_getGrowFundRewardRpc = 561, --成长助力奖励 195 Store_getGrowFundRewardRpc = 561, --成长助力奖励
193 Store_getBattlePassRewardRpc = 562, --赛季卡奖励 196 Store_getBattlePassRewardRpc = 562, --赛季卡奖励
  197 + Store_getExploreCommandRewardRpc = 563, --探索指令
194 198
195 199
196 Email_listRpc = 600, 200 Email_listRpc = 600,
@@ -203,6 +207,7 @@ actionCodes = { @@ -203,6 +207,7 @@ actionCodes = {
203 Activity_signRpc = 651, 207 Activity_signRpc = 651,
204 Activity_sudokuRewardRpc = 652, 208 Activity_sudokuRewardRpc = 652,
205 Activity_actSignRpc = 653, 209 Activity_actSignRpc = 653,
  210 + Activity_actPaySignRewardNtf = 654,
206 } 211 }
207 212
208 rpcResponseBegin = 10000 213 rpcResponseBegin = 10000
src/actions/ActivityAction.lua
@@ -70,6 +70,7 @@ function _M.sudokuRpc(agent, data) @@ -70,6 +70,7 @@ function _M.sudokuRpc(agent, data)
70 activity_type = 0, -- 活动类型,见活动类型枚举表 70 activity_type = 0, -- 活动类型,见活动类型枚举表
71 activity_reward = reward or {}, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} 71 activity_reward = reward or {}, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
72 }) 72 })
  73 + role:mylog("act_action", {desc = "sudoku", int1 = id, int2 = phase})
73 74
74 SendPacket(actionCodes.Activity_sudokuRpc, MsgPack.pack({task = role:packReward(task, tchange), reward = role:packReward(reward, rchange), rId = rId})) 75 SendPacket(actionCodes.Activity_sudokuRpc, MsgPack.pack({task = role:packReward(task, tchange), reward = role:packReward(reward, rchange), rId = rId}))
75 return true 76 return true
@@ -178,5 +179,46 @@ function _M.actSignRpc(agent, data) @@ -178,5 +179,46 @@ function _M.actSignRpc(agent, data)
178 end 179 end
179 180
180 181
  182 +function _M.actPaySignRpc(agent, data)
  183 + local role = agent.role
  184 + local msg = MsgPack.unpack(data)
  185 + local actGoodsFlag = role.storeData:getProperty("actGoodsFlag")
  186 + local index = GetActGoodsIndex("paySignIn")
  187 + local flag = actGoodsFlag[index] or 0
  188 + if flag == 0 then return 1 end
  189 +
  190 + if not role.activity:isOpen("PaySignIn") then return 2 end
  191 +
  192 + local diffDay = diffFromOpen() + 1
  193 +
  194 + local curData = role.activity:getActData("PaySignIn")
  195 + local reward, change = {}
  196 + for day, csvData in ipairs(csvdb["pay_signInCsv"]) do
  197 + if day <= diffDay then
  198 + if not curData[day] then
  199 + curData[day] = 1
  200 + -- 奖励
  201 + for itemId, count in pairs(csvData.reward:toNumMap()) do
  202 + reward[itemId] = (reward[itemId] or 0) + count
  203 + end
  204 + end
  205 + else
  206 + break
  207 + end
  208 + end
  209 + if next(reward) then
  210 + role.activity:updateActData("PaySignIn", curData)
  211 + reward, change = role:award(reward, {log = {desc = "actPaySign"}})
  212 + end
  213 +
  214 + role:log("activity", {
  215 + activity_id = curData[0], -- 活动ID(或活动指定任务的ID)
  216 + activity_type = role.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表
  217 + activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  218 + })
  219 +
  220 + SendPacket(actionCodes.Activity_actPaySignRpc, MsgPack.pack(role:packReward(reward, change)))
  221 + return true
  222 +end
181 223
182 return _M 224 return _M
183 \ No newline at end of file 225 \ No newline at end of file
src/actions/AdvAction.lua
@@ -174,6 +174,7 @@ function _M.startAdvRpc( agent, data ) @@ -174,6 +174,7 @@ function _M.startAdvRpc( agent, data )
174 role:checkTaskEnter("AdvStart", {id = chapterId}) 174 role:checkTaskEnter("AdvStart", {id = chapterId})
175 role:checkTaskEnter("AdvStartSelf", {id = chapterId}) 175 role:checkTaskEnter("AdvStartSelf", {id = chapterId})
176 role:getAdvData():popBackEvents() -- 清一下事件 176 role:getAdvData():popBackEvents() -- 清一下事件
  177 + role:getAdvData():mylog({desc = "start", int1 = supportIdx})
177 178
178 SendPacket(actionCodes.Adv_startAdvRpc, '') 179 SendPacket(actionCodes.Adv_startAdvRpc, '')
179 return true 180 return true
@@ -254,6 +255,7 @@ function _M.startHangRpc(agent, data) @@ -254,6 +255,7 @@ function _M.startHangRpc(agent, data)
254 255
255 role:changeAdvCount(adv_idle_energy) 256 role:changeAdvCount(adv_idle_energy)
256 role:checkTaskEnter("AdvStart", {id = chapterId}) 257 role:checkTaskEnter("AdvStart", {id = chapterId})
  258 + role:mylog("adv_action", {desc = "startHang", int1 = chapterId})
257 259
258 SendPacket(actionCodes.Adv_startHangRpc, '') 260 SendPacket(actionCodes.Adv_startHangRpc, '')
259 return true 261 return true
@@ -293,6 +295,8 @@ function _M.quickHangRpc(agent, data) @@ -293,6 +295,8 @@ function _M.quickHangRpc(agent, data)
293 info.time = 0 295 info.time = 0
294 role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) 296 role:changeUpdates({{type = "advHang", field = chapterId, value = info}})
295 297
  298 + role:mylog("adv_action", {desc = "advQuickHang", int1 = chapterId})
  299 +
296 SendPacket(actionCodes.Adv_quickHangRpc, '') 300 SendPacket(actionCodes.Adv_quickHangRpc, '')
297 return true 301 return true
298 end 302 end
@@ -374,6 +378,8 @@ function _M.endHangRpc(agent, data) @@ -374,6 +378,8 @@ function _M.endHangRpc(agent, data)
374 378
375 role:changeUpdates({{type = "advHang", field = chapterId, value = nil}}) 379 role:changeUpdates({{type = "advHang", field = chapterId, value = nil}})
376 380
  381 + role:mylog("adv_action", {desc = "endHang", int1 = chapterId, short1 = cancel and 1 or 0})
  382 +
377 SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, change = change, isFull = isFull})) 383 SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, change = change, isFull = isFull}))
378 return true 384 return true
379 end 385 end
@@ -403,6 +409,7 @@ function _M.buyAdvCountRpc(agent , data) @@ -403,6 +409,7 @@ function _M.buyAdvCountRpc(agent , data)
403 role:changeAdvCount(-count * globalCsv.adv_daily_buy_num) 409 role:changeAdvCount(-count * globalCsv.adv_daily_buy_num)
404 role.dailyData:updateProperty({field = "advBC", delta = count}) 410 role.dailyData:updateProperty({field = "advBC", delta = count})
405 end 411 end
  412 + role:mylog("adv_action", {desc = "buyAdvCount", short1 = isEl and 1 or 0, int1 = count})
406 413
407 SendPacket(actionCodes.Adv_buyAdvCountRpc, '') 414 SendPacket(actionCodes.Adv_buyAdvCountRpc, '')
408 return true 415 return true
@@ -427,6 +434,8 @@ function _M.finishTaskRpc(agent, data) @@ -427,6 +434,8 @@ function _M.finishTaskRpc(agent, data)
427 if not status then return end 434 if not status then return end
428 role:checkTaskEnter("AdvOverTask", {id = taskId}) 435 role:checkTaskEnter("AdvOverTask", {id = taskId})
429 436
  437 + adv:mylog({desc = "finishTask", int1 = taskId})
  438 +
430 SendPacket(actionCodes.Adv_finishTaskRpc, MsgPack.pack(role:packReward(reward, change))) 439 SendPacket(actionCodes.Adv_finishTaskRpc, MsgPack.pack(role:packReward(reward, change)))
431 return true 440 return true
432 end 441 end
@@ -448,6 +457,8 @@ function _M.clickBlockRpc(agent, data) @@ -448,6 +457,8 @@ function _M.clickBlockRpc(agent, data)
448 457
449 if adv:isWaitChooseArtifact() then return returnFail() end 458 if adv:isWaitChooseArtifact() then return returnFail() end
450 459
  460 + adv:mylog({desc = "clickBlock", int1 = msg.roomId, int2 = msg.blockId})
  461 +
451 local status, errorCode = adv:clickBlock(msg.roomId, msg.blockId, msg) 462 local status, errorCode = adv:clickBlock(msg.roomId, msg.blockId, msg)
452 if not status then return returnFail(errorCode) end 463 if not status then return returnFail(errorCode) end
453 464
@@ -483,8 +494,8 @@ function _M.useItemRpc(agent, data) @@ -483,8 +494,8 @@ function _M.useItemRpc(agent, data)
483 if itemId == 5020 then 494 if itemId == 5020 then
484 role:finishGuide(53) 495 role:finishGuide(53)
485 end 496 end
486 -  
487 adv:checkAchievement(adv.AchievType.UseItem, count, itemId) 497 adv:checkAchievement(adv.AchievType.UseItem, count, itemId)
  498 + adv:mylog({desc = "useItem", int1 = itemId, int2 = count})
488 499
489 for i = 1, count do 500 for i = 1, count do
490 adv:doActive(itemData.effect, target) -- target 501 adv:doActive(itemData.effect, target) -- target
@@ -520,6 +531,7 @@ function _M.usePotionRpc(agent, data) @@ -520,6 +531,7 @@ function _M.usePotionRpc(agent, data)
520 local adv = role:getAdvData() 531 local adv = role:getAdvData()
521 if adv:isWaitChooseArtifact() then return end 532 if adv:isWaitChooseArtifact() then return end
522 533
  534 + adv:mylog({desc = "usePotion", int1 = potionId})
523 535
524 local status = adv:doActive(potionData.effect, target) -- target 536 local status = adv:doActive(potionData.effect, target) -- target
525 if not status then return end 537 if not status then return end
@@ -614,10 +626,12 @@ function _M.exitAdvRpc(agent, data) @@ -614,10 +626,12 @@ function _M.exitAdvRpc(agent, data)
614 local role = agent.role 626 local role = agent.role
615 -- local msg = MsgPack.unpack(data) 627 -- local msg = MsgPack.unpack(data)
616 if not isCanContinue(role) then return end 628 if not isCanContinue(role) then return end
  629 + -- 冒险中途退出的时候要把引导步骤设定到成就引导
617 if not role:checkOverGuide(57) then 630 if not role:checkOverGuide(57) then
618 role:saveGuide(57,1,true) 631 role:saveGuide(57,1,true)
619 end 632 end
620 local adv = role:getAdvData() 633 local adv = role:getAdvData()
  634 + adv:mylog({desc = "exit"})
621 local status = adv:exit() -- target {roomId = 1, blockId = 1} 选择的目标 635 local status = adv:exit() -- target {roomId = 1, blockId = 1} 选择的目标
622 SendPacket(actionCodes.Adv_exitAdvRpc, MsgPack.pack({events = adv:popBackEvents()})) 636 SendPacket(actionCodes.Adv_exitAdvRpc, MsgPack.pack({events = adv:popBackEvents()}))
623 return true 637 return true
@@ -688,7 +702,7 @@ function _M.endBattleRpc(agent, data) @@ -688,7 +702,7 @@ function _M.endBattleRpc(agent, data)
688 role:saveGuide(61,1,true) 702 role:saveGuide(61,1,true)
689 end 703 end
690 end 704 end
691 - 705 + adv:mylog({desc = "endBattle"})
692 local status = adv:clickBlock(roomId, blockId, {player = player, bySkill = bySkill}) 706 local status = adv:clickBlock(roomId, blockId, {player = player, bySkill = bySkill})
693 707
694 if not status then return end 708 if not status then return end
@@ -771,7 +785,9 @@ function _M.wheelSurfRpc(agent, data) @@ -771,7 +785,9 @@ function _M.wheelSurfRpc(agent, data)
771 end 785 end
772 role:award(reward, {log = {desc = "advWheelSurf", int1 = ptype}}) 786 role:award(reward, {log = {desc = "advWheelSurf", int1 = ptype}})
773 role:finishGuide(58) 787 role:finishGuide(58)
  788 +
774 role:checkTaskEnter("AdvDraw", {count = count, ptype = ptype}) 789 role:checkTaskEnter("AdvDraw", {count = count, ptype = ptype})
  790 + role:mylog("adv_action", {desc = "advWheelSurf", int1 = ptype, int2 = count})
775 791
776 SendPacket(actionCodes.Adv_wheelSurfRpc, MsgPack.pack({reward = backReward})) 792 SendPacket(actionCodes.Adv_wheelSurfRpc, MsgPack.pack({reward = backReward}))
777 return true 793 return true
@@ -800,6 +816,7 @@ function _M.repayWheelSurfRpc(agent, data) @@ -800,6 +816,7 @@ function _M.repayWheelSurfRpc(agent, data)
800 local gift = drawData["pool3"]:randWeight(true) 816 local gift = drawData["pool3"]:randWeight(true)
801 local reward, change = {[gift[1]] = gift[2]} 817 local reward, change = {[gift[1]] = gift[2]}
802 reward, change = role:award(reward, {log = {desc = "advRepayWheelSurf", int1 = ptype}}) 818 reward, change = role:award(reward, {log = {desc = "advRepayWheelSurf", int1 = ptype}})
  819 + role:mylog("adv_action", {desc = "advRepayWheelSurf", int1 = ptype})
803 820
804 SendPacket(actionCodes.Adv_repayWheelSurfRpc, MsgPack.pack(role:packReward(reward, change))) 821 SendPacket(actionCodes.Adv_repayWheelSurfRpc, MsgPack.pack(role:packReward(reward, change)))
805 return true 822 return true
@@ -823,6 +840,8 @@ function _M.finishAchievRpc(agent, data) @@ -823,6 +840,8 @@ function _M.finishAchievRpc(agent, data)
823 if not status then return end 840 if not status then return end
824 adv:updateAchievement() 841 adv:updateAchievement()
825 role:finishGuide(57) 842 role:finishGuide(57)
  843 + role:mylog("adv_action", {desc = "finishAchiev", short1 = ctype, int1 = chapterId, int2 = taskId})
  844 +
826 SendPacket(actionCodes.Adv_finishAchievRpc, MsgPack.pack(role:packReward(reward, change))) 845 SendPacket(actionCodes.Adv_finishAchievRpc, MsgPack.pack(role:packReward(reward, change)))
827 return true 846 return true
828 end 847 end
@@ -878,6 +897,7 @@ function _M.refreshSupportRpc(agent, data) @@ -878,6 +897,7 @@ function _M.refreshSupportRpc(agent, data)
878 end 897 end
879 898
880 role:advRandomSupportEffect() 899 role:advRandomSupportEffect()
  900 + role:mylog("adv_action", {desc = "advSupRe", short1 = cr < al and 0 or 1})
881 901
882 SendPacket(actionCodes.Adv_refreshSupportRpc, '') 902 SendPacket(actionCodes.Adv_refreshSupportRpc, '')
883 return true 903 return true
src/actions/CarAction.lua
@@ -47,6 +47,8 @@ function _M.makePotionRpc( agent, data ) @@ -47,6 +47,8 @@ function _M.makePotionRpc( agent, data )
47 carriage_cook_amount = count, -- 制作总量 47 carriage_cook_amount = count, -- 制作总量
48 carriage_cook_cost = cost, -- 制作消耗道具,json格式记录,{'itemid1':10,'itemid2':5,…………..} 48 carriage_cook_cost = cost, -- 制作消耗道具,json格式记录,{'itemid1':10,'itemid2':5,…………..}
49 }) 49 })
  50 + role:mylog("role_action", {desc = "makePotion", int1 = potionId, int2 = count})
  51 +
50 SendPacket(actionCodes.Car_makePotionRpc, MsgPack.pack({potionBag = potionBag})) 52 SendPacket(actionCodes.Car_makePotionRpc, MsgPack.pack({potionBag = potionBag}))
51 return true 53 return true
52 end 54 end
@@ -105,7 +107,7 @@ function _M.equipUpRpc( agent, data ) @@ -105,7 +107,7 @@ function _M.equipUpRpc( agent, data )
105 equip_upgrade_cost = costCount, -- 升级操作消耗装备数量 107 equip_upgrade_cost = costCount, -- 升级操作消耗装备数量
106 equip_upgrade_current = cost, -- 升级消耗的货币类型 108 equip_upgrade_current = cost, -- 升级消耗的货币类型
107 }) 109 })
108 - 110 + role:mylog("role_action", {desc = "equipUp", int1 = id, int2 = count})
109 SendPacket(actionCodes.Car_equipUpRpc, '') 111 SendPacket(actionCodes.Car_equipUpRpc, '')
110 return true 112 return true
111 end 113 end
@@ -145,7 +147,7 @@ function _M.runeUpRpc( agent, data ) @@ -145,7 +147,7 @@ function _M.runeUpRpc( agent, data )
145 hero:updateProperty({field = "battleV", value = hero:getBattleValue()}) 147 hero:updateProperty({field = "battleV", value = hero:getBattleValue()})
146 end 148 end
147 end 149 end
148 - ownRune:log({desc = "runeUp", int1 = level + 1}) 150 + ownRune:mylog({desc = "runeUp", int1 = level + 1})
149 151
150 SendPacket(actionCodes.Car_runeUpRpc, '') 152 SendPacket(actionCodes.Car_runeUpRpc, '')
151 return true 153 return true
@@ -179,7 +181,8 @@ function _M.saleEquipRpc(agent, data ) @@ -179,7 +181,8 @@ function _M.saleEquipRpc(agent, data )
179 end 181 end
180 role:checkTaskEnter("SaleEquip", {count = allCount}) 182 role:checkTaskEnter("SaleEquip", {count = allCount})
181 reward, change = role:award(reward, {log = {desc = "saleEquip"}}) 183 reward, change = role:award(reward, {log = {desc = "saleEquip"}})
182 - 184 + role:mylog("role_action", {desc = "saleEquip", int1 = allCount})
  185 +
183 SendPacket(actionCodes.Car_saleEquipRpc, MsgPack.pack(role:packReward(reward, change))) 186 SendPacket(actionCodes.Car_saleEquipRpc, MsgPack.pack(role:packReward(reward, change)))
184 return true 187 return true
185 end 188 end
src/actions/DinerAction.lua
@@ -106,6 +106,8 @@ function _M.addSellRpc( agent, data ) @@ -106,6 +106,8 @@ function _M.addSellRpc( agent, data )
106 end 106 end
107 role:finishGuide(28) 107 role:finishGuide(28)
108 108
  109 + role:mylog("diner_action", {desc = "addSell", int1 = dish, int2 = count})
  110 +
109 role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) 111 role.dinerData:updateProperty({field = "sells", value = json.encode(sells)})
110 SendPacket(actionCodes.Diner_addSellRpc, "") 112 SendPacket(actionCodes.Diner_addSellRpc, "")
111 return true 113 return true
@@ -139,7 +141,11 @@ function _M.removeSellRpc( agent, data ) @@ -139,7 +141,11 @@ function _M.removeSellRpc( agent, data )
139 return 5 141 return 5
140 end 142 end
141 143
142 - local temp = role.dinerData:updateSell(slot) 144 + local temp = role.dinerData:updateSell(slot) or {
  145 + deltaCount = 0,
  146 + deltaTime = 0,
  147 + lastCount = 0,
  148 + }
143 local reward, change = {} 149 local reward, change = {}
144 local cost = dishData.material:toNumMap() 150 local cost = dishData.material:toNumMap()
145 for k, n in pairs(cost) do 151 for k, n in pairs(cost) do
@@ -157,6 +163,7 @@ function _M.removeSellRpc( agent, data ) @@ -157,6 +163,7 @@ function _M.removeSellRpc( agent, data )
157 restaurant_sale_coin = reward[ItemId.DinerCoin] or 0, -- 售卖获得美食币 163 restaurant_sale_coin = reward[ItemId.DinerCoin] or 0, -- 售卖获得美食币
158 restaurant_sale_gear = reward[ItemId.Gold] or 0, -- 售卖获得齿轮 164 restaurant_sale_gear = reward[ItemId.Gold] or 0, -- 售卖获得齿轮
159 }) 165 })
  166 + role:mylog("diner_action", {desc = "removeSell", int1 = dish})
160 167
161 role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) 168 role.dinerData:updateProperty({field = "sells", value = json.encode(sells)})
162 SendPacket(actionCodes.Diner_removeSellRpc, MsgPack.pack({reward = reward, change = change})) 169 SendPacket(actionCodes.Diner_removeSellRpc, MsgPack.pack({reward = reward, change = change}))
@@ -171,7 +178,11 @@ function _M.getSellRewardRpc( agent, data ) @@ -171,7 +178,11 @@ function _M.getSellRewardRpc( agent, data )
171 178
172 local deltaTimes = {} 179 local deltaTimes = {}
173 for slot, _ in pairs(sells) do 180 for slot, _ in pairs(sells) do
174 - local temp = role.dinerData:updateSell(slot) 181 + local temp = role.dinerData:updateSell(slot) or {
  182 + deltaCount = 0,
  183 + deltaTime = 0,
  184 + lastCount = 0,
  185 + }
175 deltaTimes[slot] = temp.deltaTime 186 deltaTimes[slot] = temp.deltaTime
176 end 187 end
177 sells = json.decode(role.dinerData:getProperty("sells")) 188 sells = json.decode(role.dinerData:getProperty("sells"))
@@ -222,7 +233,7 @@ function _M.getSellRewardRpc( agent, data ) @@ -222,7 +233,7 @@ function _M.getSellRewardRpc( agent, data )
222 role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order")) 233 role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order"))
223 end 234 end
224 235
225 - 236 + role:mylog("diner_action", {desc = "sell"})
226 237
227 SendPacket(actionCodes.Diner_getSellRewardRpc, MsgPack.pack({reward = reward, change = change})) 238 SendPacket(actionCodes.Diner_getSellRewardRpc, MsgPack.pack({reward = reward, change = change}))
228 return true 239 return true
@@ -311,6 +322,8 @@ function _M.expediteSellRpc( agent, data ) @@ -311,6 +322,8 @@ function _M.expediteSellRpc( agent, data )
311 end 322 end
312 role:checkTaskEnter("FoodSellQuick") 323 role:checkTaskEnter("FoodSellQuick")
313 324
  325 + role:mylog("diner_action", {desc = "sellQ"})
  326 +
314 SendPacket(actionCodes.Diner_expediteSellRpc, MsgPack.pack({reward = reward, change = change, popular = popular})) 327 SendPacket(actionCodes.Diner_expediteSellRpc, MsgPack.pack({reward = reward, change = change, popular = popular}))
315 return true 328 return true
316 end 329 end
@@ -357,6 +370,7 @@ function _M.levelUpRpc( agent, data ) @@ -357,6 +370,7 @@ function _M.levelUpRpc( agent, data )
357 restaurant_up_effectbef = curLevel, --升级前加成 370 restaurant_up_effectbef = curLevel, --升级前加成
358 restaurant_up_effect = curLevel + 1, --升级后加成 371 restaurant_up_effect = curLevel + 1, --升级后加成
359 }) 372 })
  373 + role:mylog("diner_action", {desc = "buildUp", int1 = index, int2 = curLevel + 1})
360 374
361 SendPacket(actionCodes.Diner_levelUpRpc, '') 375 SendPacket(actionCodes.Diner_levelUpRpc, '')
362 return true 376 return true
@@ -446,6 +460,8 @@ function _M.talentUpRpc( agent, data ) @@ -446,6 +460,8 @@ function _M.talentUpRpc( agent, data )
446 carriage_logistics_gear = cost[ItemId.Gold] or 0, -- 后勤室升级花费齿轮数量 460 carriage_logistics_gear = cost[ItemId.Gold] or 0, -- 后勤室升级花费齿轮数量
447 carriage_logistics_coin = cost[ItemId.DinerCoin] or 0, -- 后勤室升级花费美食币数量 461 carriage_logistics_coin = cost[ItemId.DinerCoin] or 0, -- 后勤室升级花费美食币数量
448 }) 462 })
  463 + role:mylog("diner_action", {desc = "talentUp", int1 = dish, int2 = dishLevel + 1})
  464 +
449 SendPacket(actionCodes.Diner_talentUpRpc, '') 465 SendPacket(actionCodes.Diner_talentUpRpc, '')
450 return true 466 return true
451 end 467 end
@@ -479,6 +495,7 @@ function _M.skillUpRpc( agent, data ) @@ -479,6 +495,7 @@ function _M.skillUpRpc( agent, data )
479 495
480 role:costItems(cost, {log = {desc = "dinerSkillUp", int1 = skill, int2 = skillLevel + 1}}) 496 role:costItems(cost, {log = {desc = "dinerSkillUp", int1 = skill, int2 = skillLevel + 1}})
481 role.dinerData:updateProperty({field = "skillTree", value = skillTree:setv(skill, skillLevel + 1)}) 497 role.dinerData:updateProperty({field = "skillTree", value = skillTree:setv(skill, skillLevel + 1)})
  498 + role:mylog("diner_action", {desc = "skillUp", int1 = skill, int2 = skillLevel + 1})
482 499
483 SendPacket(actionCodes.Diner_skillUpRpc, '') 500 SendPacket(actionCodes.Diner_skillUpRpc, '')
484 return true 501 return true
@@ -506,6 +523,8 @@ function _M.lockTaskRpc( agent, data ) @@ -506,6 +523,8 @@ function _M.lockTaskRpc( agent, data )
506 end 523 end
507 role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) 524 role.dinerData:updateProperty({field = "order", value = json.encode(orders)})
508 525
  526 + role:mylog("diner_action", {desc = "lockTask", int1 = order.id})
  527 +
509 SendPacket(actionCodes.Diner_lockTaskRpc, MsgPack.pack({lock = order.lock})) 528 SendPacket(actionCodes.Diner_lockTaskRpc, MsgPack.pack({lock = order.lock}))
510 return true 529 return true
511 end 530 end
@@ -542,7 +561,8 @@ function _M.updateTaskRpc( agent, data ) @@ -542,7 +561,8 @@ function _M.updateTaskRpc( agent, data )
542 orders[index].status = 1 561 orders[index].status = 1
543 orders[index].lock = 1 562 orders[index].lock = 1
544 563
545 - role:checkTaskEnter("GetOderTask", {rarity = taskSet.rarity}) 564 + role:checkTaskEnter("GetOderTask", {rarity = taskData.rarity})
  565 + role:mylog("diner_action", {desc = "getTask", int1 = order.id})
546 elseif cmd == 1 then 566 elseif cmd == 1 then
547 if order.status ~= 1 then 567 if order.status ~= 1 then
548 return 31 568 return 31
@@ -550,6 +570,8 @@ function _M.updateTaskRpc( agent, data ) @@ -550,6 +570,8 @@ function _M.updateTaskRpc( agent, data )
550 orders[index].status = 0 570 orders[index].status = 0
551 orders[index].lock = 0 571 orders[index].lock = 0
552 572
  573 + role:mylog("diner_action", {desc = "deleteTask", int1 = order.id})
  574 +
553 elseif cmd == 2 then 575 elseif cmd == 2 then
554 if order.status ~= 1 then 576 if order.status ~= 1 then
555 return 32 577 return 32
@@ -557,10 +579,11 @@ function _M.updateTaskRpc( agent, data ) @@ -557,10 +579,11 @@ function _M.updateTaskRpc( agent, data )
557 if order.n < taskData.value then 579 if order.n < taskData.value then
558 return 6 580 return 6
559 end 581 end
  582 + role:mylog("diner_action", {desc = "finishTask", int1 = order.id})
560 583
561 reward, change = role:award(taskData.reward, {log = {desc = "dinerFinishTask", int1 = order.id}}) 584 reward, change = role:award(taskData.reward, {log = {desc = "dinerFinishTask", int1 = order.id}})
562 table.remove(orders,index) 585 table.remove(orders,index)
563 - role:checkTaskEnter("OverOderTask", {rarity = taskSet.rarity}) 586 + role:checkTaskEnter("OverOderTask", {rarity = taskData.rarity})
564 else 587 else
565 return 33 588 return 33
566 end 589 end
@@ -569,8 +592,8 @@ function _M.updateTaskRpc( agent, data ) @@ -569,8 +592,8 @@ function _M.updateTaskRpc( agent, data )
569 role:log("restaurant_order", { 592 role:log("restaurant_order", {
570 restaurant_order_id = order.id, -- 订单任务ID 593 restaurant_order_id = order.id, -- 订单任务ID
571 restaurant_order_status = cmd, -- 订单任务状态,接受:0, 拒绝:1, 完成:2 594 restaurant_order_status = cmd, -- 订单任务状态,接受:0, 拒绝:1, 完成:2
572 - restaurant_order_rwd = reward, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}  
573 - restaurant_order_lv = taskSet.rarity, -- 订单品质等级,普通:0, 稀有:1, 顶级:2, 豪华:3 595 + restaurant_order_rwd = reward or {}, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
  596 + restaurant_order_lv = taskData.rarity, -- 订单品质等级,普通:0, 稀有:1, 顶级:2, 豪华:3
574 }) 597 })
575 598
576 role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) 599 role.dinerData:updateProperty({field = "order", value = json.encode(orders)})
@@ -648,6 +671,8 @@ function _M.refreshTaskRpc( agent, data ) @@ -648,6 +671,8 @@ function _M.refreshTaskRpc( agent, data )
648 end 671 end
649 672
650 role:finishGuide(41) 673 role:finishGuide(41)
  674 + role:mylog("diner_action", {desc = "reTask"})
  675 +
651 role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) 676 role.dinerData:updateProperty({field = "order", value = json.encode(orders)})
652 677
653 SendPacket(actionCodes.Diner_refreshTaskRpc, '') 678 SendPacket(actionCodes.Diner_refreshTaskRpc, '')
@@ -688,6 +713,8 @@ function _M.addWantFoodRpc(agent , data) @@ -688,6 +713,8 @@ function _M.addWantFoodRpc(agent , data)
688 end 713 end
689 714
690 role:finishGuide(36) 715 role:finishGuide(36)
  716 + role:mylog("diner_action", {desc = "wantFood"})
  717 +
691 role.dinerData:updateProperty({field = "gfood", value = gfood}) 718 role.dinerData:updateProperty({field = "gfood", value = gfood})
692 719
693 SendPacket(actionCodes.Diner_addWantFoodRpc, '') 720 SendPacket(actionCodes.Diner_addWantFoodRpc, '')
@@ -734,6 +761,7 @@ function _M.getGreenhouseRpc( agent, data ) @@ -734,6 +761,7 @@ function _M.getGreenhouseRpc( agent, data )
734 local reward, change = role:award(reward, {log = {desc = "greenHourse", int1 = level}}) 761 local reward, change = role:award(reward, {log = {desc = "greenHourse", int1 = level}})
735 role:checkTaskEnter("FoodMGet") 762 role:checkTaskEnter("FoodMGet")
736 763
  764 + role:mylog("diner_action", {desc = "greenHourse"})
737 765
738 SendPacket(actionCodes.Diner_getGreenhouseRpc, MsgPack.pack({reward = reward, change = change})) 766 SendPacket(actionCodes.Diner_getGreenhouseRpc, MsgPack.pack({reward = reward, change = change}))
739 return true 767 return true
@@ -872,6 +900,7 @@ function _M.entrustRpc(agent , data) @@ -872,6 +900,7 @@ function _M.entrustRpc(agent , data)
872 role.dinerData:updateProperty({field = "entrust", value = entrust}) 900 role.dinerData:updateProperty({field = "entrust", value = entrust})
873 901
874 role:finishGuide(26) 902 role:finishGuide(26)
  903 + role:mylog("diner_action", {desc = "entrus", short1 = ctype, int1 = entrustId})
875 904
876 SendPacket(actionCodes.Diner_entrustRpc, MsgPack.pack({reward = reward, change = change})) 905 SendPacket(actionCodes.Diner_entrustRpc, MsgPack.pack({reward = reward, change = change}))
877 return true 906 return true
@@ -908,6 +937,7 @@ function _M.collectRpc(agent , data) @@ -908,6 +937,7 @@ function _M.collectRpc(agent , data)
908 restaurant_collect_rwd = reward, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} 937 restaurant_collect_rwd = reward, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
909 restaurant_collect_plan = count, -- 收集进度,即解锁顾客,数字表示 938 restaurant_collect_plan = count, -- 收集进度,即解锁顾客,数字表示
910 }) 939 })
  940 + role:mylog("diner_action", {desc = "collect", int1 = id})
911 941
912 SendPacket(actionCodes.Diner_collectRpc, MsgPack.pack({reward = reward, change = change})) 942 SendPacket(actionCodes.Diner_collectRpc, MsgPack.pack({reward = reward, change = change}))
913 return true 943 return true
@@ -937,6 +967,8 @@ function _M.comboRewardRpc(agent , data) @@ -937,6 +967,8 @@ function _M.comboRewardRpc(agent , data)
937 967
938 role.dinerData:updateProperty({field = "comboStatus", value = comboStatus}) -- 解锁了 968 role.dinerData:updateProperty({field = "comboStatus", value = comboStatus}) -- 解锁了
939 969
  970 + role:mylog("diner_action", {desc = "combo", int1 = id})
  971 +
940 SendPacket(actionCodes.Diner_comboRewardRpc, MsgPack.pack({reward = reward, change = change})) 972 SendPacket(actionCodes.Diner_comboRewardRpc, MsgPack.pack({reward = reward, change = change}))
941 return true 973 return true
942 end 974 end
src/actions/EmailAction.lua
@@ -53,6 +53,7 @@ function _M.listRpc(agent, data) @@ -53,6 +53,7 @@ function _M.listRpc(agent, data)
53 content = email.content, 53 content = email.content,
54 attachments = email.attachments 54 attachments = email.attachments
55 }) 55 })
  56 + role:mylog("mail_action", {desc = "get_global", key1 = email.title, key2 = email.attachments})
56 end 57 end
57 end 58 end
58 end 59 end
@@ -98,6 +99,7 @@ function _M.drawAllAttachRpc(agent, data) @@ -98,6 +99,7 @@ function _M.drawAllAttachRpc(agent, data)
98 for key, v in pairs(attachments:toNumMap()) do 99 for key, v in pairs(attachments:toNumMap()) do
99 reward[key] = (reward[key] or 0) + v 100 reward[key] = (reward[key] or 0) + v
100 end 101 end
  102 + role:mylog("mail_action", {desc = "draw_attach", int1 = email:getProperty("emailId"), key1 = email:getProperty("title"), key2 = attachments})
101 end 103 end
102 end 104 end
103 reward, change = role:award(reward, {log = {desc = "draw_attach"}}) 105 reward, change = role:award(reward, {log = {desc = "draw_attach"}})
@@ -123,7 +125,7 @@ function _M.drawAttachRpc(agent, data) @@ -123,7 +125,7 @@ function _M.drawAttachRpc(agent, data)
123 email:setProperty("status", 2) 125 email:setProperty("status", 2)
124 email:log(role, 2) 126 email:log(role, 2)
125 SendPacket(actionCodes.Email_drawAttachRpc, MsgPack.pack({reward = reward, change = change})) 127 SendPacket(actionCodes.Email_drawAttachRpc, MsgPack.pack({reward = reward, change = change}))
126 - 128 + role:mylog("mail_action", {desc = "draw_attach", int1 = id, key1 = email:getProperty("title"), key2 = attachments})
127 return true 129 return true
128 end 130 end
129 131
@@ -140,6 +142,7 @@ function _M.checkRpc(agent, data) @@ -140,6 +142,7 @@ function _M.checkRpc(agent, data)
140 142
141 email:setProperty("status", 1) 143 email:setProperty("status", 1)
142 email:log(role, 1) 144 email:log(role, 1)
  145 + role:mylog("mail_action", {desc = "check_mail", int1 = id})
143 146
144 SendPacket(actionCodes.Email_checkRpc, '') 147 SendPacket(actionCodes.Email_checkRpc, '')
145 return true 148 return true
@@ -175,6 +178,9 @@ function _M.delRpc(agent, data) @@ -175,6 +178,9 @@ function _M.delRpc(agent, data)
175 end 178 end
176 end 179 end
177 end) 180 end)
  181 + for delId, _ in ipairs(result) do
  182 + role:mylog("mail_action", {desc = "del_mail", int1 = delId})
  183 + end
178 SendPacket(actionCodes.Email_delRpc, MsgPack.pack({result = result})) 184 SendPacket(actionCodes.Email_delRpc, MsgPack.pack({result = result}))
179 return true 185 return true
180 end 186 end
src/actions/FriendAction.lua
@@ -111,6 +111,7 @@ function _M.searchRpc(agent, data) @@ -111,6 +111,7 @@ function _M.searchRpc(agent, data)
111 })) 111 }))
112 end 112 end
113 113
  114 + role:mylog("role_action", {desc = "searchFriend"})
114 SendPacket(actionCodes.Friend_searchRpc, MsgPack.pack({searchList = searchList})) 115 SendPacket(actionCodes.Friend_searchRpc, MsgPack.pack({searchList = searchList}))
115 return true 116 return true
116 end 117 end
@@ -177,6 +178,8 @@ function _M.applyRpc(agent, data) @@ -177,6 +178,8 @@ function _M.applyRpc(agent, data)
177 myInfo.online = true 178 myInfo.online = true
178 myInfo.hadApply = true 179 myInfo.hadApply = true
179 180
  181 + role:mylog("role_action", {desc = "addFriend", int1 = 1})
  182 +
180 rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newApply = 1, info = {myInfo}})) -- 通知对方 183 rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newApply = 1, info = {myInfo}})) -- 通知对方
181 end 184 end
182 185
@@ -283,6 +286,8 @@ function _M.handleApplyRpc(agent, data) @@ -283,6 +286,8 @@ function _M.handleApplyRpc(agent, data)
283 friend_roleid = objectId, -- 好友账户下的角色id 286 friend_roleid = objectId, -- 好友账户下的角色id
284 friend_cnt = curCount + 1, -- 操作后好友数量 287 friend_cnt = curCount + 1, -- 操作后好友数量
285 }) 288 })
  289 + role:mylog("role_action", {desc = "addFriend", int1 = 1})
  290 +
286 end 291 end
287 292
288 elseif cmd == 0 then -- 不同意 293 elseif cmd == 0 then -- 不同意
@@ -347,6 +352,8 @@ function _M.handleApplyRpc(agent, data) @@ -347,6 +352,8 @@ function _M.handleApplyRpc(agent, data)
347 rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = {myInfo}})) -- 通知对方 352 rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = {myInfo}})) -- 通知对方
348 end 353 end
349 if next(needAdd) then 354 if next(needAdd) then
  355 + role:mylog("role_action", {desc = "addFriend", int1 = #needAdd})
  356 +
350 SendPacket(actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = needAddInfo})) 357 SendPacket(actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = needAddInfo}))
351 else 358 else
352 result = 1 359 result = 1
@@ -553,6 +560,8 @@ function _M.pointRpc(agent, data) @@ -553,6 +560,8 @@ function _M.pointRpc(agent, data)
553 role.dailyData:updateProperty({field = "giveFP", value = giveP}) 560 role.dailyData:updateProperty({field = "giveFP", value = giveP})
554 role:checkTaskEnter("GiveFriendP", {count = 1}) 561 role:checkTaskEnter("GiveFriendP", {count = 1})
555 rpcRole(objId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newPoint = 1, roleId = roleId})) 562 rpcRole(objId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newPoint = 1, roleId = roleId}))
  563 +
  564 + role:mylog("role_action", {desc = "giveFPoint", int1 = 1})
556 end 565 end
557 elseif cmd == 2 then -- 领取 566 elseif cmd == 2 then -- 领取
558 local objId = msg.roleId 567 local objId = msg.roleId
@@ -572,6 +581,7 @@ function _M.pointRpc(agent, data) @@ -572,6 +581,7 @@ function _M.pointRpc(agent, data)
572 role.dailyData:updateProperty({field = "getFP", value = getP}) 581 role.dailyData:updateProperty({field = "getFP", value = getP})
573 role:checkTaskEnter("GetFriendP", {count = 1}) 582 role:checkTaskEnter("GetFriendP", {count = 1})
574 583
  584 + role:mylog("role_action", {desc = "getFPoint", int1 = 1})
575 end 585 end
576 elseif cmd == 3 then -- 一键赠送领取 586 elseif cmd == 3 then -- 一键赠送领取
577 -- 赠送 587 -- 赠送
@@ -593,6 +603,8 @@ function _M.pointRpc(agent, data) @@ -593,6 +603,8 @@ function _M.pointRpc(agent, data)
593 role.dailyData:updateProperty({field = "giveFP", value = giveP}) 603 role.dailyData:updateProperty({field = "giveFP", value = giveP})
594 role:checkTaskEnter("GiveFriendP", {count = change}) 604 role:checkTaskEnter("GiveFriendP", {count = change})
595 605
  606 + role:mylog("role_action", {desc = "giveFPoint", int1 = change})
  607 +
596 else 608 else
597 result = 1 609 result = 1
598 end 610 end
@@ -617,6 +629,7 @@ function _M.pointRpc(agent, data) @@ -617,6 +629,7 @@ function _M.pointRpc(agent, data)
617 reward = role:award({[ItemId.FriendPoint] = getCount}, {log = {desc = "friendPoint"}}) 629 reward = role:award({[ItemId.FriendPoint] = getCount}, {log = {desc = "friendPoint"}})
618 role.dailyData:updateProperty({field = "getFP", value = getP}) 630 role.dailyData:updateProperty({field = "getFP", value = getP})
619 role:checkTaskEnter("GetFriendP", {count = getCount}) 631 role:checkTaskEnter("GetFriendP", {count = getCount})
  632 + role:mylog("role_action", {desc = "getFPoint", int1 = getCount})
620 else 633 else
621 result = (result or 0) + 2 634 result = (result or 0) + 2
622 end 635 end
src/actions/GmAction.lua
@@ -446,18 +446,33 @@ function _M.email(role, pms) @@ -446,18 +446,33 @@ function _M.email(role, pms)
446 return "成功" 446 return "成功"
447 end 447 end
448 448
449 -table.insert(helpDes, {"清除引导", "cguide", "0全/1强/2弱"})  
450 -function _M.cguide(role, pms)  
451 - local id = tonum(pms.pm1, 0)  
452 - if id == 0 then  
453 - role:updateProperties({  
454 - newerGuide = "1=1",  
455 - funcGuide = "",  
456 - }, notNotify)  
457 - elseif id == 1 then  
458 - role:updateProperty({field = "newerGuide", value = "1=1"})  
459 - elseif id == 2 then  
460 - role:updateProperty({field = "funcGuide", value = ""}) 449 +table.insert(helpDes, {"引导", "guide", "skip/reset"})
  450 +function _M.guide(role, pms)
  451 + local cmd = pms.pm1 or "un"
  452 + if cmd == "SKIP" then
  453 + role:updateProperty({field = "newerGuide", value = "9999=1"})
  454 + local str = ""
  455 + for _, set in pairs(csvdb["guide_mainCsv"]) do
  456 + str = str:setv(set[1].major * 1000,1)
  457 + for _,data in ipairs(set) do
  458 + if data["break"] ~= 0 then
  459 + str = str:setv(data.major * 1000 + data.minor,1)
  460 + end
  461 + end
  462 + end
  463 + role:updateProperty({field = "funcGuide", value = str})
  464 + elseif cmd == "RESET" then
  465 + local id = tonum(pms.pm2, 0)
  466 + if id == 0 then
  467 + role:updateProperties({
  468 + newerGuide = "1=1",
  469 + funcGuide = "",
  470 + }, notNotify)
  471 + elseif id == 1 then
  472 + role:updateProperty({field = "newerGuide", value = "1=1"})
  473 + elseif id == 2 then
  474 + role:updateProperty({field = "funcGuide", value = ""})
  475 + end
461 end 476 end
462 477
463 return "成功" 478 return "成功"
@@ -472,7 +487,7 @@ function _M.test(role, pms) @@ -472,7 +487,7 @@ function _M.test(role, pms)
472 local id = tonum(pms.pm1, 0) 487 local id = tonum(pms.pm1, 0)
473 --local hero = require ("actions.HeroAction") 488 --local hero = require ("actions.HeroAction")
474 --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) 489 --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id}))
475 - role.storeData:onBattleCardReset() 490 + print(role:getNextCarbonId(id))
476 return "成功" 491 return "成功"
477 end 492 end
478 493
src/actions/HangAction.lua
@@ -258,6 +258,7 @@ function _M.endBattleRpc(agent, data) @@ -258,6 +258,7 @@ function _M.endBattleRpc(agent, data)
258 role:finishGuide(5) 258 role:finishGuide(5)
259 elseif carbonId == 10102 then 259 elseif carbonId == 10102 then
260 role:finishGuide(8) 260 role:finishGuide(8)
  261 + role:saveGuide(9, 2)
261 elseif carbonId == 10103 then 262 elseif carbonId == 10103 then
262 role:finishGuide(9) 263 role:finishGuide(9)
263 elseif carbonId == 10220 then 264 elseif carbonId == 10220 then
@@ -270,8 +271,15 @@ function _M.endBattleRpc(agent, data) @@ -270,8 +271,15 @@ function _M.endBattleRpc(agent, data)
270 end 271 end
271 end 272 end
272 end 273 end
273 - if hangInfo.carbonId < carbonId then  
274 - hangInfo.carbonId = carbonId 274 + local nextCarbonId = role:getNextCarbonId(carbonId)
  275 + -- 设置挂机关卡
  276 + if isWin and hangInfo.carbonId < nextCarbonId then
  277 + hangInfo.carbonId = nextCarbonId
  278 + local cfg = csvdb["idle_battleCsv"][nextCarbonId]
  279 + if cfg then
  280 + hangInfo.bossTime = skynet.timex() + cfg.idle_time
  281 + print(hangInfo.bossTime)
  282 + end
275 end 283 end
276 role:updateProperty({field = "hangInfo", value = hangInfo}) 284 role:updateProperty({field = "hangInfo", value = hangInfo})
277 285
src/actions/HeroAction.lua
@@ -57,6 +57,7 @@ function _M.levelUpRpc( agent, data ) @@ -57,6 +57,7 @@ function _M.levelUpRpc( agent, data )
57 if hero:getProperty("type") == 103 then 57 if hero:getProperty("type") == 103 then
58 role:finishGuide(7) 58 role:finishGuide(7)
59 end 59 end
  60 + hero:mylog({desc = "levelUp", int1 = hero:getProperty("level")})
60 61
61 role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")}) 62 role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")})
62 SendPacket(actionCodes.Hero_levelUpRpc, '') 63 SendPacket(actionCodes.Hero_levelUpRpc, '')
@@ -84,6 +85,7 @@ function _M.breakRpc( agent, data ) @@ -84,6 +85,7 @@ function _M.breakRpc( agent, data )
84 hero_break_result = getChangeAttrJson(oldAttr, hero:getTotalAttrs()), -- 英雄突破效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} 85 hero_break_result = getChangeAttrJson(oldAttr, hero:getTotalAttrs()), -- 英雄突破效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}
85 hero_break_level = hero:getMaxLevel(), -- 英雄突破后等级上限 86 hero_break_level = hero:getMaxLevel(), -- 英雄突破后等级上限
86 }) 87 })
  88 + hero:mylog({desc = "break", int1 = hero:getProperty("breakL")})
87 89
88 SendPacket(actionCodes.Hero_breakRpc, '') 90 SendPacket(actionCodes.Hero_breakRpc, '')
89 return true 91 return true
@@ -107,6 +109,7 @@ function _M.wakeRpc(agent, data) @@ -107,6 +109,7 @@ function _M.wakeRpc(agent, data)
107 role:costItems(cost, {log = {desc = "heroWake", int1 = msg.id, int2 = hero:getProperty("type")}}) 109 role:costItems(cost, {log = {desc = "heroWake", int1 = msg.id, int2 = hero:getProperty("type")}})
108 110
109 local oldAttr = hero:getTotalAttrs() 111 local oldAttr = hero:getTotalAttrs()
  112 + local oldBattleV = hero:getProperty("battleV")
110 hero:updateProperty({field = "wakeL", delta = 1}) 113 hero:updateProperty({field = "wakeL", delta = 1})
111 114
112 local curLevel = hero:getProperty("wakeL") 115 local curLevel = hero:getProperty("wakeL")
@@ -114,11 +117,13 @@ function _M.wakeRpc(agent, data) @@ -114,11 +117,13 @@ function _M.wakeRpc(agent, data)
114 if curLevel == 4 then -- 解锁cg 117 if curLevel == 4 then -- 解锁cg
115 role:checkTaskEnter("WakeCG", {heroType = typ}) 118 role:checkTaskEnter("WakeCG", {heroType = typ})
116 end 119 end
  120 + hero:mylog({desc = "wake", int1 = hero:getProperty("wakeL")})
117 121
118 role:log("hero_rise", { 122 role:log("hero_rise", {
119 hero_id = typ, --英雄ID 123 hero_id = typ, --英雄ID
120 hero_rise_cost = cost, --英雄觉醒消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} 124 hero_rise_cost = cost, --英雄觉醒消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
121 hero_rise_score = hero:getProperty("battleV"), --英雄觉醒后评分提升 125 hero_rise_score = hero:getProperty("battleV"), --英雄觉醒后评分提升
  126 + hero_rise_scoreget = hero:getProperty("battleV") - oldBattleV, --英雄觉醒后评分提升
122 hero_rise_result = getChangeAttrJson(oldAttr, hero:getTotalAttrs()), --英雄觉醒效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} 127 hero_rise_result = getChangeAttrJson(oldAttr, hero:getTotalAttrs()), --英雄觉醒效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}
123 }) 128 })
124 129
@@ -195,10 +200,12 @@ function _M.talentRpc(agent, data) @@ -195,10 +200,12 @@ function _M.talentRpc(agent, data)
195 200
196 role:log("hero_talent", { 201 role:log("hero_talent", {
197 hero_id = hero:getProperty("type"), --英雄ID 202 hero_id = hero:getProperty("type"), --英雄ID
  203 + hero_talent_id = index, --天赋ID
198 hero_talent_cost = cost, -- 英雄天赋升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} 204 hero_talent_cost = cost, -- 英雄天赋升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
199 hero_talent_levelbef = oldSkillLv, -- 英雄技能升级前等级 205 hero_talent_levelbef = oldSkillLv, -- 英雄技能升级前等级
200 hero_talent_level = hero:getSkillLevel(1), -- 英雄技能升级后等级 206 hero_talent_level = hero:getSkillLevel(1), -- 英雄技能升级后等级
201 }) 207 })
  208 + hero:mylog({desc = "talent", int1 = index, int2 = talent:getv(index, 0)})
202 209
203 SendPacket(actionCodes.Hero_talentRpc, '') 210 SendPacket(actionCodes.Hero_talentRpc, '')
204 return true 211 return true
@@ -499,7 +506,7 @@ function _M.referEquipsRpc(agent, data) @@ -499,7 +506,7 @@ function _M.referEquipsRpc(agent, data)
499 local curAttr = hero:getTotalAttrs() 506 local curAttr = hero:getTotalAttrs()
500 local attrChange = getChangeAttrJson(oldAttr, curAttr) 507 local attrChange = getChangeAttrJson(oldAttr, curAttr)
501 for typ, data in pairs(wear) do 508 for typ, data in pairs(wear) do
502 - role:log("hero_jewel", { 509 + role:log("equip_wear", {
503 hero_id = hero:getProperty("type"), --英雄ID 510 hero_id = hero:getProperty("type"), --英雄ID
504 equip_id = data.id, --装备ID 511 equip_id = data.id, --装备ID
505 equip_wear_action = data.act, --装备操作类型:装备:0,卸载:1 512 equip_wear_action = data.act, --装备操作类型:装备:0,卸载:1
@@ -577,14 +584,16 @@ function _M.referRunesRpc(agent, data) @@ -577,14 +584,16 @@ function _M.referRunesRpc(agent, data)
577 local attrChange = getChangeAttrJson(oldAttr, hero:getTotalAttrs()) 584 local attrChange = getChangeAttrJson(oldAttr, hero:getTotalAttrs())
578 for runeId, typ in pairs(wear) do 585 for runeId, typ in pairs(wear) do
579 local ownRune = role.runeBag[runeId] 586 local ownRune = role.runeBag[runeId]
580 - role:log("hero_jewel", {  
581 - hero_id = hero:getProperty("type"), -- 英雄ID  
582 - hero_jewel_id = ownRune:getProperty("id"), -- 铭文ID  
583 - hero_jewel_part = typ, -- 铭文装备部位  
584 - hero_jewel_score = hero:getProperty("battleV"), -- 铭文装备后的英雄分值  
585 - hero_jewel_scorebefore = oldBattleV, -- 铭文装备前的英雄分值  
586 - hero_jewel_result = attrChange, -- 铭文装备后效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}  
587 - }) 587 + if ownRune then
  588 + role:log("hero_jewel", {
  589 + hero_id = hero:getProperty("type"), -- 英雄ID
  590 + hero_jewel_id = ownRune:getProperty("id"), -- 铭文ID
  591 + hero_jewel_part = typ, -- 铭文装备部位
  592 + hero_jewel_score = hero:getProperty("battleV"), -- 铭文装备后的英雄分值
  593 + hero_jewel_scorebefore = oldBattleV, -- 铭文装备前的英雄分值
  594 + hero_jewel_result = attrChange, -- 铭文装备后效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}
  595 + })
  596 + end
588 end 597 end
589 598
590 SendPacket(actionCodes.Hero_referRunesRpc, "") 599 SendPacket(actionCodes.Hero_referRunesRpc, "")
@@ -671,9 +680,27 @@ function _M.getResetRewardRpc(agent, data) @@ -671,9 +680,27 @@ function _M.getResetRewardRpc(agent, data)
671 end 680 end
672 end 681 end
673 682
674 - hero:updateProperty({field = "level", value = level})  
675 - hero:updateProperty({field = "breakL", value = breakL})  
676 - hero:updateProperty({field = "talent", value = ""}) 683 + local equip = hero:getProperty("equip")
  684 + for k, v in pairs(equip:toNumMap()) do
  685 + role:addEquip(k, v, 1, {log = {desc = "resetHero", int1 = msg.id, int2 = hero:getProperty("type")}})
  686 + end
  687 +
  688 + local rune = hero:getProperty("rune")
  689 + for _, id in pairs(rune:toNumMap()) do
  690 + local curRune = role.runeBag[id]
  691 + if curRune then
  692 + curRune:updateProperty({field = "refer", value = 0})
  693 + end
  694 + end
  695 +
  696 + hero:updateProperties({
  697 + level = level,
  698 + breakL = breakL,
  699 + talent = "",
  700 + equip = "",
  701 + rune = "",
  702 + })
  703 + hero:mylog({desc = "resetHero"})
677 704
678 for itemId, count in pairs(reward) do 705 for itemId, count in pairs(reward) do
679 reward[itemId] = math.floor(count * globalCsv.unit_back_discount) 706 reward[itemId] = math.floor(count * globalCsv.unit_back_discount)
@@ -682,7 +709,7 @@ function _M.getResetRewardRpc(agent, data) @@ -682,7 +709,7 @@ function _M.getResetRewardRpc(agent, data)
682 reward, change = role:award(reward, {log = {desc = "resetHero", int1 = msg.id, int2 = hero:getProperty("type")}}) 709 reward, change = role:award(reward, {log = {desc = "resetHero", int1 = msg.id, int2 = hero:getProperty("type")}})
683 710
684 role:log("hero_recycle", { 711 role:log("hero_recycle", {
685 - hero_recycle_list = hero:getProperty("type"), -- 回收的英雄id列表,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} 712 + hero_recycle_list = {[hero:getProperty("type")] = 1}, -- 回收的英雄id列表,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
686 hero_recycle_reward = reward, -- 回收后获得的奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} 713 hero_recycle_reward = reward, -- 回收后获得的奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
687 hero_recycle_cnt = 1, -- 总回收英雄量 714 hero_recycle_cnt = 1, -- 总回收英雄量
688 }) 715 })
@@ -813,6 +840,7 @@ function _M.drawHeroRpc(agent, data) @@ -813,6 +840,7 @@ function _M.drawHeroRpc(agent, data)
813 840
814 local ssrCount = 0 841 local ssrCount = 0
815 local reward = {} 842 local reward = {}
  843 + local logReward = {}
816 for i = 1, drawCount[drawType] do 844 for i = 1, drawCount[drawType] do
817 floorHeroCount = floorHeroCount + 1 845 floorHeroCount = floorHeroCount + 1
818 local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts 846 local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts
@@ -843,9 +871,11 @@ function _M.drawHeroRpc(agent, data) @@ -843,9 +871,11 @@ function _M.drawHeroRpc(agent, data)
843 local heroData = csvdb["unitCsv"][fragId] 871 local heroData = csvdb["unitCsv"][fragId]
844 local count = globalCsv.draw_unit_tofragment[heroData.rare] 872 local count = globalCsv.draw_unit_tofragment[heroData.rare]
845 role:award({[fragId] = count}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) 873 role:award({[fragId] = count}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}})
  874 + logReward[fragId] = (logReward[fragId] or 0) + count
846 table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1}) 875 table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1})
847 else 876 else
848 role:award({[itemId] = 1}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) 877 role:award({[itemId] = 1}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}})
  878 + logReward[itemId] = (logReward[itemId] or 0) + 1
849 table.insert(reward, {id = itemId, count = 1}) 879 table.insert(reward, {id = itemId, count = 1})
850 end 880 end
851 end 881 end
@@ -856,27 +886,50 @@ function _M.drawHeroRpc(agent, data) @@ -856,27 +886,50 @@ function _M.drawHeroRpc(agent, data)
856 role:setProperty("floorHero", floorHero) 886 role:setProperty("floorHero", floorHero)
857 end 887 end
858 888
859 - if btype == 1 or btype == 2 then  
860 - local repayHero = role:getProperty("repayHero") or 0  
861 - repayHero = repayHero + drawCount[drawType]  
862 - role:updateProperty({field = "repayHero", value = repayHero})  
863 - end  
864 -  
865 role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]}) 889 role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]})
866 if ssrCount > 0 then 890 if ssrCount > 0 then
867 role:checkTaskEnter("DrawSSR", {count = ssrCount}) 891 role:checkTaskEnter("DrawSSR", {count = ssrCount})
868 end 892 end
869 role:finishGuide(11) 893 role:finishGuide(11)
870 - 894 +
871 role:log("gacha", { 895 role:log("gacha", {
872 gacha_id = poolId, -- 卡池ID 896 gacha_id = poolId, -- 卡池ID
873 gacha_type = btype, -- 卡池类型 897 gacha_type = btype, -- 卡池类型
874 gacha_up = 0, -- 卡池UP角色 898 gacha_up = 0, -- 卡池UP角色
875 gacha_times = drawCount[drawType], -- 抽卡次数 899 gacha_times = drawCount[drawType], -- 抽卡次数
876 - gacha_reward = reward, -- 抽卡结果,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} 900 + gacha_reward = logReward, -- 抽卡结果,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
877 currency = cost, -- 购买道具消耗的货币 901 currency = cost, -- 购买道具消耗的货币
  902 + gacha_cnt = floorHeroCount,
878 }) 903 })
879 SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 904 SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组
  905 +
  906 + if btype == 1 or btype == 2 then
  907 + -- 达到一定次数,给响应奖励
  908 + local oldVal = role:getProperty("repayHero") or 0
  909 + local newVal = oldVal + drawCount[drawType]
  910 + local drawCardReward, val = role:getDrawCardExtraReward(oldVal, newVal)
  911 + -- 空字符穿代表直接给英雄 走以前repayHeroRpc
  912 + if drawCardReward == "" then
  913 + local id = math.randWeight(csvdb["build_giftCsv"], "pool_1")
  914 +
  915 + local r,change = {}
  916 + local itemData = csvdb["itemCsv"][id]
  917 + --if itemData.type == ItemType.Hero and role:isHaveHero(itemData.id - ItemStartId.Hero) then
  918 + -- local fragId = itemData.id - ItemStartId.Hero
  919 + -- local heroData = csvdb["unitCsv"][fragId]
  920 + -- local count = globalCsv.draw_unit_tofragment[heroData.rare]
  921 + -- r, change = role:award({[fragId] = count}, {log = {desc = "drawHeroExtraReward"}})
  922 + -- --r = {id = fragId, count = count, from = id, fcount = 1}
  923 + --else
  924 + r, change = role:award({[id] = 1}, {log = {desc = "drawHeroExtraReward"}})
  925 + --end
  926 + SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change)))
  927 + elseif drawCardReward and drawCardReward ~= "" then
  928 + role:award(drawCardReward, {log = {desc = "drawHeroExtraReward", int1 = oldVal, int2 = newVal}})
  929 + SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack({reward = drawCardReward:toNumMap()}))
  930 + end
  931 + role:updateProperty({field = "repayHero", value = val})
  932 + end
880 return true 933 return true
881 end 934 end
882 935
@@ -905,6 +958,7 @@ function _M.repayHeroRpc(agent, data) @@ -905,6 +958,7 @@ function _M.repayHeroRpc(agent, data)
905 role:award({[id] = 1}, {log = {desc = "heroRepay"}}) 958 role:award({[id] = 1}, {log = {desc = "heroRepay"}})
906 reward = {id = id, count = 1} 959 reward = {id = id, count = 1}
907 end 960 end
  961 + role:mylog("hero_action", {desc = "heroRepay", int1=result})
908 SendPacket(actionCodes.Hero_repayHeroRpc, MsgPack.pack({reward = reward})) 962 SendPacket(actionCodes.Hero_repayHeroRpc, MsgPack.pack({reward = reward}))
909 return true 963 return true
910 end 964 end
@@ -936,12 +990,12 @@ function _M.unlockPoolRpc(agent, data) @@ -936,12 +990,12 @@ function _M.unlockPoolRpc(agent, data)
936 role.dailyData:updateProperty({field="unlockPool", value = unlockPool}) 990 role.dailyData:updateProperty({field="unlockPool", value = unlockPool})
937 role.dailyData:updateProperty({field="curPool", value = type}) 991 role.dailyData:updateProperty({field="curPool", value = type})
938 992
939 - --role:log("hero_action", {desc = "unlockPool", int1=type}) 993 + role:mylog("hero_action", {desc = "unlockPool", int1=type})
940 SendPacket(actionCodes.Hero_unlockPoolRpc, MsgPack.pack({})) 994 SendPacket(actionCodes.Hero_unlockPoolRpc, MsgPack.pack({}))
941 return true 995 return true
942 end 996 end
943 997
944 -function _M.changeCrown(agnet, data) 998 +function _M.changeCrown(agent, data)
945 local role = agent.role 999 local role = agent.role
946 local msg = MsgPack.unpack(data) 1000 local msg = MsgPack.unpack(data)
947 1001
src/actions/PvpAction.lua
@@ -296,6 +296,9 @@ function _M.startBattleRpc(agent, data) @@ -296,6 +296,9 @@ function _M.startBattleRpc(agent, data)
296 _pvpStartBattleCacheC = {idx = idx, key = key, revenge = revenge} 296 _pvpStartBattleCacheC = {idx = idx, key = key, revenge = revenge}
297 297
298 role:checkTaskEnter("PvpBattle") 298 role:checkTaskEnter("PvpBattle")
  299 +
  300 +
  301 + role:mylog("pvp_action", {desc = "startBattle", short1 = 1, int1 = revenge and 1 or 0})
299 end 302 end
300 303
301 SendPacket(actionCodes.Pvp_startBattleRpc, MsgPack.pack({matchInfo = matchInfo, key = key, result = result, wait = wait})) 304 SendPacket(actionCodes.Pvp_startBattleRpc, MsgPack.pack({matchInfo = matchInfo, key = key, result = result, wait = wait}))
@@ -393,6 +396,7 @@ function _M.endBattleRpc(agent, data) @@ -393,6 +396,7 @@ function _M.endBattleRpc(agent, data)
393 reward = reward, 396 reward = reward,
394 rank = myRank, 397 rank = myRank,
395 }) 398 })
  399 + role:mylog("pvp_action", {desc = "battleEnd", short1 = 1, int1 = isWin and 1 or 0, int2 = revenge and 1 or 0})
396 400
397 _pvpBattleInfoCacheC = {} --重新发阵容了 没毛病 401 _pvpBattleInfoCacheC = {} --重新发阵容了 没毛病
398 _pvpRecordInfoCacheC = {} -- 记录刷新了 402 _pvpRecordInfoCacheC = {} -- 记录刷新了
@@ -525,6 +529,8 @@ function _M.startBattleHRpc(agent, data) @@ -525,6 +529,8 @@ function _M.startBattleHRpc(agent, data)
525 529
526 role:checkTaskEnter("PvpBattle") 530 role:checkTaskEnter("PvpBattle")
527 531
  532 + role:mylog("pvp_action", {desc = "startBattle", short1 = 2, int1 = revenge and 1 or 0})
  533 +
528 end 534 end
529 535
530 SendPacket(actionCodes.Pvp_startBattleHRpc, MsgPack.pack({ 536 SendPacket(actionCodes.Pvp_startBattleHRpc, MsgPack.pack({
@@ -707,7 +713,8 @@ function _M.endBattleHRpc(agent, data) @@ -707,7 +713,8 @@ function _M.endBattleHRpc(agent, data)
707 if isWin then 713 if isWin then
708 role:checkTaskEnter("PvpWin", {score = myScore}) 714 role:checkTaskEnter("PvpWin", {score = myScore})
709 end 715 end
710 - 716 + role:mylog("pvp_action", {desc = "battleEnd", short1 = 2, int1 = isWin and 1 or 0, int2 = revenge and 1 or 0})
  717 +
711 SendPacket(actionCodes.Pvp_endBattleHRpc, MsgPack.pack({ 718 SendPacket(actionCodes.Pvp_endBattleHRpc, MsgPack.pack({
712 reward = reward, 719 reward = reward,
713 change = change, 720 change = change,
@@ -855,6 +862,7 @@ function _M.highDivisionGiftRpc(agent, data) @@ -855,6 +862,7 @@ function _M.highDivisionGiftRpc(agent, data)
855 }) 862 })
856 863
857 local reward, change = role:award(newReward, {log = {desc = "pvpDivisionH"}}) 864 local reward, change = role:award(newReward, {log = {desc = "pvpDivisionH"}})
  865 + role:mylog("pvp_action", {desc = "pvpDivisionH"})
858 866
859 SendPacket(actionCodes.Pvp_highDivisionGiftRpc, MsgPack.pack(role:packReward(reward, change))) 867 SendPacket(actionCodes.Pvp_highDivisionGiftRpc, MsgPack.pack(role:packReward(reward, change)))
860 return true 868 return true
@@ -889,6 +897,8 @@ function _M.shopBuyRpc(agent, data) @@ -889,6 +897,8 @@ function _M.shopBuyRpc(agent, data)
889 end 897 end
890 local reward, change = role:award(gift, {log = {desc = "pvpShop", int1 = id, int2 = count}}) 898 local reward, change = role:award(gift, {log = {desc = "pvpShop", int1 = id, int2 = count}})
891 899
  900 + role:mylog("pvp_action", {desc = "pvpShop", int1 = id, int2 = count})
  901 +
892 SendPacket(actionCodes.Pvp_shopBuyRpc, MsgPack.pack(role:packReward(reward, change))) 902 SendPacket(actionCodes.Pvp_shopBuyRpc, MsgPack.pack(role:packReward(reward, change)))
893 return true 903 return true
894 end 904 end
@@ -980,6 +990,7 @@ function _M.crossBetRpc(agent, data) @@ -980,6 +990,7 @@ function _M.crossBetRpc(agent, data)
980 local result, code = role:setCrossServerPvpBet(msg.idx) 990 local result, code = role:setCrossServerPvpBet(msg.idx)
981 if not result then return 10 + code end 991 if not result then return 10 + code end
982 992
  993 + role:mylog("pvp_action", {desc = "crossBet"})
983 SendPacket(actionCodes.Pvp_crossBetRpc, MsgPack.pack(result)) 994 SendPacket(actionCodes.Pvp_crossBetRpc, MsgPack.pack(result))
984 return true 995 return true
985 end 996 end
src/actions/RoleAction.lua
@@ -173,6 +173,7 @@ function _M.loginRpc( agent, data ) @@ -173,6 +173,7 @@ function _M.loginRpc( agent, data )
173 response.role = role:data() 173 response.role = role:data()
174 response.result = "SUCCESS" 174 response.result = "SUCCESS"
175 response.serverTime = now 175 response.serverTime = now
  176 + --response.openTime = getServerOpenTs()
176 177
177 local modules = {} 178 local modules = {}
178 179
@@ -548,7 +549,6 @@ function _M.openTimeBoxRpc(agent, data) @@ -548,7 +549,6 @@ function _M.openTimeBoxRpc(agent, data)
548 local quick = msg.quick 549 local quick = msg.quick
549 if not boxL[slot] then return end 550 if not boxL[slot] then return end
550 local costKey = 0 551 local costKey = 0
551 - local costTime = skynet.timex() - boxL[slot].time  
552 if boxL[slot].time > skynet.timex() then -- 没开完 552 if boxL[slot].time > skynet.timex() then -- 没开完
553 if not quick then return end 553 if not quick then return end
554 local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") 554 local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=")
@@ -559,6 +559,7 @@ function _M.openTimeBoxRpc(agent, data) @@ -559,6 +559,7 @@ function _M.openTimeBoxRpc(agent, data)
559 local boxId = boxL[slot].id 559 local boxId = boxL[slot].id
560 local itemData = csvdb["itemCsv"][boxId] 560 local itemData = csvdb["itemCsv"][boxId]
561 local randomData = csvdb["item_randomCsv"][itemData.id] 561 local randomData = csvdb["item_randomCsv"][itemData.id]
  562 + local costTime = skynet.timex() - (boxL[slot].time - randomData.openTime)
562 -- 随机奖励 563 -- 随机奖励
563 reward = {} 564 reward = {}
564 for i = 1, 10 do 565 for i = 1, 10 do
@@ -683,7 +684,7 @@ function _M.storyBookRewardRpc(agent, data) @@ -683,7 +684,7 @@ function _M.storyBookRewardRpc(agent, data)
683 role:changeUpdates({{ type = "storyB", field = storyId, value = storyStatus[storyId] }}) 684 role:changeUpdates({{ type = "storyB", field = storyId, value = storyStatus[storyId] }})
684 local reward, change = role:award(storyBookData.gift, {log = {desc = "storybookReward", int1 = storyId}}) 685 local reward, change = role:award(storyBookData.gift, {log = {desc = "storybookReward", int1 = storyId}})
685 686
686 - role:log("carriage_decals", { 687 + role:log("carriage_video", {
687 carriage_video_type = storyBookData.type, --放映室类型,剧情CG:0, 角色CG:1, 主线剧情:2, 角色剧情:3, 活动剧情:4, 图鉴:5 688 carriage_video_type = storyBookData.type, --放映室类型,剧情CG:0, 角色CG:1, 主线剧情:2, 角色剧情:3, 活动剧情:4, 图鉴:5
688 carriage_video_id = storyId, --放映室片段ID 689 carriage_video_id = storyId, --放映室片段ID
689 carriage_video_coinid = reward[ItemId.Gold] and ItemId.Gold or 0, --放映奖励货币类型,无奖励则填写0 690 carriage_video_coinid = reward[ItemId.Gold] and ItemId.Gold or 0, --放映奖励货币类型,无奖励则填写0
@@ -1194,4 +1195,43 @@ function _M.getDownloadCvRewardRpc(agent, data) @@ -1194,4 +1195,43 @@ function _M.getDownloadCvRewardRpc(agent, data)
1194 return true 1195 return true
1195 end 1196 end
1196 1197
  1198 +function _M.updateFeedbackInfoRpc(agent, data)
  1199 + local role = agent.role
  1200 + local info = role:getProperty("feedback") or {}
  1201 + local msg = MsgPack.unpack(data)
  1202 + info["flag"] = msg.flag
  1203 + info["count"] = msg.count
  1204 + info["ts"] = skynet.timex()
  1205 + role:updateProperty({field="feedback", value=info})
  1206 + SendPacket(actionCodes.Role_updateFeedbackInfoRpc, MsgPack.pack({}))
  1207 + return true
  1208 +end
  1209 +
  1210 +function _M.useSelectItemRpc(agent, data)
  1211 + local role = agent.role
  1212 + local msg = MsgPack.unpack(data)
  1213 + local itemId = msg.itemId
  1214 + local index = msg.index
  1215 + local count = msg.count
  1216 + if math.illegalNum(count, 1, role:getItemCount(itemId)) then return end
  1217 + local itemData = csvdb["itemCsv"][itemId]
  1218 + if itemData.type ~= ItemType.SelectItemBox then return end
  1219 + local itemMap = itemData.use_effect:toNumMap()
  1220 + local i = 1
  1221 + local reward, change = {}
  1222 + for k, v in pairs(itemMap) do
  1223 + if i == index then
  1224 + reward[k] = v * count
  1225 + break
  1226 + end
  1227 + i = i + 1
  1228 + end
  1229 +
  1230 + if next(reward) then
  1231 + reward, change = role:award(reward, {log = {desc = "openItem", int1 = itemId, int2 = count}})
  1232 + role:costItems({[itemId] = count}, {log = {desc = "openItem"}})
  1233 + end
  1234 + SendPacket(actionCodes.Role_useSelectItemRpc, MsgPack.pack(role:packReward(reward, change)))
  1235 +end
  1236 +
1197 return _M 1237 return _M
1198 \ No newline at end of file 1238 \ No newline at end of file
src/actions/StoreAction.lua
@@ -2,7 +2,6 @@ local _M = {} @@ -2,7 +2,6 @@ local _M = {}
2 2
3 local serverId = tonumber(skynet.getenv("servId")) 3 local serverId = tonumber(skynet.getenv("servId"))
4 local md5 = require "md5" 4 local md5 = require "md5"
5 -local pay_url = skynet.getenv("pay_url") or ""  
6 5
7 local function makeOrder(roleId, rechargeId) 6 local function makeOrder(roleId, rechargeId)
8 local orderId = redisproxy:hincrby("autoincrement_set", "order", 1) 7 local orderId = redisproxy:hincrby("autoincrement_set", "order", 1)
@@ -86,7 +85,7 @@ function _M.googleRechargeRpc(agent, data) @@ -86,7 +85,7 @@ function _M.googleRechargeRpc(agent, data)
86 money = dataSet.rmb * 100, 85 money = dataSet.rmb * 100,
87 game_money = dataSet.diamond, 86 game_money = dataSet.diamond,
88 product_id = dataSet.productId, 87 product_id = dataSet.productId,
89 - notify_url = pay_url .. "/pay/google" 88 + notify_url = msg.notifyUrl
90 } 89 }
91 local sign = signPms(need, secret_key) 90 local sign = signPms(need, secret_key)
92 91
@@ -112,7 +111,7 @@ function _M.myCardRechargeRpc(agent, data) @@ -112,7 +111,7 @@ function _M.myCardRechargeRpc(agent, data)
112 out_trade_no = partnerOrderId, 111 out_trade_no = partnerOrderId,
113 money = dataSet.rmb * 100, 112 money = dataSet.rmb * 100,
114 game_money = dataSet.diamond, 113 game_money = dataSet.diamond,
115 - notify_url = pay_url .. "/pay/mycard" 114 + notify_url = msg.notifyUrl
116 } 115 }
117 local sign = signPms(need, secret_key) 116 local sign = signPms(need, secret_key)
118 117
@@ -139,7 +138,7 @@ function _M.iosRechargeRpc(agent, data) @@ -139,7 +138,7 @@ function _M.iosRechargeRpc(agent, data)
139 money = dataSet.rmb * 100, 138 money = dataSet.rmb * 100,
140 game_money = dataSet.diamond, 139 game_money = dataSet.diamond,
141 product_id = dataSet.iap_product_id, 140 product_id = dataSet.iap_product_id,
142 - notify_url = pay_url .. "/pay/ios" 141 + notify_url = msg.notifyUrl
143 } 142 }
144 local sign = signPms(need, secret_key) 143 local sign = signPms(need, secret_key)
145 144
@@ -178,7 +177,7 @@ function _M.purchaseOrderResult(agent, data) @@ -178,7 +177,7 @@ function _M.purchaseOrderResult(agent, data)
178 item_level = 1, -- 购买的道具等级 177 item_level = 1, -- 购买的道具等级
179 order_cost = dataSet.rmb * 100, -- 此次消费的现金金额(单位:分),如 51800即未518元,对应客户端SDK传入的'total_fee' 178 order_cost = dataSet.rmb * 100, -- 此次消费的现金金额(单位:分),如 51800即未518元,对应客户端SDK传入的'total_fee'
180 order_currency = "CNY", -- 货币类型,默认为"CNY"(人民币),遵循ISO 4217规范 179 order_currency = "CNY", -- 货币类型,默认为"CNY"(人民币),遵循ISO 4217规范
181 - order_type = self.getProperty("rmbC") > 0 and 0 or 1, -- 订单类型,首充记录为1,否则为0 180 + order_type = role:getProperty("rmbC") > 0 and 0 or 1, -- 订单类型,首充记录为1,否则为0
182 order_id = msg.platformOrder, -- 本条记录的订单号,对应客户端SDK返回的'bs_trade_no' 181 order_id = msg.platformOrder, -- 本条记录的订单号,对应客户端SDK返回的'bs_trade_no'
183 }) 182 })
184 183
@@ -206,7 +205,7 @@ function _M.shopBuyRpc(agent , data) @@ -206,7 +205,7 @@ function _M.shopBuyRpc(agent , data)
206 if not dataSet then return end 205 if not dataSet then return end
207 206
208 if dataSet.unlock ~= "" then 207 if dataSet.unlock ~= "" then
209 - if not role:checkHangPass(tonumber(config.unlock)) then 208 + if not role:checkHangPass(tonumber(dataSet.unlock)) then
210 skynet.error(string.format("shopBuyRpc,user do not finish hang pass, user_id:%d", role:getProperty("id"))) 209 skynet.error(string.format("shopBuyRpc,user do not finish hang pass, user_id:%d", role:getProperty("id")))
211 return 1 210 return 1
212 end 211 end
@@ -261,6 +260,7 @@ function _M.shopBuyRpc(agent , data) @@ -261,6 +260,7 @@ function _M.shopBuyRpc(agent , data)
261 shop_purchase_current = costCount or 0, -- 购买道具消耗的货币数量 260 shop_purchase_current = costCount or 0, -- 购买道具消耗的货币数量
262 shop_id = dataSet.shop, -- 商店ID 261 shop_id = dataSet.shop, -- 商店ID
263 }) 262 })
  263 + role:mylog("role_action", {desc = desc, int1 = id, int2 = count})
264 SendPacket(actionCodes.Store_shopBuyRpc, MsgPack.pack({reward = reward})) 264 SendPacket(actionCodes.Store_shopBuyRpc, MsgPack.pack({reward = reward}))
265 return true 265 return true
266 end 266 end
@@ -323,6 +323,7 @@ function _M.getGrowFundRewardRpc(agent, data) @@ -323,6 +323,7 @@ function _M.getGrowFundRewardRpc(agent, data)
323 return true 323 return true
324 end 324 end
325 325
  326 +-- 赛季卡
326 function _M.getBattlePassRewardRpc(agent, data) 327 function _M.getBattlePassRewardRpc(agent, data)
327 local role = agent.role 328 local role = agent.role
328 local msg = MsgPack.unpack(data) 329 local msg = MsgPack.unpack(data)
@@ -377,4 +378,65 @@ function _M.getBattlePassRewardRpc(agent, data) @@ -377,4 +378,65 @@ function _M.getBattlePassRewardRpc(agent, data)
377 return true 378 return true
378 end 379 end
379 380
  381 +-- 探索指令奖励
  382 +function _M.getExploreCommandRewardRpc(agent, data)
  383 + local role = agent.role
  384 + local msg = MsgPack.unpack(data)
  385 + local id = msg.id -- 探索id
  386 + local subId = msg.subId -- 领取的阶段id
  387 +
  388 + local tab_name = "reward_levelpass" .. id .. "Csv"
  389 + local config = csvdb[tab_name][id]
  390 + if not config then return end
  391 +
  392 + local bpInfo = role.storeData:getProperty("bpInfo") or {}
  393 + local info = bpInfo[id] or {}
  394 + local flag = info["flag"] or 0
  395 + if flag == 0 then return 1 end
  396 +
  397 + local freeRecord = info["fr"] or ""
  398 + local buyRecord = info["br"] or ""
  399 +
  400 + local freeFlag = string.char(string.getbit(freeRecord, subId))
  401 + local limitFlag = string.char(string.getbit(buyRecord, subId))
  402 +
  403 + if freeFlag == "1" and limitFlag == "1" then
  404 + skynet.error("user already get explore command reward")
  405 + return 2
  406 + end
  407 +
  408 + if flag == 1 and limitFlag == "1" then
  409 + return 3
  410 + end
  411 +
  412 + if not role:checkHangPass(config.level) then
  413 + return 4
  414 + end
  415 +
  416 + local gift = ""
  417 + if freeFlag == "0" then
  418 + gift = config.giftFree
  419 +
  420 + freeRecord = string.setbit(freeRecord, id)
  421 + info["fr"] = freeRecord
  422 + end
  423 +
  424 + if flag == 1 and limitFlag == "0" then
  425 + if gift ~= "" then
  426 + gift = gift .. " "
  427 + end
  428 + gift = gift .. config.giftLimit
  429 +
  430 + buyRecord = string.setbit(buyRecord, id)
  431 + info["br"] = buyRecord
  432 + end
  433 +
  434 + role.storeData:updateProperty({field = "bpInfo", value = info})
  435 +
  436 + local reward, _ = role:award(gift, {log = {desc = "exploreCommand", int1 = id, int2 = subId}})
  437 +
  438 + SendPacket(actionCodes.Store_getExploreCommandRewardRpc, MsgPack.pack({reward = reward}))
  439 + return true
  440 +end
  441 +
380 return _M 442 return _M
381 \ No newline at end of file 443 \ No newline at end of file
src/actions/TowerAction.lua
@@ -75,7 +75,7 @@ function _M.startBattleRpc(agent, data) @@ -75,7 +75,7 @@ function _M.startBattleRpc(agent, data)
75 75
76 role:updateProperty({field = "towerInfo", value = towerInfo}) 76 role:updateProperty({field = "towerInfo", value = towerInfo})
77 role:checkTaskEnter("TowerBattle", {level = towerInfo.l}) 77 role:checkTaskEnter("TowerBattle", {level = towerInfo.l})
78 - 78 + role:mylog("tower_action", {desc = "startBattle", int1 = id})
79 SendPacket(actionCodes.Tower_startBattleRpc, '') 79 SendPacket(actionCodes.Tower_startBattleRpc, '')
80 return true 80 return true
81 end 81 end
@@ -128,6 +128,7 @@ function _M.endBattleRpc(agent, data) @@ -128,6 +128,7 @@ function _M.endBattleRpc(agent, data)
128 reward = reward, 128 reward = reward,
129 rank = rank, 129 rank = rank,
130 }) 130 })
  131 + role:mylog("tower_action", {desc = "endBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id})
131 132
132 SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({reward = reward, change = change})) 133 SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({reward = reward, change = change}))
133 return true 134 return true
@@ -151,7 +152,7 @@ function _M.bugCountRpc(agent, data) @@ -151,7 +152,7 @@ function _M.bugCountRpc(agent, data)
151 towerInfo.c = curCount 152 towerInfo.c = curCount
152 towerInfo.t = nextTime 153 towerInfo.t = nextTime
153 role:updateProperty({field = "towerInfo", value = towerInfo}) 154 role:updateProperty({field = "towerInfo", value = towerInfo})
154 - 155 + role:mylog("tower_action", {desc = "bugCount"})
155 SendPacket(actionCodes.Tower_bugCountRpc, '') 156 SendPacket(actionCodes.Tower_bugCountRpc, '')
156 return true 157 return true
157 end 158 end
@@ -24,6 +24,17 @@ function Adv:ctor(owner) @@ -24,6 +24,17 @@ function Adv:ctor(owner)
24 self:initByInfo(self.owner:getProperty("advInfo")) 24 self:initByInfo(self.owner:getProperty("advInfo"))
25 end 25 end
26 26
  27 +function Adv:mylog(contents)
  28 + contents = contents or {}
  29 + if contents["cint1"] or contents["cint2"] or contents["cint3"] then
  30 + print("advLog error log have cint1 or cint2 or cint3 ", debug.traceback())
  31 + end
  32 + contents["cint1"] = self.chapterId
  33 + contents["cint2"] = self.level
  34 +
  35 + self.owner:mylog("adv_action", contents)
  36 +end
  37 +
27 --初始化adv 信息 38 --初始化adv 信息
28 function Adv:initByInfo(advInfo) 39 function Adv:initByInfo(advInfo)
29 if not next(advInfo) then return end --还没有 开始新地图 40 if not next(advInfo) then return end --还没有 开始新地图
@@ -498,18 +509,18 @@ function Adv:awardArtifact(id, params) @@ -498,18 +509,18 @@ function Adv:awardArtifact(id, params)
498 self:checkAchievement(Adv.AchievType.GetMWeapon, 1, id) 509 self:checkAchievement(Adv.AchievType.GetMWeapon, 1, id)
499 510
500 511
501 - -- if params.log then  
502 - -- local log = clone(params.log)  
503 - -- if log["cint1"] or log["cint2"] or log["cint3"] then  
504 - -- print("awardArtifact error log have cint1 or cint2 or cint3 ", debug.traceback())  
505 - -- end  
506 - -- log["cint1"] = self.chapterId  
507 - -- log["cint2"] = self.level  
508 - -- log["cint3"] = id  
509 - -- self.owner:log("in_artifact", log)  
510 - -- else  
511 - -- print("awardArtifact no log ", debug.traceback())  
512 - -- end 512 + if params.log then
  513 + local log = clone(params.log)
  514 + if log["cint1"] or log["cint2"] or log["cint3"] then
  515 + print("awardArtifact error log have cint1 or cint2 or cint3 ", debug.traceback())
  516 + end
  517 + log["cint1"] = self.chapterId
  518 + log["cint2"] = self.level
  519 + log["cint3"] = id
  520 + self.owner:mylog("in_artifact", log)
  521 + else
  522 + print("awardArtifact no log ", debug.traceback())
  523 + end
513 if not params.isChoose then 524 if not params.isChoose then
514 self:pushBackEvent(AdvBackEventType.Artifact, {id = id}) 525 self:pushBackEvent(AdvBackEventType.Artifact, {id = id})
515 end 526 end
@@ -598,6 +609,7 @@ function Adv:wearArtifact(slot, id) @@ -598,6 +609,7 @@ function Adv:wearArtifact(slot, id)
598 else 609 else
599 id = nil 610 id = nil
600 end 611 end
  612 + self:mylog({desc = "wearArtifact", int1 = id})
601 613
602 self.owner:changeUpdates({{type = "advAFWear", field = slot, value = id}}) 614 self.owner:changeUpdates({{type = "advAFWear", field = slot, value = id}})
603 return true 615 return true
@@ -656,6 +668,9 @@ function Adv:artifactLevelUp(id, level) @@ -656,6 +668,9 @@ function Adv:artifactLevelUp(id, level)
656 end 668 end
657 if newLv == advAFGet[id] then return end 669 if newLv == advAFGet[id] then return end
658 670
  671 + self:mylog({desc = "artifactLevelUp", int1 = id, int2 = level})
  672 +
  673 +
659 local status = 0 674 local status = 0
660 if curWear[id] then -- 穿着呢 675 if curWear[id] then -- 穿着呢
661 local oldData = csvdb["adv_artifactCsv"][id][advAFGet[id]] 676 local oldData = csvdb["adv_artifactCsv"][id][advAFGet[id]]
@@ -700,6 +715,8 @@ function Adv:chooseArtifact(index) @@ -700,6 +715,8 @@ function Adv:chooseArtifact(index)
700 if not self.waitArtifact or not self.waitArtifact[index] then return end 715 if not self.waitArtifact or not self.waitArtifact[index] then return end
701 self:award({[self.waitArtifact[index]] = 1}, {log = {desc = "chooseArtifact"}, isChoose = true}) 716 self:award({[self.waitArtifact[index]] = 1}, {log = {desc = "chooseArtifact"}, isChoose = true})
702 717
  718 + self:mylog({desc = "chooseArtifact", int1 = self.waitArtifact[index]})
  719 +
703 self.waitArtifact = nil 720 self.waitArtifact = nil
704 721
705 -- 支援效果继续选择 722 -- 支援效果继续选择
@@ -789,9 +806,15 @@ function Adv:over(success, rewardRatio, overType) @@ -789,9 +806,15 @@ function Adv:over(success, rewardRatio, overType)
789 red:hset(RANK_ADV_INFO, roleId, MsgPack.pack(curInfo)) 806 red:hset(RANK_ADV_INFO, roleId, MsgPack.pack(curInfo))
790 end) 807 end)
791 end 808 end
  809 + -- 通关的时候要把引导步骤设定到成就引导
  810 + if not self.owner:checkOverGuide(57) then
  811 + self.owner:saveGuide(57,1,true)
  812 + end
792 end 813 end
793 self:clearAdvUnlockCache() 814 self:clearAdvUnlockCache()
794 815
  816 + self:mylog({desc = "over", short1 = success and 1 or 0, int1 = overType})
  817 +
795 local chapterId = self.chapterId 818 local chapterId = self.chapterId
796 self:clear() 819 self:clear()
797 self.owner:checkTaskEnter("AdvScore", {score = score}) 820 self.owner:checkTaskEnter("AdvScore", {score = score})
@@ -895,23 +918,26 @@ function Adv:award(gift, params) @@ -895,23 +918,26 @@ function Adv:award(gift, params)
895 items = items:setv(itemId, nums) 918 items = items:setv(itemId, nums)
896 end 919 end
897 920
898 - -- if params.log then  
899 - -- local log = clone(params.log)  
900 - -- if log["cint1"] or log["cint2"] or log["cint3"] or log["long1"] then  
901 - -- print("addAdvItem error log have cint1 or cint2 or cint3 ", debug.traceback())  
902 - -- end  
903 - -- log["cint1"] = itemId  
904 - -- log["cint2"] = math.abs(count)  
905 - -- log["cint3"] = self.chapterId  
906 - -- log["long1"] = self.level  
907 - -- if count >= 0 then  
908 - -- self.owner:log("in_adv", log)  
909 - -- else  
910 - -- self.owner:log("out_adv", log)  
911 - -- end  
912 - -- else  
913 - -- print("addAdvItem no log ", debug.traceback())  
914 - -- end 921 + if itemId == 16 and not self.owner:checkOverGuide(51,4) then
  922 + self.owner:saveGuide(51,4)
  923 + end
  924 + if params.log then
  925 + local log = clone(params.log)
  926 + if log["cint1"] or log["cint2"] or log["cint3"] or log["long1"] then
  927 + print("addAdvItem error log have cint1 or cint2 or cint3 ", debug.traceback())
  928 + end
  929 + log["cint1"] = itemId
  930 + log["cint2"] = math.abs(count)
  931 + log["cint3"] = self.chapterId
  932 + log["long1"] = self.level
  933 + if count >= 0 then
  934 + self.owner:mylog("in_adv", log)
  935 + else
  936 + self.owner:mylog("out_adv", log)
  937 + end
  938 + else
  939 + print("addAdvItem no log ", debug.traceback())
  940 + end
915 end 941 end
916 end 942 end
917 if items ~= oldItems then 943 if items ~= oldItems then
@@ -1005,6 +1031,7 @@ local function clickOut(self, room, block, params, isExit) @@ -1005,6 +1031,7 @@ local function clickOut(self, room, block, params, isExit)
1005 isRelay = true, 1031 isRelay = true,
1006 }) 1032 })
1007 else 1033 else
  1034 + self:mylog({desc = "pass"})
1008 self:initByChapter({ 1035 self:initByChapter({
1009 chapterId = self.chapterId, 1036 chapterId = self.chapterId,
1010 level = self.level + 1, 1037 level = self.level + 1,
src/adv/AdvBattle.lua
@@ -14,7 +14,6 @@ function Battle:ctor(adv) @@ -14,7 +14,6 @@ function Battle:ctor(adv)
14 self:initAfter() 14 self:initAfter()
15 if self.isNewPlayer then 15 if self.isNewPlayer then
16 self.player:triggerPassive(Passive.BORN_ONCE) 16 self.player:triggerPassive(Passive.BORN_ONCE)
17 - self.player:addExp((self.adv.level - 1) * 40)  
18 end 17 end
19 end 18 end
20 19
src/adv/AdvMap.lua
@@ -523,7 +523,7 @@ createMap = function(self, mapId, isEnter, isNewRelay) @@ -523,7 +523,7 @@ createMap = function(self, mapId, isEnter, isNewRelay)
523 --开放出口 523 --开放出口
524 randomFunc[AdvEventType.Diner] = function() 524 randomFunc[AdvEventType.Diner] = function()
525 -- if not self.adv.isRelay or isEnter or isNewRelay then return false end 525 -- if not self.adv.isRelay or isEnter or isNewRelay then return false end
526 - if not self.adv.isRelay or isEnter then return false end 526 + -- if not self.adv.isRelay or isEnter then return false end
527 end 527 end
528 528
529 --boss 529 --boss
@@ -553,7 +553,11 @@ createMap = function(self, mapId, isEnter, isNewRelay) @@ -553,7 +553,11 @@ createMap = function(self, mapId, isEnter, isNewRelay)
553 if randomCommon() == false then 553 if randomCommon() == false then
554 return false 554 return false
555 end 555 end
556 - table.insert(monsterEvents, event) 556 + local curData = csvdb["event_monsterCsv"][event.id]
  557 + if curData.noKey and curData.noKey == 1 then
  558 + else
  559 + table.insert(monsterEvents, event)
  560 + end
557 end 561 end
558 562
559 --选择点 563 --选择点
@@ -567,7 +571,7 @@ createMap = function(self, mapId, isEnter, isNewRelay) @@ -567,7 +571,7 @@ createMap = function(self, mapId, isEnter, isNewRelay)
567 end 571 end
568 --建筑 572 --建筑
569 randomFunc[AdvEventType.Build] = function() 573 randomFunc[AdvEventType.Build] = function()
570 - if self.adv.isRelay and isEnter then return false end 574 + -- if self.adv.isRelay and isEnter then return false end
571 return randomCommon() 575 return randomCommon()
572 end 576 end
573 --陷阱 577 --陷阱
src/adv/AdvTask.lua
@@ -132,10 +132,21 @@ function AdvTask.bind(Adv) @@ -132,10 +132,21 @@ function AdvTask.bind(Adv)
132 end 132 end
133 local advEventOpenStatus = self.owner:advEventOpenStatus() 133 local advEventOpenStatus = self.owner:advEventOpenStatus()
134 local pool = {} 134 local pool = {}
135 - for id, data in pairs(csvdb["event_questCsv"]) do  
136 - if data.levelchapter == chapterId and (data.unlockType == 0 or (advEventOpenStatus[etype] or {})[data.unlockType]) then  
137 - if AdvCommon.checkIsIn(level, data.leveltype, data.levellimit) then  
138 - pool[id] = {showup = data.showup} 135 +
  136 + local mapData = self:getCurMap():getMapInfoCsv()
  137 + for _, id in ipairs(mapData.quest:toArray(true, "=")) do
  138 + local data = csvdb["event_questCsv"][taskId]
  139 + if data then
  140 + pool[id] = {showup = data.showup}
  141 + end
  142 + end
  143 +
  144 + if not next(pool) then
  145 + for id, data in pairs(csvdb["event_questCsv"]) do
  146 + if data.levelchapter == chapterId and (data.unlockType == 0 or (advEventOpenStatus[etype] or {})[data.unlockType]) then
  147 + if AdvCommon.checkIsIn(level, data.leveltype, data.levellimit) then
  148 + pool[id] = {showup = data.showup}
  149 + end
139 end 150 end
140 end 151 end
141 end 152 end
@@ -365,6 +376,7 @@ function AdvTask.bind(Adv) @@ -365,6 +376,7 @@ function AdvTask.bind(Adv)
365 else 376 else
366 if (status or -1) >= data.value1 then 377 if (status or -1) >= data.value1 then
367 status = -1 378 status = -1
  379 + self.owner:mylog("adv_action", {desc = "finishAchiev", short1 = 1, int1 = self.chapterId, int2 = taskId})
368 end 380 end
369 if status and status ~= oldStatus then 381 if status and status ~= oldStatus then
370 insertChange(self, self.chapterId, taskId, status) 382 insertChange(self, self.chapterId, taskId, status)
@@ -53,6 +53,8 @@ end @@ -53,6 +53,8 @@ end
53 53
54 local _pipelinings = {} --可同时多个序列 栈的形式保证嵌套不出错 54 local _pipelinings = {} --可同时多个序列 栈的形式保证嵌套不出错
55 function SendPacket(actionCode, bin, client_fd) 55 function SendPacket(actionCode, bin, client_fd)
  56 + --print(actionHandlers[actionCode])
  57 + --dump(MsgPack.unpack(bin))
56 -- 内部消息不扩散出去 58 -- 内部消息不扩散出去
57 if actionCode == actionCodes.Sys_endlessSeason then 59 if actionCode == actionCodes.Sys_endlessSeason then
58 if agentInfo.role then 60 if agentInfo.role then
@@ -283,6 +285,7 @@ function CMD.close() @@ -283,6 +285,7 @@ function CMD.close()
283 local role = agentInfo.role 285 local role = agentInfo.role
284 if not role then return end 286 if not role then return end
285 role:log("onLogout", {logtime = skynet.timex()-role:getProperty("ltime")}) 287 role:log("onLogout", {logtime = skynet.timex()-role:getProperty("ltime")})
  288 + role:mylog("logout", {int1 = skynet.timex()-role:getProperty("ltime")})
286 role:onOfflineEvent() 289 role:onOfflineEvent()
287 end 290 end
288 291
1 -Subproject commit 2de1748bed665c9220f68eeb23a8ce3d1f810bda 1 +Subproject commit 2cd316b4df0f855713b9457114a97714df4d55f1
src/models/Activity.lua
@@ -8,6 +8,7 @@ Activity.ActivityType = { @@ -8,6 +8,7 @@ Activity.ActivityType = {
8 DrawHero = 4, --抽卡周 招募 8 DrawHero = 4, --抽卡周 招募
9 AdvDraw = 5, --拾荒抽周 资助 9 AdvDraw = 5, --拾荒抽周 资助
10 OpenBox = 6, --拆解周 时钟箱 10 OpenBox = 6, --拆解周 时钟箱
  11 + PaySignIn = 7, --付费签到
11 12
12 SsrUpPoolChange = 10, -- 特定英雄活动,切卡池 13 SsrUpPoolChange = 10, -- 特定英雄活动,切卡池
13 } 14 }
@@ -36,6 +37,7 @@ Activity.schema = { @@ -36,6 +37,7 @@ Activity.schema = {
36 act4 = {"table", {}}, -- {0 = 贩卖数量, 1=1, 2=1} 贩卖周活动 1表示领取过该档位的奖励 37 act4 = {"table", {}}, -- {0 = 贩卖数量, 1=1, 2=1} 贩卖周活动 1表示领取过该档位的奖励
37 act5 = {"table", {}}, -- {0 = 拆解数量, 1=1, 2=1} 拆解周活动 1表示领取过该档位的奖励 38 act5 = {"table", {}}, -- {0 = 拆解数量, 1=1, 2=1} 拆解周活动 1表示领取过该档位的奖励
38 act6 = {"table", {}}, -- {0 = 拾荒消耗远古金币数量, 1=1, 2=1} 拾荒周活动 1表示领取过该档位的奖励 39 act6 = {"table", {}}, -- {0 = 拾荒消耗远古金币数量, 1=1, 2=1} 拾荒周活动 1表示领取过该档位的奖励
  40 + act7 = {"table", {}}, -- {1 = 1, 2 = 1} == 付费签到活动
39 } 41 }
40 42
41 function Activity:data() 43 function Activity:data()
@@ -47,6 +49,7 @@ function Activity:data() @@ -47,6 +49,7 @@ function Activity:data()
47 act4 = self:getProperty("act4"), 49 act4 = self:getProperty("act4"),
48 act5 = self:getProperty("act5"), 50 act5 = self:getProperty("act5"),
49 act6 = self:getProperty("act6"), 51 act6 = self:getProperty("act6"),
  52 + act7 = self:getProperty("act7"),
50 } 53 }
51 end 54 end
52 55
@@ -257,7 +260,6 @@ activityFunc[Activity.ActivityType.DrawHero] = { @@ -257,7 +260,6 @@ activityFunc[Activity.ActivityType.DrawHero] = {
257 -- ["close"] = function(self, actType, notify) 260 -- ["close"] = function(self, actType, notify)
258 -- end, 261 -- end,
259 ["crossDay"] = function(self, actType, notify) 262 ["crossDay"] = function(self, actType, notify)
260 - print("cross day draw card")  
261 self.owner:sendMail(MailId.ActDrawCard) 263 self.owner:sendMail(MailId.ActDrawCard)
262 end, 264 end,
263 } 265 }
@@ -275,7 +277,6 @@ activityFunc[Activity.ActivityType.FoodSell] = { @@ -275,7 +277,6 @@ activityFunc[Activity.ActivityType.FoodSell] = {
275 -- ["close"] = function(self, actType, notify) 277 -- ["close"] = function(self, actType, notify)
276 -- end, 278 -- end,
277 ["crossDay"] = function(self, actType, notify) 279 ["crossDay"] = function(self, actType, notify)
278 - print("cross day sell food")  
279 self.owner:sendMail(MailId.ActSellFood) 280 self.owner:sendMail(MailId.ActSellFood)
280 end, 281 end,
281 } 282 }
@@ -310,11 +311,19 @@ activityFunc[Activity.ActivityType.OpenBox] = { @@ -310,11 +311,19 @@ activityFunc[Activity.ActivityType.OpenBox] = {
310 -- ["close"] = function(self, actType, notify) 311 -- ["close"] = function(self, actType, notify)
311 -- end, 312 -- end,
312 ["crossDay"] = function(self, actType, notify) 313 ["crossDay"] = function(self, actType, notify)
313 - print("cross day open box")  
314 self.owner:sendMail(MailId.ActOpenBox) 314 self.owner:sendMail(MailId.ActOpenBox)
315 end, 315 end,
316 } 316 }
317 317
  318 +-- 付费签到
  319 +activityFunc[Activity.ActivityType.PaySignIn] = {
  320 + ["init"] = function(self, actType, isCrossDay, notify)
  321 + self:updateActData(actType, {}, not notify)
  322 + end,
  323 + -- ["close"] = function(self, actType, notify)
  324 + -- end,
  325 +}
  326 +
318 function Activity:initActivity(actType, isCrossDay, notify) 327 function Activity:initActivity(actType, isCrossDay, notify)
319 if activityFunc[actType] and activityFunc[actType]['close'] then 328 if activityFunc[actType] and activityFunc[actType]['close'] then
320 activityFunc[actType]["init"](self, actType, isCrossDay, notify) 329 activityFunc[actType]["init"](self, actType, isCrossDay, notify)
@@ -384,5 +393,46 @@ function Activity:getActivityPool(mainType, subType) @@ -384,5 +393,46 @@ function Activity:getActivityPool(mainType, subType)
384 return 0 393 return 0
385 end 394 end
386 395
  396 +-- 付费签到可领奖励
  397 +function Activity:getPaySignReward()
  398 + local actGoodsFlag = self.owner.storeData:getProperty("actGoodsFlag")
  399 + local index = GetActGoodsIndex("paySignIn")
  400 + local flag = actGoodsFlag[index] or 0
  401 + if flag == 0 then return {} end
  402 +
  403 + if not self.owner.activity:isOpen("PaySignIn") then return {} end
  404 +
  405 + local diffDay = diffFromOpen() + 1
  406 +
  407 + local curData = self:getActData("PaySignIn")
  408 + local reward, change = {}
  409 + for day, csvData in pairs(csvdb["pay_signInCsv"]) do
  410 + if day <= diffDay then
  411 + if not curData[day] then
  412 + curData[day] = 1
  413 + -- 奖励
  414 + for itemId, count in pairs(csvData.reward:toNumMap()) do
  415 + reward[itemId] = (reward[itemId] or 0) + count
  416 + end
  417 + end
  418 + else
  419 + break
  420 + end
  421 + end
  422 + return reward, curData
  423 + --if next(reward) then
  424 + --role.activity:updateActData("PaySignIn", curData)
  425 + --reward, change = role:award(reward, {log = {desc = "actPaySign"}})
  426 + --end
  427 +
  428 + --role:log("activity", {
  429 + -- activity_id = curData[0], -- 活动ID(或活动指定任务的ID)
  430 + -- activity_type = role.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表
  431 + -- activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  432 + --})
  433 +
  434 + --SendPacket(actionCodes.Activity_actPaySignRpc, MsgPack.pack(role:packReward(reward, change)))
  435 +end
  436 +
387 437
388 return Activity 438 return Activity
src/models/HeroPlugin.lua
@@ -3,7 +3,7 @@ local HeroPlugin = {} @@ -3,7 +3,7 @@ local HeroPlugin = {}
3 3
4 function HeroPlugin.bind(Hero) 4 function HeroPlugin.bind(Hero)
5 5
6 - function Hero:log(contents) 6 + function Hero:mylog(contents)
7 contents = contents or {} 7 contents = contents or {}
8 if contents["cint1"] or contents["cint2"] or contents["cint3"] then 8 if contents["cint1"] or contents["cint2"] or contents["cint3"] then
9 print("heroLog error log have cint1 or cint2 or cint3 ", debug.traceback()) 9 print("heroLog error log have cint1 or cint2 or cint3 ", debug.traceback())
@@ -11,7 +11,7 @@ function HeroPlugin.bind(Hero) @@ -11,7 +11,7 @@ function HeroPlugin.bind(Hero)
11 contents["cint1"] = self:getProperty("id") 11 contents["cint1"] = self:getProperty("id")
12 contents["cint2"] = self:getProperty("type") 12 contents["cint2"] = self:getProperty("type")
13 13
14 - self.owner:log("hero_action", contents) 14 + self.owner:mylog("hero_action", contents)
15 end 15 end
16 16
17 function Hero:getMaxLevel() 17 function Hero:getMaxLevel()
src/models/Role.lua
@@ -165,6 +165,7 @@ Role.schema = { @@ -165,6 +165,7 @@ Role.schema = {
165 chatline = {"table", {}}, -- 奖励发放 id=时间 165 chatline = {"table", {}}, -- 奖励发放 id=时间
166 166
167 downCvR = {"number", 0}, -- 下载cv扩展包奖励 167 downCvR = {"number", 0}, -- 下载cv扩展包奖励
  168 + feedback = {"table", {}}, -- 反馈相关信息 {flag = false, count = 0} flag是否评论过,count 提示次数
168 } 169 }
169 170
170 171
@@ -383,6 +384,7 @@ function Role:data() @@ -383,6 +384,7 @@ function Role:data()
383 chatline = self:getProperty("chatline"), 384 chatline = self:getProperty("chatline"),
384 385
385 downCvR = self:getProperty("downCvR"), -- 下载cv扩展包奖励 386 downCvR = self:getProperty("downCvR"), -- 下载cv扩展包奖励
  387 + feedback = self:getProperty("feedback")
386 } 388 }
387 end 389 end
388 390
src/models/RoleBattle.lua
@@ -80,7 +80,7 @@ function Role:checkBattle(battleType, params) @@ -80,7 +80,7 @@ function Role:checkBattle(battleType, params)
80 for slot , one in pairs(self:getTeamBattleInfo(bTeam).supports) do 80 for slot , one in pairs(self:getTeamBattleInfo(bTeam).supports) do
81 teamskill[one[1]] = one[2] 81 teamskill[one[1]] = one[2]
82 end 82 end
83 - local carbonData = csvdb["tower_battleCsv"][params.id] 83 + local carbonData = csvdb["bonus_battleCsv"][params.id]
84 local monsterData = csvdb[carbonData.monster:match("/([^/]*)$") .. "Csv"] 84 local monsterData = csvdb[carbonData.monster:match("/([^/]*)$") .. "Csv"]
85 for slot, one in pairs(monsterData[1]) do 85 for slot, one in pairs(monsterData[1]) do
86 enemylist[#enemylist + 1] = one["unitType"] 86 enemylist[#enemylist + 1] = one["unitType"]
@@ -97,7 +97,7 @@ function Role:checkBattle(battleType, params) @@ -97,7 +97,7 @@ function Role:checkBattle(battleType, params)
97 if params.robotId then 97 if params.robotId then
98 local carbonData = csvdb["pvp_robotCsv"][params.robotId] 98 local carbonData = csvdb["pvp_robotCsv"][params.robotId]
99 local monsterData = csvdb[carbonData.monster:match("/([^/]*)$") .. "Csv"] 99 local monsterData = csvdb[carbonData.monster:match("/([^/]*)$") .. "Csv"]
100 - for slot, one in pairs(monsterData[1]) do 100 + for slot, one in pairs(monsterData) do
101 enemylist[#enemylist + 1] = one["unitType"] 101 enemylist[#enemylist + 1] = one["unitType"]
102 end 102 end
103 else 103 else
@@ -127,7 +127,7 @@ function Role:checkBattle(battleType, params) @@ -127,7 +127,7 @@ function Role:checkBattle(battleType, params)
127 for idx = 1, 3 do 127 for idx = 1, 3 do
128 enemylist[idx] = enemylist[idx] or {} 128 enemylist[idx] = enemylist[idx] or {}
129 local monsterData = csvdb[carbonData["monster" .. idx]:match("/([^/]*)$") .. "Csv"] 129 local monsterData = csvdb[carbonData["monster" .. idx]:match("/([^/]*)$") .. "Csv"]
130 - for slot, one in pairs(monsterData[1]) do 130 + for slot, one in pairs(monsterData) do
131 enemylist[idx][#enemylist + 1] = one["unitType"] 131 enemylist[idx][#enemylist + 1] = one["unitType"]
132 end 132 end
133 end 133 end
src/models/RoleLog.lua
1 -local server_id = (skynet.getenv("serverType") or "localtest") .. "_" .. skynet.getenv("servId") 1 +local serverId = skynet.getenv("servId")
  2 +local server_id = (skynet.getenv("serverType") or "localtest") .. "_" .. serverId
2 3
3 --[[ 4 --[[
4 100 购买/兑换行为 5 100 购买/兑换行为
@@ -38,6 +39,9 @@ local ItemReason = { @@ -38,6 +39,9 @@ local ItemReason = {
38 startPvp = 124, -- 开始pvp 39 startPvp = 124, -- 开始pvp
39 unlockStory = 125, -- 解锁剧情 40 unlockStory = 125, -- 解锁剧情
40 towerCount = 126, -- 电波塔次数 41 towerCount = 126, -- 电波塔次数
  42 + freeGift = 127, -- 免费礼包
  43 + exploreCommand = 128, -- 探索指令
  44 + drawHeroExtraReward = 129, -- 抽卡阶段奖励
41 45
42 46
43 advHang = 301, -- 拾荒挂机 47 advHang = 301, -- 拾荒挂机
@@ -75,6 +79,7 @@ local ItemReason = { @@ -75,6 +79,7 @@ local ItemReason = {
75 friendPoint = 1005, -- 友情 79 friendPoint = 1005, -- 友情
76 birth = 1006, -- 出生奖励 80 birth = 1006, -- 出生奖励
77 actSign = 1007, -- 活动签到 81 actSign = 1007, -- 活动签到
  82 + actPaySign = 1008, -- 活动付费签到
78 83
79 -- 餐厅 84 -- 餐厅
80 greenHourse = 1101, -- 食材获得 85 greenHourse = 1101, -- 食材获得
@@ -98,6 +103,7 @@ local ItemReason = { @@ -98,6 +103,7 @@ local ItemReason = {
98 resetHero = 1207, -- 重置养成 103 resetHero = 1207, -- 重置养成
99 unlockPool = 1208, -- 解锁英雄定向抽卡池 104 unlockPool = 1208, -- 解锁英雄定向抽卡池
100 downloadCv = 1209, -- 下载 cv包奖励 105 downloadCv = 1209, -- 下载 cv包奖励
  106 + refer = 1210, -- 穿戴
101 } 107 }
102 108
103 109
@@ -193,10 +199,9 @@ local MethodType = { @@ -193,10 +199,9 @@ local MethodType = {
193 mission_strength = true, -- 消耗的体力或次数 199 mission_strength = true, -- 消耗的体力或次数
194 mission_score = true, -- 本局分数,PVP玩法记录为对战后积分,无得分的填0 200 mission_score = true, -- 本局分数,PVP玩法记录为对战后积分,无得分的填0
195 mission_cleartype = true, -- 1正常通关;2代理拾荒 201 mission_cleartype = true, -- 1正常通关;2代理拾荒
196 - mission_rank = true, -- 对战后排名,适用于PVP玩法和电波塔,其他玩法留空 202 + mission_rank = "auto", -- 对战后排名,适用于PVP玩法和电波塔,其他玩法留空
197 misson_monsterkill = "json", -- 击杀怪物ID和数量,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} 203 misson_monsterkill = "json", -- 击杀怪物ID和数量,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
198 misson_teamskill = "json", -- 编队支援技能和技能等级情况,json格式记录,{"teamskill1":1,"teamskill2":2,………..} 204 misson_teamskill = "json", -- 编队支援技能和技能等级情况,json格式记录,{"teamskill1":1,"teamskill2":2,………..}
199 - misson_teambond = "json", -- 编队羁绊和羁绊等级,json格式记录,{"bondid1":1,"bondid2":2,………..}  
200 }, 205 },
201 residence_reward = { --玩家挂机或排名奖励 206 residence_reward = { --玩家挂机或排名奖励
202 mission_threadid = true, --大关卡ID 207 mission_threadid = true, --大关卡ID
@@ -210,6 +215,7 @@ local MethodType = { @@ -210,6 +215,7 @@ local MethodType = {
210 hero_id = true, --英雄ID 215 hero_id = true, --英雄ID
211 hero_rise_cost = "json", --英雄觉醒消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} 216 hero_rise_cost = "json", --英雄觉醒消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
212 hero_rise_score = true, --英雄觉醒后评分提升 217 hero_rise_score = true, --英雄觉醒后评分提升
  218 + hero_rise_scoreget = true, -- 提升的评分
213 hero_rise_result = "json", --英雄觉醒效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} 219 hero_rise_result = "json", --英雄觉醒效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}
214 }, 220 },
215 hero_upgrade = { --英雄升级 221 hero_upgrade = { --英雄升级
@@ -231,6 +237,7 @@ local MethodType = { @@ -231,6 +237,7 @@ local MethodType = {
231 hero_talent_cost = "json", -- 英雄天赋升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} 237 hero_talent_cost = "json", -- 英雄天赋升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
232 hero_talent_levelbef = true, -- 英雄技能升级前等级 238 hero_talent_levelbef = true, -- 英雄技能升级前等级
233 hero_talent_level = true, -- 英雄技能升级后等级 239 hero_talent_level = true, -- 英雄技能升级后等级
  240 + hero_talent_id = true, -- 天赋id
234 }, 241 },
235 hero_jewel = { --英雄铭文 242 hero_jewel = { --英雄铭文
236 hero_id = true, -- 英雄ID 243 hero_id = true, -- 英雄ID
@@ -262,6 +269,7 @@ local MethodType = { @@ -262,6 +269,7 @@ local MethodType = {
262 gacha_times = true, -- 抽卡次数 269 gacha_times = true, -- 抽卡次数
263 gacha_reward = "json", -- 抽卡结果,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} 270 gacha_reward = "json", -- 抽卡结果,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
264 currency = "json", -- 消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} 271 currency = "json", -- 消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
  272 + gacha_cnt = true, -- 保底计数
265 }, 273 },
266 equip_wear = { --装备穿戴与卸载 274 equip_wear = { --装备穿戴与卸载
267 hero_id = true, --英雄ID 275 hero_id = true, --英雄ID
@@ -279,7 +287,7 @@ local MethodType = { @@ -279,7 +287,7 @@ local MethodType = {
279 equip_upgrade_amount = true, -- 升级获取的装备数量 287 equip_upgrade_amount = true, -- 升级获取的装备数量
280 equip_upgrade_usedid = true, -- 升级消耗的装备ID 288 equip_upgrade_usedid = true, -- 升级消耗的装备ID
281 equip_upgrade_cost = true, -- 升级操作消耗装备数量 289 equip_upgrade_cost = true, -- 升级操作消耗装备数量
282 - equip_upgrade_current = true, -- 升级操作消耗货币数量 290 + equip_upgrade_current = "json", -- 升级操作消耗货币数量
283 }, 291 },
284 carriage_dismantle = { --物资拆解 292 carriage_dismantle = { --物资拆解
285 item_id = true, -- 道具id 293 item_id = true, -- 道具id
@@ -459,6 +467,178 @@ local function getBaseLog(self) @@ -459,6 +467,178 @@ local function getBaseLog(self)
459 end 467 end
460 468
461 469
  470 +-- logType
  471 +local LogType = {
  472 + create = "common",
  473 + login = "common",
  474 + logout = "common",
  475 + guide = "common",
  476 +
  477 + in_item = "common",
  478 + out_item = "common",
  479 + in_diamond = "common",
  480 + out_diamond = "common",
  481 + in_hero = "common",
  482 + out_hero = "common",
  483 + in_equip = "common",
  484 + out_equip = "common",
  485 + in_rune = "common",
  486 + out_rune = "common",
  487 + player_exp = "common",
  488 + func_open = "common",
  489 + in_adv = "common",
  490 + out_adv = "common",
  491 + in_artifact = "common",
  492 +
  493 + mail_action = "common",
  494 + role_action = "common",
  495 + hang_action = "common",
  496 + hero_action = "common",
  497 + adv_action = "common",
  498 + rune_action = "common",
  499 + pvp_action = "common",
  500 + diner_action = "common",
  501 + tower_action = "common",
  502 + gm_action = "common",
  503 + act_action = "common",
  504 +}
  505 +
  506 +-- 如要修改 要提前修改 _template mapping -- 对应 mapping 为 gamelog-*
  507 +local Mapping = {
  508 + -- 预留一些数据格式 担心integer 范围不够用 将 通用的int* 全部换为long
  509 + common = {
  510 + desc = "keyword",--索引的短字符串
  511 + ucode = "keyword",--关联日志对应ucode
  512 + key1 = "keyword", --可索引的短字符串
  513 + key2 = "keyword", --可索引的短字符串
  514 + -- 几乎不用的长文本
  515 + text1 = "text", --长字符串不索引的类型
  516 + -- 五个不同类型的数字 基本上满足数量要求 尽量从低到高用
  517 + short1 = "short",
  518 + int1 = "long",
  519 + int2 = "long",
  520 + long1 = "long",
  521 + float1 = "float",
  522 +
  523 + -- 底层使用的 一些参数
  524 + cint1 = "long",
  525 + cint2 = "long",
  526 + cint3 = "long",
  527 + }
  528 +}
  529 +
  530 +-- 所有的日志都包括的部分 role 里面的信息 -- mapping 信息在 gamelog-role
  531 +local commonRoleField = {
  532 + name = "keyword",
  533 + id = "integer",
  534 + uid = "keyword",
  535 + sid = "short",
  536 + device = "keyword",
  537 + ctime = "integer",
  538 + ltime = "integer",
  539 + level = "short",
  540 + rmbC = "integer",
  541 +}
  542 +
  543 +local function checkType(logType, field, value, ctype)
  544 + local typecheckfunc = {
  545 + keyword = function()
  546 + --长度不超过256
  547 + if type(value) ~= "string" then
  548 + value = tostring(value)
  549 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [keyword], value : %s", logType, field, value))
  550 + else
  551 + if #value > 256 then
  552 + printError(string.format("LOG ERROR: logType [%s] field [%s] [keyword] type to long. value : %s", logType, field, value))
  553 + end
  554 + end
  555 + return value
  556 + end,
  557 + text = function()
  558 + if type(value) ~= "string" then
  559 + value = tostring(value)
  560 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [text], value : %s", logType, field, value))
  561 + end
  562 + return value
  563 + end,
  564 + integer = function()
  565 + if type(value) ~= "number" then
  566 + value = tonumber(value)
  567 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], value : %s", logType, field, value))
  568 + end
  569 + if value then
  570 + if math.type(value) ~= "integer" then
  571 + local oldValue = value
  572 + value = math.floor(value)
  573 + if value ~= oldValue then
  574 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], is float, value : %s", logType, field, value))
  575 + end
  576 + end
  577 + if -2147483648 > value or value > 2147483647 then
  578 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], too big, value : %s", logType, field, value))
  579 + value = nil
  580 + end
  581 + end
  582 + return value
  583 + end,
  584 + short = function()
  585 + if type(value) ~= "number" then
  586 + value = tonumber(value)
  587 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], value : %s", logType, field, value))
  588 + end
  589 + if value then
  590 + if math.type(value) ~= "integer" then
  591 + local oldValue = value
  592 + value = math.floor(value)
  593 + if value ~= oldValue then
  594 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], is float, value : %s", logType, field, value))
  595 + end
  596 + end
  597 +
  598 + if -32768 > value or value > 32768 then
  599 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], too big, value : %s", logType, field, value))
  600 + value = nil
  601 + end
  602 + end
  603 + return value
  604 + end,
  605 + long = function()
  606 + if type(value) ~= "number" then
  607 + value = tonumber(value)
  608 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], value : %s", logType, field, value))
  609 + end
  610 + if value then
  611 + if math.type(value) ~= "integer" then
  612 + local oldValue = value
  613 + value = math.floor(value)
  614 + if type(value) ~= "integer" then
  615 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], too big, value : %s", logType, field, value))
  616 + value = nil
  617 + elseif value ~= oldValue then
  618 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], is float, value : %s", logType, field, value))
  619 + end
  620 + end
  621 + end
  622 + return value
  623 + end,
  624 + float = function()
  625 + if type(value) ~= "number" then
  626 + value = tonumber(value)
  627 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [float], value : %s", logType, field, value))
  628 + end
  629 + return value
  630 + end,
  631 + }
  632 +
  633 + if typecheckfunc[ctype] then
  634 + return typecheckfunc[ctype]()
  635 + else
  636 + printError(string.format("LOG ERROR: logType [%s] field [%s] have a new type [%s] need add check.", logType, field, ctype))
  637 + return nil
  638 + end
  639 +end
  640 +
  641 +
462 642
463 local RoleLog = {} 643 local RoleLog = {}
464 function RoleLog.bind(Role) 644 function RoleLog.bind(Role)
@@ -486,14 +666,15 @@ function RoleLog.bind(Role) @@ -486,14 +666,15 @@ function RoleLog.bind(Role)
486 for field, tag in pairs(schema) do 666 for field, tag in pairs(schema) do
487 if not contents[field] then 667 if not contents[field] then
488 if tag == "ucode" then 668 if tag == "ucode" then
489 - contents[field] = self:getActionUcode() 669 + doc[field] = self:getActionUcode()
  670 + elseif tag == "auto" then
490 else 671 else
491 printError(string.format("LOG ERROR: logType [%s] lose field [%s].", logType, field)) 672 printError(string.format("LOG ERROR: logType [%s] lose field [%s].", logType, field))
492 end 673 end
493 end 674 end
494 end 675 end
495 if not logd then return end 676 if not logd then return end
496 - pcall(skynet.send, logd, "lua", "log", doc) 677 + pcall(skynet.send, logd, "lua", "log", doc, "bi")
497 end 678 end
498 679
499 function Role:logItems(itemId, before, after, log) 680 function Role:logItems(itemId, before, after, log)
@@ -524,6 +705,38 @@ function RoleLog.bind(Role) @@ -524,6 +705,38 @@ function RoleLog.bind(Role)
524 }) 705 })
525 end 706 end
526 707
  708 + function Role:mylog(logType, contents)
  709 + contents = contents or {}
  710 + local _logType = LogType[logType]
  711 + if not _logType then
  712 + printError(string.format("LOG ERROR: new logType [%s] need Add Maping.", logType))
  713 + return
  714 + end
  715 + local doc = {}
  716 + for field, ctype in pairs(commonRoleField) do
  717 + if contents[field] then
  718 + printError(string.format("LOG ERROR: logType [%s] had field [%s] overwrite default.", logType, field))
  719 + end
  720 + doc[field] = checkType("commonRoleField", field, self:getProperty(field), ctype)
  721 + end
  722 +
  723 + local mapping = Mapping[_logType]
  724 + if mapping["ucode"] and not contents["ucode"] then
  725 + contents["ucode"] = self:getActionUcode()
  726 + end
  727 + for field, value in pairs(contents) do
  728 + local ftype = mapping[field]
  729 + if ftype then
  730 + doc[field] = checkType(logType, field, value, ftype)
  731 + else
  732 + printError(string.format("LOG ERROR: logType [%s] have new field [%s] no type in mapping.", logType, field))
  733 + end
  734 + end
  735 + doc["@type"] = logType
  736 + if not logd then return end
  737 + pcall(skynet.send, logd, "lua", "log", doc, "log")
  738 + end
  739 +
527 740
528 function Role:startActionUcode() 741 function Role:startActionUcode()
529 if not self._uniqueCount then 742 if not self._uniqueCount then
@@ -544,5 +757,6 @@ function RoleLog.bind(Role) @@ -544,5 +757,6 @@ function RoleLog.bind(Role)
544 end 757 end
545 758
546 759
  760 +
547 end 761 end
548 return RoleLog 762 return RoleLog
549 \ No newline at end of file 763 \ No newline at end of file
src/models/RolePlugin.lua
@@ -229,13 +229,28 @@ function RolePlugin.bind(Role) @@ -229,13 +229,28 @@ function RolePlugin.bind(Role)
229 self:log("setLevel", { 229 self:log("setLevel", {
230 level_before = oldLevel, 230 level_before = oldLevel,
231 level_changemain = log.desc, 231 level_changemain = log.desc,
232 - level_changedetail = log.sub or "", 232 + level_changedetail = log.int1 or 0,
233 level_reward = {}, 233 level_reward = {},
234 }) 234 })
235 else 235 else
236 print("addPlayExp no log ", debug.traceback()) 236 print("addPlayExp no log ", debug.traceback())
237 end 237 end
  238 + end
  239 +
  240 + if params.log then
  241 + local log = params.log
  242 + if log["cint1"] or log["cint2"] then
  243 + print("addPlayExp error log have cint1 or cint2 or cint3", debug.traceback())
  244 + end
238 245
  246 +
  247 + log["cint1"] = addExp
  248 + log["cint2"] = newExp
  249 + log["cint3"] = level
  250 +
  251 + self:mylog("player_exp", log)
  252 + else
  253 + print("addPlayExp no log ", debug.traceback())
239 end 254 end
240 255
241 self:updateProperties({level = level, exp = newExp}) 256 self:updateProperties({level = level, exp = newExp})
@@ -259,6 +274,21 @@ function RolePlugin.bind(Role) @@ -259,6 +274,21 @@ function RolePlugin.bind(Role)
259 end 274 end
260 275
261 self:logItems(params.itemId, origin, nums, params.log) 276 self:logItems(params.itemId, origin, nums, params.log)
  277 + if params.log then
  278 + local log = params.log
  279 + if log["cint1"] or log["cint2"] then
  280 + print("addItem error log have cint1 or cint2 ", debug.traceback())
  281 + end
  282 + log["cint1"] = params.itemId
  283 + log["cint2"] = math.abs(params.count)
  284 + if params.count <= 0 then
  285 + self:mylog("out_item", log)
  286 + else
  287 + self:mylog("in_item", log)
  288 + end
  289 + else
  290 + print("addItem no log ", debug.traceback())
  291 + end
262 292
263 self:setProperty("items", items) 293 self:setProperty("items", items)
264 if not params.notNotify then 294 if not params.notNotify then
@@ -329,11 +359,22 @@ function RolePlugin.bind(Role) @@ -329,11 +359,22 @@ function RolePlugin.bind(Role)
329 end 359 end
330 360
331 self:logItems(ItemId.Diamond, origin, count, params.log) 361 self:logItems(ItemId.Diamond, origin, count, params.log)
  362 + if params.log then
  363 + local log = params.log
  364 + if log["cint1"] or log["cint2"] or log["cint3"] then
  365 + print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback())
  366 + end
  367 + log["cint1"] = origin
  368 + log["cint2"] = count
  369 + self:mylog("in_diamond", log)
  370 + else
  371 + print("gainDiamond no log ", debug.traceback())
  372 + end
  373 +
332 self:notifyUpdateProperty("diamond", self:getAllDiamond()) 374 self:notifyUpdateProperty("diamond", self:getAllDiamond())
333 return true 375 return true
334 end 376 end
335 377
336 -  
337 function Role:costDiamond(params) 378 function Role:costDiamond(params)
338 if not params or type(params) ~= "table" then return false end 379 if not params or type(params) ~= "table" then return false end
339 local count = tonum(params.count) 380 local count = tonum(params.count)
@@ -368,6 +409,17 @@ function RolePlugin.bind(Role) @@ -368,6 +409,17 @@ function RolePlugin.bind(Role)
368 409
369 410
370 self:logItems(ItemId.Diamond, origin, count, params.log) 411 self:logItems(ItemId.Diamond, origin, count, params.log)
  412 + if params.log then
  413 + local log = params.log
  414 + if log["cint1"] or log["cint2"] or log["cint3"] then
  415 + print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback())
  416 + end
  417 + log["cint1"] = origin
  418 + log["cint2"] = count
  419 + self:mylog("out_diamond", log)
  420 + else
  421 + print("costDiamond no log ", debug.traceback())
  422 + end
371 423
372 self:notifyUpdateProperty("diamond", self:getAllDiamond()) 424 self:notifyUpdateProperty("diamond", self:getAllDiamond())
373 return true 425 return true
@@ -406,6 +458,17 @@ function RolePlugin.bind(Role) @@ -406,6 +458,17 @@ function RolePlugin.bind(Role)
406 458
407 self:logItems(heroType + ItemStartId.Hero, 0, 1, params.log) 459 self:logItems(heroType + ItemStartId.Hero, 0, 1, params.log)
408 460
  461 + if params.log then
  462 + local log = params.log
  463 + if log["cint1"] or log["cint2"] or log["cint3"] then
  464 + print("addHero error log have cint1 or cint2 or cint3 ", debug.traceback())
  465 + end
  466 + log["cint1"] = heroId
  467 + log["cint2"] = heroType
  468 + self:mylog("in_hero", log)
  469 + else
  470 + print("addHero no log ", debug.traceback())
  471 + end
409 return true, newHero 472 return true, newHero
410 end 473 end
411 474
@@ -516,6 +579,22 @@ function RolePlugin.bind(Role) @@ -516,6 +579,22 @@ function RolePlugin.bind(Role)
516 self:setProperty("equips", equips) 579 self:setProperty("equips", equips)
517 580
518 self:logItems(equipCsv.id, oldCount, curCount, pms.log) 581 self:logItems(equipCsv.id, oldCount, curCount, pms.log)
  582 + if pms.log then
  583 + local log = pms.log
  584 + if log["cint1"] or log["cint2"] or log["cint3"] then
  585 + print("addEquip error log have cint1 or cint2 or cint3 ", debug.traceback())
  586 + end
  587 + log["cint1"] = equipType
  588 + log["cint2"] = equipLv
  589 + log["cint3"] = math.abs(count)
  590 + if count < 0 then
  591 + self:mylog("out_equip", log)
  592 + else
  593 + self:mylog("in_equip", log)
  594 + end
  595 + else
  596 + print("addEquip no log ", debug.traceback())
  597 + end
519 598
520 if not pms.notNotify then 599 if not pms.notNotify then
521 self:changeUpdates({{type = "equips", field = {equipType, equipLv}, value = curCount, isOnlyToC = true}}) -- 通知客户端 600 self:changeUpdates({{type = "equips", field = {equipType, equipLv}, value = curCount, isOnlyToC = true}}) -- 通知客户端
@@ -576,6 +655,20 @@ function RolePlugin.bind(Role) @@ -576,6 +655,20 @@ function RolePlugin.bind(Role)
576 self:checkTaskEnter("AddRune", {id = params.id, type = params.type, rarity = data.rarity}, params.notNotify) 655 self:checkTaskEnter("AddRune", {id = params.id, type = params.type, rarity = data.rarity}, params.notNotify)
577 656
578 self:logItems(params.id, 0, 1, params.log) 657 self:logItems(params.id, 0, 1, params.log)
  658 + if params.log then
  659 + local log = params.log
  660 + if log["cint1"] or log["cint2"] or log["cint3"] then
  661 + print("addRune error log have cint1 or cint2 or cint3 ", debug.traceback())
  662 + end
  663 +
  664 + log["cint1"] = runeUid
  665 + log["cint2"] = params.type
  666 + log["cint3"] = params.id
  667 +
  668 + self:mylog("in_rune", log)
  669 + else
  670 + print("addRune no log ", debug.traceback())
  671 + end
579 672
580 return 0, newRune 673 return 0, newRune
581 else 674 else
@@ -592,6 +685,20 @@ function RolePlugin.bind(Role) @@ -592,6 +685,20 @@ function RolePlugin.bind(Role)
592 if rune and rune:getProperty("refer") == 0 then 685 if rune and rune:getProperty("refer") == 0 then
593 686
594 self:logItems(rune:getProperty("id"), 1, 0, params.log) 687 self:logItems(rune:getProperty("id"), 1, 0, params.log)
  688 + if params.log then
  689 + local log = params.log
  690 + if log["cint1"] or log["cint2"] or log["cint3"] then
  691 + print("delRunes error log have cint1 or cint2 or cint3 ", debug.traceback())
  692 + end
  693 +
  694 + log["cint1"] = runeId
  695 + log["cint2"] = rune:getProperty("type")
  696 + log["cint3"] = rune:getProperty("id")
  697 +
  698 + self:mylog("out_rune", log)
  699 + else
  700 + print("delRunes no log ", debug.traceback())
  701 + end
595 702
596 self.runeBag[runeId] = nil 703 self.runeBag[runeId] = nil
597 table.insert(bDel, runeId) 704 table.insert(bDel, runeId)
@@ -838,6 +945,19 @@ function RolePlugin.bind(Role) @@ -838,6 +945,19 @@ function RolePlugin.bind(Role)
838 count = count or 1 945 count = count or 1
839 946
840 self:logItems(func, 0, count, params.log) 947 self:logItems(func, 0, count, params.log)
  948 + if params.log then
  949 + local log = params.log
  950 + if log["cint1"] or log["cint2"] or log["cint3"] then
  951 + print("funcOpen error log have cint1 or cint2 or cint3 ", debug.traceback())
  952 + end
  953 +
  954 + log["cint1"] = func
  955 + log["cint2"] = count
  956 +
  957 + self:mylog("func_open", log)
  958 + else
  959 + print("funcOpen no log ", debug.traceback())
  960 + end
841 961
842 if csvdb["itemCsv"][func] and csvdb["itemCsv"][func].type == ItemType.FuncOpen then 962 if csvdb["itemCsv"][func] and csvdb["itemCsv"][func].type == ItemType.FuncOpen then
843 local unlockData = csvdb["unlockCsv"][func] 963 local unlockData = csvdb["unlockCsv"][func]
@@ -1393,7 +1513,10 @@ function RolePlugin.bind(Role) @@ -1393,7 +1513,10 @@ function RolePlugin.bind(Role)
1393 1513
1394 local order_type = self:getProperty("rmbC") > 0 and 0 or 1 1514 local order_type = self:getProperty("rmbC") > 0 and 0 or 1
1395 local status, reward = self:recharge({ 1515 local status, reward = self:recharge({
1396 - id = rechargeId 1516 + id = rechargeId,
  1517 + transactionId = params.transactionId,
  1518 + pay_time = params.pay_time,
  1519 + order = partnerOrderStr,
1397 }) 1520 })
1398 orderObject:setProperty("finishTime", skynet.time()) 1521 orderObject:setProperty("finishTime", skynet.time())
1399 orderObject:setProperty("status", "finish") 1522 orderObject:setProperty("status", "finish")
@@ -1413,7 +1536,7 @@ function RolePlugin.bind(Role) @@ -1413,7 +1536,7 @@ function RolePlugin.bind(Role)
1413 item_number = 1, -- 购买的道具数量 1536 item_number = 1, -- 购买的道具数量
1414 item_level = 1, -- 购买的道具等级 1537 item_level = 1, -- 购买的道具等级
1415 order_cost = rechargeData.rmb * 100, -- 此次消费的现金金额(单位:分),如 51800即未518元,对应客户端SDK传入的'total_fee' 1538 order_cost = rechargeData.rmb * 100, -- 此次消费的现金金额(单位:分),如 51800即未518元,对应客户端SDK传入的'total_fee'
1416 - order_currency = "CNY", -- 货币类型,默认为"CNY"(人民币),遵循ISO 4217规范 1539 + order_currency = "TWD", -- 货币类型,默认为"CNY"(人民币),遵循ISO 4217规范
1417 order_type = order_type, -- 订单类型,首充记录为1,否则为0 1540 order_type = order_type, -- 订单类型,首充记录为1,否则为0
1418 order_id = params.transactionId, -- 本条记录的订单号,对应客户端SDK返回的'bs_trade_no' 1541 order_id = params.transactionId, -- 本条记录的订单号,对应客户端SDK返回的'bs_trade_no'
1419 }) 1542 })
@@ -1451,7 +1574,7 @@ function RolePlugin.bind(Role) @@ -1451,7 +1574,7 @@ function RolePlugin.bind(Role)
1451 self:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}}) 1574 self:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}})
1452 elseif rechargeData.shop == 2 then --通行证商店 1575 elseif rechargeData.shop == 2 then --通行证商店
1453 reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) 1576 reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}})
1454 - self.storeData:onBuyCard(rechargeData.type, rechargeData.time) 1577 + self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id)
1455 elseif rechargeData.shop == 3 then -- 礼包商店 1578 elseif rechargeData.shop == 3 then -- 礼包商店
1456 reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) 1579 reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}})
1457 else 1580 else
@@ -1466,6 +1589,8 @@ function RolePlugin.bind(Role) @@ -1466,6 +1589,8 @@ function RolePlugin.bind(Role)
1466 -- 累充 1589 -- 累充
1467 local rmb = rechargeData.rmb 1590 local rmb = rechargeData.rmb
1468 self:updateProperty({field = "rmbC", delta = rmb}) 1591 self:updateProperty({field = "rmbC", delta = rmb})
  1592 +
  1593 + self:mylog("role_action", {desc = "recharge", int1 = id, int2 = rmb, key1 = params.transactionId, key2 = params.order, long1 = params.pay_time})
1469 1594
1470 return nil, reward 1595 return nil, reward
1471 end 1596 end
@@ -1513,6 +1638,7 @@ function RolePlugin.bind(Role) @@ -1513,6 +1638,7 @@ function RolePlugin.bind(Role)
1513 end 1638 end
1514 self:updateProperty({field = "funcGuide", value = funcGuide}) 1639 self:updateProperty({field = "funcGuide", value = funcGuide})
1515 self:log("onGuidePoint", {guild_type = 0, guild_id = master, guild_point = slave, guild_pass = 0}) 1640 self:log("onGuidePoint", {guild_type = 0, guild_id = master, guild_point = slave, guild_pass = 0})
  1641 + self:mylog("guide", {desc = "guide_new",int1 = master*1000+slave})
1516 1642
1517 newerGuide = string.format("%d=%d",master,slave) 1643 newerGuide = string.format("%d=%d",master,slave)
1518 self:updateProperty({field = "newerGuide", value = newerGuide}) 1644 self:updateProperty({field = "newerGuide", value = newerGuide})
@@ -1532,6 +1658,43 @@ function RolePlugin.bind(Role) @@ -1532,6 +1658,43 @@ function RolePlugin.bind(Role)
1532 self:updateProperty({field = "newerGuide", value = "9999=1"}) 1658 self:updateProperty({field = "newerGuide", value = "9999=1"})
1533 end 1659 end
1534 end 1660 end
  1661 +
  1662 + -- 抽卡阶段奖励
  1663 + function Role:getDrawCardExtraReward(oldVal, newVal)
  1664 + local reward = nil
  1665 + local maxCount = 0
  1666 + for k, v in pairs(csvdb["build_extraRewardCsv"]) do
  1667 + if oldVal < k and newVal >= k then
  1668 + reward = v["reward"] or ""
  1669 + end
  1670 + maxCount = k > maxCount and k or maxCount
  1671 + end
  1672 +
  1673 + return reward, (newVal >= maxCount and newVal - maxCount or newVal)
  1674 + end
  1675 +
  1676 + -- 获取下一个挂机关卡id
  1677 + function Role:getNextCarbonId(curId)
  1678 + local diff = math.floor(curId / 10000)
  1679 + local chapterId = math.floor((curId / 100) % 100)
  1680 + local subId = curId % 100
  1681 + local nextId = curId + 1
  1682 + local function makeCarbonId(diff, chapterId, subId)
  1683 + return diff * 10000 + chapterId * 100 + subId
  1684 + end
  1685 + if not csvdb["idle_battleCsv"][nextId] then
  1686 + nextId = makeCarbonId(diff, chapterId + 1, 1)
  1687 + if not csvdb["idle_battleCsv"][nextId] then
  1688 + nextId = makeCarbonId(diff + 1, 1, 1)
  1689 + if not csvdb["idle_battleCsv"][nextId] then
  1690 + nextId = 0
  1691 + end
  1692 + end
  1693 + end
  1694 +
  1695 + return nextId
  1696 + end
  1697 +
1535 end 1698 end
1536 1699
1537 return RolePlugin 1700 return RolePlugin
1538 \ No newline at end of file 1701 \ No newline at end of file
src/models/RoleTimeReset.lua
@@ -34,7 +34,6 @@ end @@ -34,7 +34,6 @@ end
34 ResetFunc["CrossMonth"] = function(self, notify, response) 34 ResetFunc["CrossMonth"] = function(self, notify, response)
35 local ltime = self:getProperty("ltime") 35 local ltime = self:getProperty("ltime")
36 if isCrossMonth(ltime, skynet.timex()) then 36 if isCrossMonth(ltime, skynet.timex()) then
37 - print("cross month")  
38 self.storeData:resetStoreReored(3) --商店跨月重置 time_reset表关联id 37 self.storeData:resetStoreReored(3) --商店跨月重置 time_reset表关联id
39 end 38 end
40 end 39 end
src/models/Rune.lua
@@ -26,7 +26,7 @@ function Rune:notifyUpdateProperty(field, newValue, oldValue) @@ -26,7 +26,7 @@ function Rune:notifyUpdateProperty(field, newValue, oldValue)
26 self:notifyUpdateProperties(datas) 26 self:notifyUpdateProperties(datas)
27 end 27 end
28 28
29 -function Rune:log(contents) 29 +function Rune:mylog(contents)
30 contents = contents or {} 30 contents = contents or {}
31 if contents["cint1"] or contents["cint2"] or contents["cint3"] then 31 if contents["cint1"] or contents["cint2"] or contents["cint3"] then
32 print("heroLog error log have cint1 or cint2 or cint3 ", debug.traceback()) 32 print("heroLog error log have cint1 or cint2 or cint3 ", debug.traceback())
@@ -35,7 +35,7 @@ function Rune:log(contents) @@ -35,7 +35,7 @@ function Rune:log(contents)
35 contents["cint2"] = self:getProperty("type") 35 contents["cint2"] = self:getProperty("type")
36 contents["cint3"] = self:getProperty("id") 36 contents["cint3"] = self:getProperty("id")
37 37
38 - self.owner:log("rune_action", contents) 38 + self.owner:mylog("rune_action", contents)
39 end 39 end
40 40
41 function Rune:notifyUpdateProperties(params) 41 function Rune:notifyUpdateProperties(params)
src/models/Store.lua
@@ -6,21 +6,33 @@ function Store:ctor(properties) @@ -6,21 +6,33 @@ function Store:ctor(properties)
6 Store.super.ctor(self, properties) 6 Store.super.ctor(self, properties)
7 end 7 end
8 8
  9 +ActGoodsType = {
  10 + paySignIn = 1, -- 付费签到
  11 +}
  12 +
9 Store.schema = { 13 Store.schema = {
10 buyR = {"table", {}}, -- 购买商品记录 {id=count} 14 buyR = {"table", {}}, -- 购买商品记录 {id=count}
11 payR = {"table", {}}, -- 充值记录 {id=count} 15 payR = {"table", {}}, -- 充值记录 {id=count}
12 growFund = {"number", 0}, -- 成长基金 16 growFund = {"number", 0}, -- 成长基金
13 - growFundR = {"string", ""}, -- 成长基金领取记录 17 + growFundR = {"string", ""}, -- 成长基金领取记录
  18 +
14 monthCardEx = {"number", 0}, -- 月卡过期时间戳 19 monthCardEx = {"number", 0}, -- 月卡过期时间戳
15 - smonthCardEx = {"number", 0}, -- 超级月卡过期时间戳 20 + smonthCardEx = {"number", 0}, -- 超级月卡过期时间戳
  21 +
16 battleCard = {"number", 0}, -- 赛季卡 22 battleCard = {"number", 0}, -- 赛季卡
17 battleFR = {"string", ""}, -- 免费赛季卡领取记录 23 battleFR = {"string", ""}, -- 免费赛季卡领取记录
18 battleLR = {"string", ""}, -- 付费赛季卡领取记录 24 battleLR = {"string", ""}, -- 付费赛季卡领取记录
  25 +
19 limitTPack = {"table", {}}, -- 限时礼包 {id=expire_ts} 26 limitTPack = {"table", {}}, -- 限时礼包 {id=expire_ts}
20 privCardEx = {"number", 0}, -- 特权卡过期时间戳 27 privCardEx = {"number", 0}, -- 特权卡过期时间戳
21 getMailT1 = {"number",0}, -- 上次发送月卡福利邮件的时间 28 getMailT1 = {"number",0}, -- 上次发送月卡福利邮件的时间
22 getMailT2 = {"number",0}, -- 上次发送超级月卡福利邮件的时间 29 getMailT2 = {"number",0}, -- 上次发送超级月卡福利邮件的时间
23 - packTrigger = {"table", {}} -- 礼包触发记录 {关卡难度1={id, 通关关卡数,升级数,爬塔层数}, ...} 30 + packTrigger = {"table", {}}, -- 礼包触发记录 {关卡难度1={id, 通关关卡数,升级数,爬塔层数}, ...}
  31 +
  32 + -- 活动商品购买记录
  33 + actGoodsFlag = {"table", {}}, -- ActGoodsType 1购买,0未购买
  34 +
  35 + bpInfo = {"table", {}}, -- battle pass 探索指令 1={flag=0 为1表示买了,br=""付费领取记录, fr=""免费领取记录},2,3,4
24 } 36 }
25 37
26 function Store:updateProperty(params) 38 function Store:updateProperty(params)
@@ -45,6 +57,7 @@ end @@ -45,6 +57,7 @@ end
45 function Store:onCrossDay() 57 function Store:onCrossDay()
46 self:sendMonthCardEmail() 58 self:sendMonthCardEmail()
47 self:deleteExpireLimitGoods() 59 self:deleteExpireLimitGoods()
  60 + self:checkPaySignReward()
48 end 61 end
49 62
50 -- 删除过期商品 63 -- 删除过期商品
@@ -150,7 +163,7 @@ function Store:getGearExchangeCoef() @@ -150,7 +163,7 @@ function Store:getGearExchangeCoef()
150 end 163 end
151 164
152 -- 购买通行证 165 -- 购买通行证
153 -function Store:onBuyCard(type, duration) 166 +function Store:onBuyCard(type, duration, id)
154 local timeNow = skynet.timex() 167 local timeNow = skynet.timex()
155 if type == CardType.NormalMonthCard then 168 if type == CardType.NormalMonthCard then
156 if self:isMonthCardExpire() then 169 if self:isMonthCardExpire() then
@@ -176,6 +189,15 @@ function Store:onBuyCard(type, duration) @@ -176,6 +189,15 @@ function Store:onBuyCard(type, duration)
176 self:updateProperty({field = "growFund", value = 1}) 189 self:updateProperty({field = "growFund", value = 1})
177 elseif type == CardType.BattleCard then 190 elseif type == CardType.BattleCard then
178 self:updateProperty({field = "battleCard", value = 1}) 191 self:updateProperty({field = "battleCard", value = 1})
  192 + elseif type == CardType.PaySignCard then
  193 + self:onBuyPaySignCard(duration)
  194 + elseif type == CardType.BattlePassCard then
  195 + local index = id - 400 -- 401:初级 402:中级 403:高级 404:终极
  196 + local bpInfo = self:getProperty("bpInfo") or {}
  197 + local info = bpInfo[index] or {}
  198 + info["flag"] = 1
  199 + bpInfo[index] = info
  200 + self:updateProperty({field = "bpInfo", value = bpInfo})
179 end 201 end
180 end 202 end
181 203
@@ -330,6 +352,46 @@ function Store:OnTriggerLimitTimePack(eventType, param) @@ -330,6 +352,46 @@ function Store:OnTriggerLimitTimePack(eventType, param)
330 end 352 end
331 end 353 end
332 354
  355 +function GetActGoodsIndex(goodsType)
  356 + return ActGoodsType[goodsType] or 0
  357 +end
  358 +
  359 +-- 购买付费签到 按开服时间算奖励
  360 +function Store:onBuyPaySignCard(dur)
  361 + local curTs = skynet.timex()
  362 + local actGoodsFlag = self:getProperty("actGoodsFlag") or {}
  363 + local goodsIndex = GetActGoodsIndex("paySignIn")
  364 + if goodsIndex == 0 then
  365 + print("get act goods index fail :paySignIn")
  366 + return
  367 + end
  368 + actGoodsFlag[goodsIndex] = 1
  369 + self:updateProperty({field = "actGoodsFlag", value = actGoodsFlag})
  370 + -- 发钱
  371 + local change
  372 + local reward, curData = self.owner.activity:getPaySignReward()
  373 + if next(reward) then
  374 + self.owner.activity:updateActData("PaySignIn", curData)
  375 + reward, change = self.owner:award(reward, {log = {desc = "actPaySign"}})
  376 + end
  377 +
  378 + self.owner:log("activity", {
  379 + activity_id = 0, -- 活动ID(或活动指定任务的ID)
  380 + activity_type = self.owner.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表
  381 + activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  382 + })
  383 +
  384 + SendPacket(actionCodes.Activity_actPaySignRewardNtf, MsgPack.pack(self.owner:packReward(reward, change)))
  385 +end
  386 +
  387 +function Store:checkPaySignReward()
  388 + local reward, curData = self.owner.activity:getPaySignReward()
  389 + if next(reward) then
  390 + self.owner.activity:updateActData("PaySignIn", curData)
  391 + self.owner:sendMail(MailId.PaySignAward, nil, reward)
  392 + end
  393 +end
  394 +
333 function Store:data() 395 function Store:data()
334 return { 396 return {
335 buyR = self:getProperty("buyR"), 397 buyR = self:getProperty("buyR"),
@@ -343,7 +405,9 @@ function Store:data() @@ -343,7 +405,9 @@ function Store:data()
343 battleLR = self:getProperty("battleLR"), 405 battleLR = self:getProperty("battleLR"),
344 limitTPack = self:getProperty("limitTPack"), 406 limitTPack = self:getProperty("limitTPack"),
345 privCardEx = self:getProperty("privCardEx"), 407 privCardEx = self:getProperty("privCardEx"),
346 - packTrigger = self:getProperty("packTrigger") 408 + packTrigger = self:getProperty("packTrigger"),
  409 + actGoodsFlag = self:getProperty("actGoodsFlag"),
  410 + bpInfo = self:getProperty("bpInfo"),
347 } 411 }
348 end 412 end
349 413
src/services/agent_ctrl.lua
@@ -128,7 +128,7 @@ function _M:check_agent_status() @@ -128,7 +128,7 @@ function _M:check_agent_status()
128 next_log_time = now + 60 128 next_log_time = now + 60
129 local count = table_nums(self.u2f) 129 local count = table_nums(self.u2f)
130 datacenter.set("onlineCount", count) 130 datacenter.set("onlineCount", count)
131 - -- pcall(skynet.send, logd, "lua", "log", "online", {count = count}, "online") 131 + pcall(skynet.send, logd, "lua", "log", {["@type"] = "online", count = count}, "log")
132 end 132 end
133 end 133 end
134 134
src/services/logd.lua
@@ -13,8 +13,37 @@ local pairs = pairs @@ -13,8 +13,37 @@ local pairs = pairs
13 local ipairs = ipairs 13 local ipairs = ipairs
14 local string_format = string.format 14 local string_format = string.format
15 15
  16 +local logId = 0
16 local CMD, cs = {} 17 local CMD, cs = {}
17 -local log_fd, connecting = nil , false 18 +
  19 +local logHandle = {
  20 + bi = {
  21 + host = "127.0.0.1",
  22 + port = 13001,
  23 + },
  24 + log = {
  25 + host = "127.0.0.1",
  26 + port = 13002,
  27 + handle = function(doc)
  28 + -- 注入字段
  29 + local now = skynet.timex()
  30 + doc["time"] = now
  31 + doc["timestamp"] = now
  32 + doc["server"] = serverId
  33 + doc["game_name"] = "wasteland"
  34 + doc["env"] = "cb"
  35 + doc["game_name_type"] = "guaji"
  36 + doc["log_id"] = "wastelandC" .. logId .. "S" .. serverId .. "T" .. now
  37 + logId = (logId + 1) % 10000000
  38 + end
  39 + },
  40 +}
  41 +
  42 +local connect_relation = {}
  43 +local function getConInfo(fd)
  44 + return logHandle[connect_relation[fd] or ""]
  45 +end
  46 +
18 47
19 48
20 local socket_message = {} 49 local socket_message = {}
@@ -27,20 +56,30 @@ end @@ -27,20 +56,30 @@ end
27 56
28 -- SKYNET_SOCKET_TYPE_CONNECT = 2 57 -- SKYNET_SOCKET_TYPE_CONNECT = 2
29 socket_message[2] = function(id, _ , addr) 58 socket_message[2] = function(id, _ , addr)
  59 + local cur = getConInfo(id)
30 skynet.error("LOG SOCKET: connect: ", addr) 60 skynet.error("LOG SOCKET: connect: ", addr)
31 - connecting = false 61 + cur.connected = true
  62 + cur.connecting = false
32 end 63 end
33 64
34 -- SKYNET_SOCKET_TYPE_CLOSE = 3 65 -- SKYNET_SOCKET_TYPE_CLOSE = 3
35 socket_message[3] = function(id) 66 socket_message[3] = function(id)
36 skynet.error("LOG SOCKET: closed") 67 skynet.error("LOG SOCKET: closed")
37 - connecting = false 68 + local cur = getConInfo(id)
  69 + if not cur then return end
  70 + cur.connected = false
  71 + cur.connecting = false
  72 + connect_relation[id] = nil
38 end 73 end
39 74
40 -- SKYNET_SOCKET_TYPE_ERROR = 5 75 -- SKYNET_SOCKET_TYPE_ERROR = 5
41 socket_message[5] = function(id, _, err) 76 socket_message[5] = function(id, _, err)
42 skynet.error("LOG SOCKET: error: ", err) 77 skynet.error("LOG SOCKET: error: ", err)
43 - connecting = false 78 + local cur = getConInfo(id)
  79 + if not cur then return end
  80 + cur.connected = false
  81 + cur.connecting = false
  82 + connect_relation[id] = nil
44 end 83 end
45 84
46 85
@@ -55,18 +94,33 @@ skynet.register_protocol { @@ -55,18 +94,33 @@ skynet.register_protocol {
55 end 94 end
56 } 95 }
57 96
58 -function CMD.log(doc)  
59 - if not socketdriver.send(log_fd, json.encode(doc) .. "\n") then  
60 - if not connecting then  
61 - CMD.open() -- 连一下试试  
62 - socketdriver.send(log_fd, json.encode(doc) .. "\n") 97 +function CMD.log(doc, logTo)
  98 + logTo = logTo or "log"
  99 + local cur = logHandle[logTo]
  100 + if not cur then
  101 + print("error log to ", logTo)
  102 + end
  103 + if cur.handle then
  104 + cur.handle(doc)
  105 + end
  106 + if cur.connected and cur.fd then
  107 + socketdriver.send(cur.fd, json.encode(doc) .. "\n")
  108 + else
  109 + -- 断线会丢失一部分日志
  110 + if not cur.connecting then
  111 + CMD.open() -- 连一下
63 end 112 end
64 end 113 end
65 end 114 end
66 115
67 function CMD.open() 116 function CMD.open()
68 - log_fd = socketdriver.connect("127.0.0.1", 13001)  
69 - connecting = true 117 + for logTo, data in pairs(logHandle) do
  118 + if not data.connecting and not data.connected then
  119 + data.connecting = true
  120 + data.fd = socketdriver.connect(data.host, data.port)
  121 + connect_relation[data.fd] = logTo
  122 + end
  123 + end
70 end 124 end
71 125
72 local function __init__() 126 local function __init__()
@@ -75,8 +129,8 @@ local function __init__() @@ -75,8 +129,8 @@ local function __init__()
75 if command == "open" then 129 if command == "open" then
76 skynet.ret(skynet.pack(f(...))) 130 skynet.ret(skynet.pack(f(...)))
77 else 131 else
78 - local logType, doc, index_suffix = ...  
79 - cs(function() f(logType, doc, index_suffix) end) 132 + local doc, logTo = ...
  133 + cs(function() f(doc, logTo) end)
80 end 134 end
81 end) 135 end)
82 cs = queue() 136 cs = queue()
src/utils/CommonFunc.lua
@@ -146,6 +146,31 @@ function crossDayFromOpen(now) @@ -146,6 +146,31 @@ function crossDayFromOpen(now)
146 return crossDay(openTime, now) 146 return crossDay(openTime, now)
147 end 147 end
148 148
  149 +function diffFromOpen()
  150 + now = now or skynet.timex()
  151 + local openTime = os.time{
  152 + year = tonum(SERV_OPEN:sub(1,4)),
  153 + month = tonum(SERV_OPEN:sub(5,6)),
  154 + day = tonum(SERV_OPEN:sub(7,8)),
  155 + hour = RESET_TIME,
  156 + }
  157 + if now < openTime then
  158 + return 0
  159 + end
  160 +
  161 + return math.floor((now - openTime) / DAY_SEC)
  162 +end
  163 +
  164 +function getServerOpenTs()
  165 + local openTime = os.time{
  166 + year = tonum(SERV_OPEN:sub(1,4)),
  167 + month = tonum(SERV_OPEN:sub(5,6)),
  168 + day = tonum(SERV_OPEN:sub(7,8)),
  169 + hour = RESET_TIME,
  170 + }
  171 + return openTime
  172 +end
  173 +
149 -- 30*86400 = 2592000 174 -- 30*86400 = 2592000
150 function monthLater(now) 175 function monthLater(now)
151 now = now or skynet.timex() 176 now = now or skynet.timex()