Commit 2a79cbf8c181ee8723077ee32263e33a600c3435

Authored by zhouhaihai
2 parents 80b06009 c3a70cde

Merge branch 'develop' into player

* develop: (47 commits)
  返还
  冒险bug
  签名回调地址由客户端上传
  邮件时间bug
  停止注册
  日志端口
  修改报错,下载cv奖励记录字段
  增加pay_url
  挂机选定关卡时,指定新手引导步骤
  battle bug
  引导招募必送思露德判定出了大问题
  战斗 日志
  新的被动效果
  挂机战斗胜利才触发对应的引导
  不回复 更改看板娘
  增加记录log
  log 增加
  触发神器引导的代码移到发奖励的方法里
  神器的引导步骤从55步开始
  10连保底使用池子全随机
  ...

# Conflicts:
#	src/actions/HeroAction.lua
@@ -290,12 +290,24 @@ MailId = { @@ -290,12 +290,24 @@ MailId = {
290 SuperMonthCardEx = 204, 290 SuperMonthCardEx = 204,
291 BattleCardAward = 210, 291 BattleCardAward = 210,
292 292
293 - ActDrawCard = 231,  
294 - ActOpenBox = 232, 293 + ActSellFood = 231,
  294 + ActDrawCard = 232,
295 ActAdvDraw = 233, 295 ActAdvDraw = 233,
296 - ActSellFood = 234,  
297 - ActDrawCardReward = 221,  
298 - ActOpenBoxReward = 222, 296 + ActOpenBox = 234,
  297 + ActSellFoodReward = 221,
  298 + ActDrawCardReward = 222,
299 ActAdvDrawReward = 223, 299 ActAdvDrawReward = 223,
300 - ActSellFoodReward = 224, 300 + ActOpenBoxReward = 224,
301 } 301 }
  302 +
  303 +TriggerEventType = {
  304 + HangPass = 1,
  305 + LevelUp = 2,
  306 + TowerPass = 3,
  307 +}
  308 +
  309 +DrawCardType = {
  310 + SpecifyDraw = 1,
  311 + NormalDraw = 2,
  312 + FriendDraw = 3
  313 +}
302 \ No newline at end of file 314 \ No newline at end of file
src/ProtocolCode.lua
@@ -44,6 +44,7 @@ actionCodes = { @@ -44,6 +44,7 @@ actionCodes = {
44 Role_guideRpc = 129, 44 Role_guideRpc = 129,
45 Role_getRandomNameRpc = 130, 45 Role_getRandomNameRpc = 130,
46 Role_goldBuyRpc = 131, 46 Role_goldBuyRpc = 131,
  47 + Role_getDownloadCvRewardRpc = 132,
47 48
48 Adv_startAdvRpc = 151, 49 Adv_startAdvRpc = 151,
49 Adv_startHangRpc = 152, 50 Adv_startHangRpc = 152,
@@ -89,6 +90,7 @@ actionCodes = { @@ -89,6 +90,7 @@ actionCodes = {
89 Hero_drawHeroRpc = 220, 90 Hero_drawHeroRpc = 220,
90 Hero_repayHeroRpc = 221, 91 Hero_repayHeroRpc = 221,
91 Hero_unlockPoolRpc = 222, 92 Hero_unlockPoolRpc = 222,
  93 + Hero_changeCrown = 223,
92 94
93 Hang_startRpc = 251, 95 Hang_startRpc = 251,
94 Hang_checkRpc = 252, 96 Hang_checkRpc = 252,
src/actions/ActivityAction.lua
@@ -65,7 +65,11 @@ function _M.sudokuRpc(agent, data) @@ -65,7 +65,11 @@ function _M.sudokuRpc(agent, data)
65 65
66 role:updateProperty({field = "sudoku", value = sudoku}) 66 role:updateProperty({field = "sudoku", value = sudoku})
67 67
68 - role:log("act_action", {desc = "sudoku", int1 = id, int2 = phase}) 68 + role:log("activity", {
  69 + activity_id = id, -- 活动ID(或活动指定任务的ID)
  70 + activity_type = 0, -- 活动类型,见活动类型枚举表
  71 + activity_reward = reward or {}, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  72 + })
69 73
70 SendPacket(actionCodes.Activity_sudokuRpc, MsgPack.pack({task = role:packReward(task, tchange), reward = role:packReward(reward, rchange), rId = rId})) 74 SendPacket(actionCodes.Activity_sudokuRpc, MsgPack.pack({task = role:packReward(task, tchange), reward = role:packReward(reward, rchange), rId = rId}))
71 return true 75 return true
@@ -100,6 +104,12 @@ function _M.sudokuRewardRpc(agent, data) @@ -100,6 +104,12 @@ function _M.sudokuRewardRpc(agent, data)
100 end 104 end
101 role:updateProperty({field = "sudoku", value = sudoku}) 105 role:updateProperty({field = "sudoku", value = sudoku})
102 106
  107 + role:log("activity", {
  108 + activity_id = 10000 + phase, -- 活动ID(或活动指定任务的ID)
  109 + activity_type = 0, -- 活动类型,见活动类型枚举表
  110 + activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  111 + })
  112 +
103 SendPacket(actionCodes.Activity_sudokuRewardRpc, MsgPack.pack(role:packReward(reward, change))) 113 SendPacket(actionCodes.Activity_sudokuRewardRpc, MsgPack.pack(role:packReward(reward, change)))
104 return true 114 return true
105 end 115 end
@@ -156,6 +166,13 @@ function _M.actSignRpc(agent, data) @@ -156,6 +166,13 @@ function _M.actSignRpc(agent, data)
156 role.activity:updateActData("Sign", curData) 166 role.activity:updateActData("Sign", curData)
157 reward, change = role:award(reward, {log = {desc = "actSign"}}) 167 reward, change = role:award(reward, {log = {desc = "actSign"}})
158 end 168 end
  169 +
  170 + role:log("activity", {
  171 + activity_id = curData[0], -- 活动ID(或活动指定任务的ID)
  172 + activity_type = role.activity.ActivityType.Sign, -- 活动类型,见活动类型枚举表
  173 + activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  174 + })
  175 +
159 SendPacket(actionCodes.Activity_actSignRpc, MsgPack.pack(role:packReward(reward, change))) 176 SendPacket(actionCodes.Activity_actSignRpc, MsgPack.pack(role:packReward(reward, change)))
160 return true 177 return true
161 end 178 end
src/actions/AdvAction.lua
@@ -90,7 +90,7 @@ function _M.startAdvRpc( agent, data ) @@ -90,7 +90,7 @@ function _M.startAdvRpc( agent, data )
90 --上一个关卡结束才可以开始新的关卡 90 --上一个关卡结束才可以开始新的关卡
91 if role:getAdvData():isRunning() then return 8 end 91 if role:getAdvData():isRunning() then return 8 end
92 local advHang = role:getProperty("advHang") 92 local advHang = role:getProperty("advHang")
93 - if advHang[chapterId] then return 9 end --正在挂机 93 + -- if advHang[chapterId] then return 9 end --正在挂机
94 94
95 95
96 local chapterData = csvdb["adv_chapterCsv"][chapterId] 96 local chapterData = csvdb["adv_chapterCsv"][chapterId]
@@ -174,7 +174,6 @@ function _M.startAdvRpc( agent, data ) @@ -174,7 +174,6 @@ 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():log({desc = "start", int1 = supportIdx})  
178 177
179 SendPacket(actionCodes.Adv_startAdvRpc, '') 178 SendPacket(actionCodes.Adv_startAdvRpc, '')
180 return true 179 return true
@@ -184,16 +183,28 @@ function _M.startHangRpc(agent, data) @@ -184,16 +183,28 @@ function _M.startHangRpc(agent, data)
184 local role = agent.role 183 local role = agent.role
185 local msg = MsgPack.unpack(data) 184 local msg = MsgPack.unpack(data)
186 local chapterId = msg.chapterId --关卡id 185 local chapterId = msg.chapterId --关卡id
  186 + local campId = msg.campId or 2 --营地id
187 local format = msg.format --编队 187 local format = msg.format --编队
  188 + local index = msg.index or 1--时间索引id
188 189
189 - local chapterData = csvdb["adv_chapterCsv"][chapterId] 190 + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId]
190 if not chapterData then return 1 end 191 if not chapterData then return 1 end
191 - if chapterData.idleReward == "" then return 2 end --没有奖励 没有挂机 192 + local campSiteData = chapterData[campId]
  193 + if not campSiteData then return 1 end
  194 + if campSiteData.idleReward_1 == "" and campSiteData.idleReward_2 == "" then return 2 end --没有奖励 没有挂机
  195 +
  196 + local adv_idle_time = globalCsv.adv_idle_time[index]
  197 + local adv_idle_energy = globalCsv.adv_idle_energy[index]
  198 + local adv_idle_reward_coef = globalCsv.adv_idle_reward[index]
  199 + if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then
  200 + return 2
  201 + end
  202 + adv_idle_time = adv_idle_time * 60
192 203
193 local advHang = role:getProperty("advHang") 204 local advHang = role:getProperty("advHang")
194 if advHang[chapterId] then return 3 end --正在挂机 205 if advHang[chapterId] then return 3 end --正在挂机
195 206
196 - if role:getAdvData():isRunning() and role:getAdvData().chapterId == chapterId then return 4 end 207 + -- if role:getAdvData():isRunning() and role:getAdvData().chapterId == chapterId then return 4 end
197 208
198 if AdvCommon.isEndless(chapterId) then return 5 end -- 无尽没有代理 209 if AdvCommon.isEndless(chapterId) then return 5 end -- 无尽没有代理
199 210
@@ -201,7 +212,7 @@ function _M.startHangRpc(agent, data) @@ -201,7 +212,7 @@ function _M.startHangRpc(agent, data)
201 if not next(advRelay[chapterId] or {}) then return 6 end -- 没有开放 212 if not next(advRelay[chapterId] or {}) then return 6 end -- 没有开放
202 213
203 214
204 - if not role:checkAdvCount(chapterData.limitlevel) then return 7 end -- 是否有体力 215 + if not role:checkAdvCount(adv_idle_energy) then return 7 end -- 是否有体力
205 216
206 if not checkFormat(role, format, role:getAdvData():isRunning()) then return 8 end --编队是否正确 217 if not checkFormat(role, format, role:getAdvData():isRunning()) then return 8 end --编队是否正确
207 218
@@ -220,7 +231,7 @@ function _M.startHangRpc(agent, data) @@ -220,7 +231,7 @@ function _M.startHangRpc(agent, data)
220 + 0.226 * player["hit"] 231 + 0.226 * player["hit"]
221 + 0.26 * player["miss"] 232 + 0.26 * player["miss"]
222 233
223 - if battleV < chapterData.idleValue then return 9 end -- 战斗力是否满足 234 + if battleV < campSiteData.idleValue then return 9 end -- 战斗力是否满足
224 235
225 local info = {} 236 local info = {}
226 info.format = {} 237 info.format = {}
@@ -230,7 +241,9 @@ function _M.startHangRpc(agent, data) @@ -230,7 +241,9 @@ function _M.startHangRpc(agent, data)
230 for slot, heroId in pairs(format.heros) do 241 for slot, heroId in pairs(format.heros) do
231 info.format.heros[slot] = heroId 242 info.format.heros[slot] = heroId
232 end 243 end
233 - info.time = skynet.timex() + chapterData.idleTime --挂机时间 244 + info.time = skynet.timex() + adv_idle_time --挂机时间
  245 + info.campId = campId
  246 + info.index = index
234 247
235 -- 没有在战斗 用team来挂机了 把team清掉 248 -- 没有在战斗 用team来挂机了 把team清掉
236 if not role:getAdvData():isRunning() then 249 if not role:getAdvData():isRunning() then
@@ -239,9 +252,8 @@ function _M.startHangRpc(agent, data) @@ -239,9 +252,8 @@ function _M.startHangRpc(agent, data)
239 252
240 role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) 253 role:changeUpdates({{type = "advHang", field = chapterId, value = info}})
241 254
242 - role:changeAdvCount(chapterData.limitlevel) 255 + role:changeAdvCount(adv_idle_energy)
243 role:checkTaskEnter("AdvStart", {id = chapterId}) 256 role:checkTaskEnter("AdvStart", {id = chapterId})
244 - role:log("adv_action", {desc = "startHang", int1 = chapterId})  
245 257
246 SendPacket(actionCodes.Adv_startHangRpc, '') 258 SendPacket(actionCodes.Adv_startHangRpc, '')
247 return true 259 return true
@@ -257,21 +269,30 @@ function _M.quickHangRpc(agent, data) @@ -257,21 +269,30 @@ function _M.quickHangRpc(agent, data)
257 local info = advHang[chapterId] 269 local info = advHang[chapterId]
258 if not info then return end 270 if not info then return end
259 271
260 - local chapterData = csvdb["adv_chapterCsv"][chapterId] 272 + local index = info.index
  273 + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId]
261 if not chapterData then return end 274 if not chapterData then return end
  275 +
  276 + local campSiteData = chapterData[info.campId]
  277 + if not campSiteData then return 1 end
  278 + if campSiteData.idleReward_1 == "" and campSiteData.idleReward_2 == "" then return 2 end --没有奖励 没有挂机
  279 +
  280 + local adv_idle_time = globalCsv.adv_idle_time[index]
  281 + if not adv_idle_time then
  282 + return 2
  283 + end
  284 + adv_idle_time = adv_idle_time * 60
262 285
263 local reward, isFull 286 local reward, isFull
264 if skynet.timex() >= info.time then return end -- 已经完成了 287 if skynet.timex() >= info.time then return end -- 已经完成了
265 288
266 - local cost = math.ceil((info.time - skynet.timex()) / chapterData.idleTime * chapterData.accelerate) 289 + local cost = math.ceil((info.time - skynet.timex()) / 3600 * globalCsv.adv_idle_quicken)
267 290
268 if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return end 291 if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return end
269 role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "advQuickHang", int1 = chapterId}}) 292 role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "advQuickHang", int1 = chapterId}})
270 info.time = 0 293 info.time = 0
271 role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) 294 role:changeUpdates({{type = "advHang", field = chapterId, value = info}})
272 295
273 - role:log("adv_action", {desc = "advQuickHang", int1 = chapterId})  
274 -  
275 SendPacket(actionCodes.Adv_quickHangRpc, '') 296 SendPacket(actionCodes.Adv_quickHangRpc, '')
276 return true 297 return true
277 end 298 end
@@ -287,11 +308,25 @@ function _M.endHangRpc(agent, data) @@ -287,11 +308,25 @@ function _M.endHangRpc(agent, data)
287 local info = advHang[chapterId] 308 local info = advHang[chapterId]
288 if not info then return end 309 if not info then return end
289 310
290 - local chapterData = csvdb["adv_chapterCsv"][chapterId] 311 + local index = info.index or 1
  312 + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId]
291 if not chapterData then return end 313 if not chapterData then return end
  314 + local campSiteData = chapterData[info.campId or 2]
  315 + if not campSiteData then return 1 end
  316 + if campSiteData.idleReward_1 == "" and campSiteData.idleReward_2 == "" then return 2 end --没有奖励 没有挂机
  317 +
  318 + local adv_idle_time = globalCsv.adv_idle_time[index]
  319 + local adv_idle_energy = globalCsv.adv_idle_energy[index]
  320 + local adv_idle_reward_coef = globalCsv.adv_idle_reward[index]
  321 + if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then
  322 + return 2
  323 + end
  324 + adv_idle_time = adv_idle_time * 60
292 325
293 local reward, isFull, change 326 local reward, isFull, change
294 if skynet.timex() >= info.time then 327 if skynet.timex() >= info.time then
  328 + -- 最新需求加成取消
  329 + --[[
295 -- 英雄加成 330 -- 英雄加成
296 local idleUnit = chapterData.idleUnit:toNumMap() 331 local idleUnit = chapterData.idleUnit:toNumMap()
297 local upUnit = 0 332 local upUnit = 0
@@ -316,15 +351,17 @@ function _M.endHangRpc(agent, data) @@ -316,15 +351,17 @@ function _M.endHangRpc(agent, data)
316 end 351 end
317 352
318 if not maxCampsite then return end 353 if not maxCampsite then return end
  354 + ]]
  355 + local totalReward = campSiteData.idleReward_1 .. " " .. campSiteData.idleReward_2
319 356
320 - local idleReward = chapterData.idleReward:toNumMap() 357 + local idleReward = totalReward:toNumMap()
321 for itemId, count in pairs(idleReward) do 358 for itemId, count in pairs(idleReward) do
322 - idleReward[itemId] = math.floor(count * (maxCampsite.idleValue + upUnit) / 100) 359 + idleReward[itemId] = count * adv_idle_reward_coef
323 end 360 end
324 reward, change = role:award(idleReward, {log = {desc = "advHang", int1 = chapterId}}) 361 reward, change = role:award(idleReward, {log = {desc = "advHang", int1 = chapterId}})
325 else 362 else
326 if cancel then 363 if cancel then
327 - role:changeAdvCount(-chapterData.limitlevel) 364 + --role:changeAdvCount(-chapterData.limitlevel)
328 -- if role:getProperty("advC") <= 0 then 365 -- if role:getProperty("advC") <= 0 then
329 -- isFull = true 366 -- isFull = true
330 -- else 367 -- else
@@ -337,8 +374,6 @@ function _M.endHangRpc(agent, data) @@ -337,8 +374,6 @@ function _M.endHangRpc(agent, data)
337 374
338 role:changeUpdates({{type = "advHang", field = chapterId, value = nil}}) 375 role:changeUpdates({{type = "advHang", field = chapterId, value = nil}})
339 376
340 - role:log("adv_action", {desc = "endHang", int1 = chapterId, short1 = cancel and 1 or 0})  
341 -  
342 SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, change = change, isFull = isFull})) 377 SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, change = change, isFull = isFull}))
343 return true 378 return true
344 end 379 end
@@ -360,7 +395,7 @@ function _M.buyAdvCountRpc(agent , data) @@ -360,7 +395,7 @@ function _M.buyAdvCountRpc(agent , data)
360 395
361 396
362 if not role:checkItemEnough(cost) then return end 397 if not role:checkItemEnough(cost) then return end
363 - role:costItems(cost, {log = {desc = "buyAdvCount", short1 = isEl and 1 or 0, int1 = count}}) 398 + role:costItems(cost, {log = {desc = "buyAdvCount", int1 = isEl and 1 or 0, int2 = count}})
364 if isEl then 399 if isEl then
365 role.dailyData:updateProperty({field = "advElC", delta = -count}) 400 role.dailyData:updateProperty({field = "advElC", delta = -count})
366 role.dailyData:updateProperty({field = "advElBC", delta = count}) 401 role.dailyData:updateProperty({field = "advElBC", delta = count})
@@ -368,7 +403,6 @@ function _M.buyAdvCountRpc(agent , data) @@ -368,7 +403,6 @@ function _M.buyAdvCountRpc(agent , data)
368 role:changeAdvCount(-count * globalCsv.adv_daily_buy_num) 403 role:changeAdvCount(-count * globalCsv.adv_daily_buy_num)
369 role.dailyData:updateProperty({field = "advBC", delta = count}) 404 role.dailyData:updateProperty({field = "advBC", delta = count})
370 end 405 end
371 - role:log("adv_action", {desc = "buyAdvCount", short1 = isEl and 1 or 0, int1 = count})  
372 406
373 SendPacket(actionCodes.Adv_buyAdvCountRpc, '') 407 SendPacket(actionCodes.Adv_buyAdvCountRpc, '')
374 return true 408 return true
@@ -393,8 +427,6 @@ function _M.finishTaskRpc(agent, data) @@ -393,8 +427,6 @@ function _M.finishTaskRpc(agent, data)
393 if not status then return end 427 if not status then return end
394 role:checkTaskEnter("AdvOverTask", {id = taskId}) 428 role:checkTaskEnter("AdvOverTask", {id = taskId})
395 429
396 - adv:log({desc = "finishTask", int1 = taskId})  
397 -  
398 SendPacket(actionCodes.Adv_finishTaskRpc, MsgPack.pack(role:packReward(reward, change))) 430 SendPacket(actionCodes.Adv_finishTaskRpc, MsgPack.pack(role:packReward(reward, change)))
399 return true 431 return true
400 end 432 end
@@ -416,8 +448,6 @@ function _M.clickBlockRpc(agent, data) @@ -416,8 +448,6 @@ function _M.clickBlockRpc(agent, data)
416 448
417 if adv:isWaitChooseArtifact() then return returnFail() end 449 if adv:isWaitChooseArtifact() then return returnFail() end
418 450
419 - adv:log({desc = "clickBlock", int1 = msg.roomId, int2 = msg.blockId})  
420 -  
421 local status, errorCode = adv:clickBlock(msg.roomId, msg.blockId, msg) 451 local status, errorCode = adv:clickBlock(msg.roomId, msg.blockId, msg)
422 if not status then return returnFail(errorCode) end 452 if not status then return returnFail(errorCode) end
423 453
@@ -450,8 +480,11 @@ function _M.useItemRpc(agent, data) @@ -450,8 +480,11 @@ function _M.useItemRpc(agent, data)
450 adv:backUse({[itemId] = count}) 480 adv:backUse({[itemId] = count})
451 end 481 end
452 482
  483 + if itemId == 5020 then
  484 + role:finishGuide(53)
  485 + end
  486 +
453 adv:checkAchievement(adv.AchievType.UseItem, count, itemId) 487 adv:checkAchievement(adv.AchievType.UseItem, count, itemId)
454 - adv:log({desc = "useItem", int1 = itemId, int2 = count})  
455 488
456 for i = 1, count do 489 for i = 1, count do
457 adv:doActive(itemData.effect, target) -- target 490 adv:doActive(itemData.effect, target) -- target
@@ -487,7 +520,6 @@ function _M.usePotionRpc(agent, data) @@ -487,7 +520,6 @@ function _M.usePotionRpc(agent, data)
487 local adv = role:getAdvData() 520 local adv = role:getAdvData()
488 if adv:isWaitChooseArtifact() then return end 521 if adv:isWaitChooseArtifact() then return end
489 522
490 - adv:log({desc = "usePotion", int1 = potionId})  
491 523
492 local status = adv:doActive(potionData.effect, target) -- target 524 local status = adv:doActive(potionData.effect, target) -- target
493 if not status then return end 525 if not status then return end
@@ -499,6 +531,8 @@ function _M.usePotionRpc(agent, data) @@ -499,6 +531,8 @@ function _M.usePotionRpc(agent, data)
499 adv:saveDB() 531 adv:saveDB()
500 role:checkTaskEnter("AdvUsePotion") 532 role:checkTaskEnter("AdvUsePotion")
501 533
  534 + role:finishGuide(61)
  535 +
502 SendPacket(actionCodes.Adv_usePotionRpc, MsgPack.pack({events = adv:popBackEvents()})) 536 SendPacket(actionCodes.Adv_usePotionRpc, MsgPack.pack({events = adv:popBackEvents()}))
503 return true 537 return true
504 end 538 end
@@ -539,6 +573,8 @@ function _M.wearArtifactRpc(agent, data) @@ -539,6 +573,8 @@ function _M.wearArtifactRpc(agent, data)
539 if not status then return 3 end 573 if not status then return 3 end
540 adv:saveDB() 574 adv:saveDB()
541 575
  576 + role:finishGuide(55)
  577 +
542 SendPacket(actionCodes.Adv_wearArtifactRpc, '') 578 SendPacket(actionCodes.Adv_wearArtifactRpc, '')
543 return true 579 return true
544 end 580 end
@@ -568,6 +604,7 @@ function _M.upArtifactRpc(agent, data) @@ -568,6 +604,7 @@ function _M.upArtifactRpc(agent, data)
568 else 604 else
569 adv:updateAchievement() 605 adv:updateAchievement()
570 end 606 end
  607 +
571 SendPacket(actionCodes.Adv_upArtifactRpc, '') 608 SendPacket(actionCodes.Adv_upArtifactRpc, '')
572 return true 609 return true
573 end 610 end
@@ -577,9 +614,10 @@ function _M.exitAdvRpc(agent, data) @@ -577,9 +614,10 @@ function _M.exitAdvRpc(agent, data)
577 local role = agent.role 614 local role = agent.role
578 -- local msg = MsgPack.unpack(data) 615 -- local msg = MsgPack.unpack(data)
579 if not isCanContinue(role) then return end 616 if not isCanContinue(role) then return end
580 - 617 + if not role:checkOverGuide(57) then
  618 + role:saveGuide(57,1,true)
  619 + end
581 local adv = role:getAdvData() 620 local adv = role:getAdvData()
582 - adv:log({desc = "exit"})  
583 local status = adv:exit() -- target {roomId = 1, blockId = 1} 选择的目标 621 local status = adv:exit() -- target {roomId = 1, blockId = 1} 选择的目标
584 SendPacket(actionCodes.Adv_exitAdvRpc, MsgPack.pack({events = adv:popBackEvents()})) 622 SendPacket(actionCodes.Adv_exitAdvRpc, MsgPack.pack({events = adv:popBackEvents()}))
585 return true 623 return true
@@ -638,7 +676,19 @@ function _M.endBattleRpc(agent, data) @@ -638,7 +676,19 @@ function _M.endBattleRpc(agent, data)
638 if enemy.monsterId ~= monsterId or enemy.roomId ~= roomId or enemy.blockId ~= blockId then return end 676 if enemy.monsterId ~= monsterId or enemy.roomId ~= roomId or enemy.blockId ~= blockId then return end
639 adv.__battleCache = nil 677 adv.__battleCache = nil
640 678
641 - adv:log({desc = "endBattle"}) 679 + -- 打完野猪怪
  680 + role:finishGuide(52)
  681 + -- 调理剂使用引导(生命药剂)
  682 + if not role:checkOverGuide(61) then
  683 + local potionBag = role:getProperty("potionBag")
  684 + local own = potionBag[10] or 0
  685 + if own > 0 then
  686 + -- 造假
  687 + player.hp = player.hp * 0.8
  688 + role:saveGuide(61,1,true)
  689 + end
  690 + end
  691 +
642 local status = adv:clickBlock(roomId, blockId, {player = player, bySkill = bySkill}) 692 local status = adv:clickBlock(roomId, blockId, {player = player, bySkill = bySkill})
643 693
644 if not status then return end 694 if not status then return end
@@ -720,9 +770,8 @@ function _M.wheelSurfRpc(agent, data) @@ -720,9 +770,8 @@ function _M.wheelSurfRpc(agent, data)
720 table.insert(backReward, gift) 770 table.insert(backReward, gift)
721 end 771 end
722 role:award(reward, {log = {desc = "advWheelSurf", int1 = ptype}}) 772 role:award(reward, {log = {desc = "advWheelSurf", int1 = ptype}})
723 - 773 + role:finishGuide(58)
724 role:checkTaskEnter("AdvDraw", {count = count, ptype = ptype}) 774 role:checkTaskEnter("AdvDraw", {count = count, ptype = ptype})
725 - role:log("adv_action", {desc = "advWheelSurf", int1 = ptype, int2 = count})  
726 775
727 SendPacket(actionCodes.Adv_wheelSurfRpc, MsgPack.pack({reward = backReward})) 776 SendPacket(actionCodes.Adv_wheelSurfRpc, MsgPack.pack({reward = backReward}))
728 return true 777 return true
@@ -751,7 +800,6 @@ function _M.repayWheelSurfRpc(agent, data) @@ -751,7 +800,6 @@ function _M.repayWheelSurfRpc(agent, data)
751 local gift = drawData["pool3"]:randWeight(true) 800 local gift = drawData["pool3"]:randWeight(true)
752 local reward, change = {[gift[1]] = gift[2]} 801 local reward, change = {[gift[1]] = gift[2]}
753 reward, change = role:award(reward, {log = {desc = "advRepayWheelSurf", int1 = ptype}}) 802 reward, change = role:award(reward, {log = {desc = "advRepayWheelSurf", int1 = ptype}})
754 - role:log("adv_action", {desc = "advRepayWheelSurf", int1 = ptype})  
755 803
756 SendPacket(actionCodes.Adv_repayWheelSurfRpc, MsgPack.pack(role:packReward(reward, change))) 804 SendPacket(actionCodes.Adv_repayWheelSurfRpc, MsgPack.pack(role:packReward(reward, change)))
757 return true 805 return true
@@ -774,8 +822,7 @@ function _M.finishAchievRpc(agent, data) @@ -774,8 +822,7 @@ function _M.finishAchievRpc(agent, data)
774 end 822 end
775 if not status then return end 823 if not status then return end
776 adv:updateAchievement() 824 adv:updateAchievement()
777 - role:log("adv_action", {desc = "finishAchiev", short1 = ctype, int1 = chapterId, int2 = taskId})  
778 - 825 + role:finishGuide(57)
779 SendPacket(actionCodes.Adv_finishAchievRpc, MsgPack.pack(role:packReward(reward, change))) 826 SendPacket(actionCodes.Adv_finishAchievRpc, MsgPack.pack(role:packReward(reward, change)))
780 return true 827 return true
781 end 828 end
@@ -831,7 +878,6 @@ function _M.refreshSupportRpc(agent, data) @@ -831,7 +878,6 @@ function _M.refreshSupportRpc(agent, data)
831 end 878 end
832 879
833 role:advRandomSupportEffect() 880 role:advRandomSupportEffect()
834 - role:log("adv_action", {desc = "advSupRe", short1 = cr < al and 0 or 1})  
835 881
836 SendPacket(actionCodes.Adv_refreshSupportRpc, '') 882 SendPacket(actionCodes.Adv_refreshSupportRpc, '')
837 return true 883 return true
src/actions/CarAction.lua
@@ -40,7 +40,13 @@ function _M.makePotionRpc( agent, data ) @@ -40,7 +40,13 @@ function _M.makePotionRpc( agent, data )
40 role:updateProperty({field = "potionBag", value = potionBag}) 40 role:updateProperty({field = "potionBag", value = potionBag})
41 role:checkTaskEnter("PotionMake", {count = count, id = potionId}) 41 role:checkTaskEnter("PotionMake", {count = count, id = potionId})
42 42
43 - role:log("role_action", {desc = "makePotion", int1 = potionId, int2 = count}) 43 + role:log("carriage_cook", {
  44 + item_id = potionId, -- 道具id
  45 + item_level = potionLv, -- 道具等级
  46 + item_type = 0, -- 道具类型,具体见枚举表中道具类型枚举表
  47 + carriage_cook_amount = count, -- 制作总量
  48 + carriage_cook_cost = cost, -- 制作消耗道具,json格式记录,{'itemid1':10,'itemid2':5,…………..}
  49 + })
44 SendPacket(actionCodes.Car_makePotionRpc, MsgPack.pack({potionBag = potionBag})) 50 SendPacket(actionCodes.Car_makePotionRpc, MsgPack.pack({potionBag = potionBag}))
45 return true 51 return true
46 end 52 end
@@ -91,7 +97,14 @@ function _M.equipUpRpc( agent, data ) @@ -91,7 +97,14 @@ function _M.equipUpRpc( agent, data )
91 role:addEquip(typ, nextLv ,count, {log = {desc = "equipUp"}}) 97 role:addEquip(typ, nextLv ,count, {log = {desc = "equipUp"}})
92 role:checkTaskEnter("EquipUp", {count = count}) 98 role:checkTaskEnter("EquipUp", {count = count})
93 99
94 - role:log("role_action", {desc = "equipUp", int1 = id, int2 = count}) 100 + role:log("equip_upgrade", {
  101 + equip_upgrade_part = typ, -- 升级部位,记录部位ID
  102 + equip_id = nextLv, -- 升级后的装备ID
  103 + equip_upgrade_amount = count, -- 升级获取的装备数量
  104 + equip_upgrade_usedid = lv, -- 升级消耗的装备ID
  105 + equip_upgrade_cost = costCount, -- 升级操作消耗装备数量
  106 + equip_upgrade_current = cost, -- 升级消耗的货币类型
  107 + })
95 108
96 SendPacket(actionCodes.Car_equipUpRpc, '') 109 SendPacket(actionCodes.Car_equipUpRpc, '')
97 return true 110 return true
@@ -167,8 +180,6 @@ function _M.saleEquipRpc(agent, data ) @@ -167,8 +180,6 @@ function _M.saleEquipRpc(agent, data )
167 role:checkTaskEnter("SaleEquip", {count = allCount}) 180 role:checkTaskEnter("SaleEquip", {count = allCount})
168 reward, change = role:award(reward, {log = {desc = "saleEquip"}}) 181 reward, change = role:award(reward, {log = {desc = "saleEquip"}})
169 182
170 - role:log("role_action", {desc = "saleEquip", int1 = allCount})  
171 -  
172 SendPacket(actionCodes.Car_saleEquipRpc, MsgPack.pack(role:packReward(reward, change))) 183 SendPacket(actionCodes.Car_saleEquipRpc, MsgPack.pack(role:packReward(reward, change)))
173 return true 184 return true
174 end 185 end
src/actions/DinerAction.lua
@@ -104,8 +104,7 @@ function _M.addSellRpc( agent, data ) @@ -104,8 +104,7 @@ function _M.addSellRpc( agent, data )
104 if change then 104 if change then
105 role.dinerData:updateProperty({field = "customer", value = customer}) 105 role.dinerData:updateProperty({field = "customer", value = customer})
106 end 106 end
107 -  
108 - role:log("diner_action", {desc = "addSell", int1 = dish, int2 = count}) 107 + role:finishGuide(28)
109 108
110 role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) 109 role.dinerData:updateProperty({field = "sells", value = json.encode(sells)})
111 SendPacket(actionCodes.Diner_addSellRpc, "") 110 SendPacket(actionCodes.Diner_addSellRpc, "")
@@ -140,7 +139,7 @@ function _M.removeSellRpc( agent, data ) @@ -140,7 +139,7 @@ function _M.removeSellRpc( agent, data )
140 return 5 139 return 5
141 end 140 end
142 141
143 - role.dinerData:updateSell(slot) 142 + local temp = role.dinerData:updateSell(slot)
144 local reward, change = {} 143 local reward, change = {}
145 local cost = dishData.material:toNumMap() 144 local cost = dishData.material:toNumMap()
146 for k, n in pairs(cost) do 145 for k, n in pairs(cost) do
@@ -150,7 +149,14 @@ function _M.removeSellRpc( agent, data ) @@ -150,7 +149,14 @@ function _M.removeSellRpc( agent, data )
150 reward, change = role:award(reward, {log = {desc = "removeSell"}}) 149 reward, change = role:award(reward, {log = {desc = "removeSell"}})
151 sells[slot].count = 0 150 sells[slot].count = 0
152 151
153 - role:log("diner_action", {desc = "removeSell", int1 = dish}) 152 + role:log("restaurant_sale", {
  153 + item_id = dish, -- 售卖物品ID
  154 + restaurant_sale_seat = slot, -- 售卖物品所在位置
  155 + restaurant_sale_time = temp.deltaTime or 0, -- 售卖时长
  156 + restaurant_sale_type = 2, -- 售卖方式,正常售卖:0, 加速:1,移除售卖:2
  157 + restaurant_sale_coin = reward[ItemId.DinerCoin] or 0, -- 售卖获得美食币
  158 + restaurant_sale_gear = reward[ItemId.Gold] or 0, -- 售卖获得齿轮
  159 + })
154 160
155 role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) 161 role.dinerData:updateProperty({field = "sells", value = json.encode(sells)})
156 SendPacket(actionCodes.Diner_removeSellRpc, MsgPack.pack({reward = reward, change = change})) 162 SendPacket(actionCodes.Diner_removeSellRpc, MsgPack.pack({reward = reward, change = change}))
@@ -162,8 +168,11 @@ function _M.getSellRewardRpc( agent, data ) @@ -162,8 +168,11 @@ function _M.getSellRewardRpc( agent, data )
162 local dirty = false 168 local dirty = false
163 local reward, popular = "", 0 169 local reward, popular = "", 0
164 local sells = json.decode(role.dinerData:getProperty("sells")) 170 local sells = json.decode(role.dinerData:getProperty("sells"))
  171 +
  172 + local deltaTimes = {}
165 for slot, _ in pairs(sells) do 173 for slot, _ in pairs(sells) do
166 - role.dinerData:updateSell(slot) 174 + local temp = role.dinerData:updateSell(slot)
  175 + deltaTimes[slot] = temp.deltaTime
167 end 176 end
168 sells = json.decode(role.dinerData:getProperty("sells")) 177 sells = json.decode(role.dinerData:getProperty("sells"))
169 for slot, sell in pairs(sells) do 178 for slot, sell in pairs(sells) do
@@ -187,6 +196,15 @@ function _M.getSellRewardRpc( agent, data ) @@ -187,6 +196,15 @@ function _M.getSellRewardRpc( agent, data )
187 end 196 end
188 sells[slot].reward = "" 197 sells[slot].reward = ""
189 sells[slot].popular = 0 198 sells[slot].popular = 0
  199 +
  200 + role:log("restaurant_sale", {
  201 + item_id = sell.dish, -- 售卖物品ID
  202 + restaurant_sale_seat = slot, -- 售卖物品所在位置
  203 + restaurant_sale_time = deltaTimes[slot] or 0, -- 售卖时长
  204 + restaurant_sale_type = 0, -- 售卖方式,正常售卖:0, 加速:1,移除售卖:2
  205 + restaurant_sale_coin = rewards[ItemId.DinerCoin] or 0, -- 售卖获得美食币
  206 + restaurant_sale_gear = rewards[ItemId.Gold] or 0, -- 售卖获得齿轮
  207 + })
190 end 208 end
191 role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) 209 role.dinerData:updateProperty({field = "sells", value = json.encode(sells)})
192 local gift = reward:toNumMap() 210 local gift = reward:toNumMap()
@@ -204,7 +222,7 @@ function _M.getSellRewardRpc( agent, data ) @@ -204,7 +222,7 @@ function _M.getSellRewardRpc( agent, data )
204 role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order")) 222 role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order"))
205 end 223 end
206 224
207 - role:log("diner_action", {desc = "sell"}) 225 +
208 226
209 SendPacket(actionCodes.Diner_getSellRewardRpc, MsgPack.pack({reward = reward, change = change})) 227 SendPacket(actionCodes.Diner_getSellRewardRpc, MsgPack.pack({reward = reward, change = change}))
210 return true 228 return true
@@ -254,6 +272,15 @@ function _M.expediteSellRpc( agent, data ) @@ -254,6 +272,15 @@ function _M.expediteSellRpc( agent, data )
254 dirty = true 272 dirty = true
255 end 273 end
256 end 274 end
  275 +
  276 + role:log("restaurant_sale", {
  277 + item_id = sell.dish, -- 售卖物品ID
  278 + restaurant_sale_seat = slot, -- 售卖物品所在位置
  279 + restaurant_sale_time = result.deltaTime or 0, -- 售卖时长
  280 + restaurant_sale_type = 1, -- 售卖方式,正常售卖:0, 加速:1,移除售卖:2
  281 + restaurant_sale_coin = rewards[ItemId.DinerCoin] or 0, -- 售卖获得美食币
  282 + restaurant_sale_gear = rewards[ItemId.Gold] or 0, -- 售卖获得齿轮
  283 + })
257 end 284 end
258 end 285 end
259 286
@@ -284,8 +311,6 @@ function _M.expediteSellRpc( agent, data ) @@ -284,8 +311,6 @@ function _M.expediteSellRpc( agent, data )
284 end 311 end
285 role:checkTaskEnter("FoodSellQuick") 312 role:checkTaskEnter("FoodSellQuick")
286 313
287 - role:log("diner_action", {desc = "sellQ"})  
288 -  
289 SendPacket(actionCodes.Diner_expediteSellRpc, MsgPack.pack({reward = reward, change = change, popular = popular})) 314 SendPacket(actionCodes.Diner_expediteSellRpc, MsgPack.pack({reward = reward, change = change, popular = popular}))
290 return true 315 return true
291 end 316 end
@@ -325,7 +350,13 @@ function _M.levelUpRpc( agent, data ) @@ -325,7 +350,13 @@ function _M.levelUpRpc( agent, data )
325 role.dinerData:updateProperty({field = "buildL", value = buildL:setv(index, curLevel + 1)}) 350 role.dinerData:updateProperty({field = "buildL", value = buildL:setv(index, curLevel + 1)})
326 role:checkTaskEnter("DinerLevelUp", {type = index, level = curLevel + 1}) 351 role:checkTaskEnter("DinerLevelUp", {type = index, level = curLevel + 1})
327 352
328 - role:log("diner_action", {desc = "buildUp", int1 = index, int2 = curLevel + 1}) 353 + role:log("restaurant_up", {
  354 + restaurant_up_type = index - 1, --升级部件类型,店面:0, 接客:1, 满意度:2, 宣传:3, 广告:4, 周边:5
  355 + restaurant_up_gear = cost[ItemId.Gold] or 0, --消耗齿轮数量
  356 + restaurant_up_coin = cost[ItemId.DinerCoin] or 0, --花费美食币数量
  357 + restaurant_up_effectbef = curLevel, --升级前加成
  358 + restaurant_up_effect = curLevel + 1, --升级后加成
  359 + })
329 360
330 SendPacket(actionCodes.Diner_levelUpRpc, '') 361 SendPacket(actionCodes.Diner_levelUpRpc, '')
331 return true 362 return true
@@ -407,9 +438,14 @@ function _M.talentUpRpc( agent, data ) @@ -407,9 +438,14 @@ function _M.talentUpRpc( agent, data )
407 -- end 438 -- end
408 439
409 role:checkTaskEnter("DinerTalentUp", {type = talentData.effect:toArray(true,"=")[1], level = dishLevel + 1}) 440 role:checkTaskEnter("DinerTalentUp", {type = talentData.effect:toArray(true,"=")[1], level = dishLevel + 1})
410 -  
411 - role:log("diner_action", {desc = "talentUp", int1 = dish, int2 = dishLevel + 1})  
412 - 441 + role:finishGuide(27)
  442 + role:log("carriage_logistics", {
  443 + carriage_logistics_type = typ, -- 后勤室制作类型ID,变异:0,通常:1,魔法:2
  444 + carriage_logistics_itemid = dish, -- 后勤室升级物品或技能ID
  445 + carriage_logistics_itemlv = dishLevel + 1, -- 升级后物品或技能等级
  446 + carriage_logistics_gear = cost[ItemId.Gold] or 0, -- 后勤室升级花费齿轮数量
  447 + carriage_logistics_coin = cost[ItemId.DinerCoin] or 0, -- 后勤室升级花费美食币数量
  448 + })
413 SendPacket(actionCodes.Diner_talentUpRpc, '') 449 SendPacket(actionCodes.Diner_talentUpRpc, '')
414 return true 450 return true
415 end 451 end
@@ -443,7 +479,6 @@ function _M.skillUpRpc( agent, data ) @@ -443,7 +479,6 @@ function _M.skillUpRpc( agent, data )
443 479
444 role:costItems(cost, {log = {desc = "dinerSkillUp", int1 = skill, int2 = skillLevel + 1}}) 480 role:costItems(cost, {log = {desc = "dinerSkillUp", int1 = skill, int2 = skillLevel + 1}})
445 role.dinerData:updateProperty({field = "skillTree", value = skillTree:setv(skill, skillLevel + 1)}) 481 role.dinerData:updateProperty({field = "skillTree", value = skillTree:setv(skill, skillLevel + 1)})
446 - role:log("diner_action", {desc = "skillUp", int1 = skill, int2 = skillLevel + 1})  
447 482
448 SendPacket(actionCodes.Diner_skillUpRpc, '') 483 SendPacket(actionCodes.Diner_skillUpRpc, '')
449 return true 484 return true
@@ -471,8 +506,6 @@ function _M.lockTaskRpc( agent, data ) @@ -471,8 +506,6 @@ function _M.lockTaskRpc( agent, data )
471 end 506 end
472 role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) 507 role.dinerData:updateProperty({field = "order", value = json.encode(orders)})
473 508
474 - role:log("diner_action", {desc = "lockTask", int1 = order.id})  
475 -  
476 SendPacket(actionCodes.Diner_lockTaskRpc, MsgPack.pack({lock = order.lock})) 509 SendPacket(actionCodes.Diner_lockTaskRpc, MsgPack.pack({lock = order.lock}))
477 return true 510 return true
478 end 511 end
@@ -509,8 +542,6 @@ function _M.updateTaskRpc( agent, data ) @@ -509,8 +542,6 @@ function _M.updateTaskRpc( agent, data )
509 orders[index].status = 1 542 orders[index].status = 1
510 orders[index].lock = 1 543 orders[index].lock = 1
511 544
512 - role:log("diner_action", {desc = "getTask", int1 = order.id})  
513 -  
514 role:checkTaskEnter("GetOderTask", {rarity = taskSet.rarity}) 545 role:checkTaskEnter("GetOderTask", {rarity = taskSet.rarity})
515 elseif cmd == 1 then 546 elseif cmd == 1 then
516 if order.status ~= 1 then 547 if order.status ~= 1 then
@@ -519,8 +550,6 @@ function _M.updateTaskRpc( agent, data ) @@ -519,8 +550,6 @@ function _M.updateTaskRpc( agent, data )
519 orders[index].status = 0 550 orders[index].status = 0
520 orders[index].lock = 0 551 orders[index].lock = 0
521 552
522 - role:log("diner_action", {desc = "deleteTask", int1 = order.id})  
523 -  
524 elseif cmd == 2 then 553 elseif cmd == 2 then
525 if order.status ~= 1 then 554 if order.status ~= 1 then
526 return 32 555 return 32
@@ -528,7 +557,6 @@ function _M.updateTaskRpc( agent, data ) @@ -528,7 +557,6 @@ function _M.updateTaskRpc( agent, data )
528 if order.n < taskData.value then 557 if order.n < taskData.value then
529 return 6 558 return 6
530 end 559 end
531 - role:log("diner_action", {desc = "finishTask", int1 = order.id})  
532 560
533 reward, change = role:award(taskData.reward, {log = {desc = "dinerFinishTask", int1 = order.id}}) 561 reward, change = role:award(taskData.reward, {log = {desc = "dinerFinishTask", int1 = order.id}})
534 table.remove(orders,index) 562 table.remove(orders,index)
@@ -537,6 +565,14 @@ function _M.updateTaskRpc( agent, data ) @@ -537,6 +565,14 @@ function _M.updateTaskRpc( agent, data )
537 return 33 565 return 33
538 end 566 end
539 567
  568 +
  569 + role:log("restaurant_order", {
  570 + restaurant_order_id = order.id, -- 订单任务ID
  571 + 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
  574 + })
  575 +
540 role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) 576 role.dinerData:updateProperty({field = "order", value = json.encode(orders)})
541 SendPacket(actionCodes.Diner_updateTaskRpc, MsgPack.pack({reward = reward, change = change})) 577 SendPacket(actionCodes.Diner_updateTaskRpc, MsgPack.pack({reward = reward, change = change}))
542 return true 578 return true
@@ -611,8 +647,7 @@ function _M.refreshTaskRpc( agent, data ) @@ -611,8 +647,7 @@ function _M.refreshTaskRpc( agent, data )
611 end 647 end
612 end 648 end
613 649
614 - role:log("diner_action", {desc = "reTask"})  
615 - 650 + role:finishGuide(41)
616 role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) 651 role.dinerData:updateProperty({field = "order", value = json.encode(orders)})
617 652
618 SendPacket(actionCodes.Diner_refreshTaskRpc, '') 653 SendPacket(actionCodes.Diner_refreshTaskRpc, '')
@@ -652,8 +687,7 @@ function _M.addWantFoodRpc(agent , data) @@ -652,8 +687,7 @@ function _M.addWantFoodRpc(agent , data)
652 gfood[slot] = {id = itemId, st = skynet.timex()} 687 gfood[slot] = {id = itemId, st = skynet.timex()}
653 end 688 end
654 689
655 - role:log("diner_action", {desc = "wantFood"})  
656 - 690 + role:finishGuide(36)
657 role.dinerData:updateProperty({field = "gfood", value = gfood}) 691 role.dinerData:updateProperty({field = "gfood", value = gfood})
658 692
659 SendPacket(actionCodes.Diner_addWantFoodRpc, '') 693 SendPacket(actionCodes.Diner_addWantFoodRpc, '')
@@ -687,12 +721,19 @@ function _M.getGreenhouseRpc( agent, data ) @@ -687,12 +721,19 @@ function _M.getGreenhouseRpc( agent, data )
687 else 721 else
688 gfood[k].st = st + speed * reward[itemId] 722 gfood[k].st = st + speed * reward[itemId]
689 end 723 end
  724 +
  725 + role:log("restaurant_material", {
  726 + item_id = itemId, -- 获取物品ID
  727 + restaurant_material_start = st, -- 申请获取时间
  728 + restaurant_material_time = endTime2 - st, -- 申请到领取耗时
  729 + restaurant_material_num = reward[itemId], -- 获取物品数量
  730 + })
  731 +
690 end 732 end
691 role.dinerData:updateProperty({field = "gfood", value = gfood}) 733 role.dinerData:updateProperty({field = "gfood", value = gfood})
692 local reward, change = role:award(reward, {log = {desc = "greenHourse", int1 = level}}) 734 local reward, change = role:award(reward, {log = {desc = "greenHourse", int1 = level}})
693 role:checkTaskEnter("FoodMGet") 735 role:checkTaskEnter("FoodMGet")
694 736
695 - role:log("diner_action", {desc = "greenHourse"})  
696 737
697 SendPacket(actionCodes.Diner_getGreenhouseRpc, MsgPack.pack({reward = reward, change = change})) 738 SendPacket(actionCodes.Diner_getGreenhouseRpc, MsgPack.pack({reward = reward, change = change}))
698 return true 739 return true
@@ -830,7 +871,7 @@ function _M.entrustRpc(agent , data) @@ -830,7 +871,7 @@ function _M.entrustRpc(agent , data)
830 end 871 end
831 role.dinerData:updateProperty({field = "entrust", value = entrust}) 872 role.dinerData:updateProperty({field = "entrust", value = entrust})
832 873
833 - role:log("diner_action", {desc = "entrus", short1 = ctype, int1 = entrustId}) 874 + role:finishGuide(26)
834 875
835 SendPacket(actionCodes.Diner_entrustRpc, MsgPack.pack({reward = reward, change = change})) 876 SendPacket(actionCodes.Diner_entrustRpc, MsgPack.pack({reward = reward, change = change}))
836 return true 877 return true
@@ -856,7 +897,17 @@ function _M.collectRpc(agent , data) @@ -856,7 +897,17 @@ function _M.collectRpc(agent , data)
856 local reward, change = role:award(customerData.reward, {log = {desc = "dinerCollect", int1 = id}}) 897 local reward, change = role:award(customerData.reward, {log = {desc = "dinerCollect", int1 = id}})
857 customer[id] = 1 898 customer[id] = 1
858 role.dinerData:updateProperty({field = "customer", value = customer}) -- 解锁了 899 role.dinerData:updateProperty({field = "customer", value = customer}) -- 解锁了
859 - role:log("diner_action", {desc = "collect", int1 = id}) 900 +
  901 + local count = 0
  902 + for c_, v in pairs(customer) do
  903 + count = count + 1
  904 + end
  905 +
  906 + role:log("restaurant_collect", {
  907 + restaurant_collect_id = id, -- 图谱收集ID
  908 + restaurant_collect_rwd = reward, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
  909 + restaurant_collect_plan = count, -- 收集进度,即解锁顾客,数字表示
  910 + })
860 911
861 SendPacket(actionCodes.Diner_collectRpc, MsgPack.pack({reward = reward, change = change})) 912 SendPacket(actionCodes.Diner_collectRpc, MsgPack.pack({reward = reward, change = change}))
862 return true 913 return true
@@ -886,8 +937,6 @@ function _M.comboRewardRpc(agent , data) @@ -886,8 +937,6 @@ function _M.comboRewardRpc(agent , data)
886 937
887 role.dinerData:updateProperty({field = "comboStatus", value = comboStatus}) -- 解锁了 938 role.dinerData:updateProperty({field = "comboStatus", value = comboStatus}) -- 解锁了
888 939
889 - role:log("diner_action", {desc = "combo", int1 = id})  
890 -  
891 SendPacket(actionCodes.Diner_comboRewardRpc, MsgPack.pack({reward = reward, change = change})) 940 SendPacket(actionCodes.Diner_comboRewardRpc, MsgPack.pack({reward = reward, change = change}))
892 return true 941 return true
893 end 942 end
src/actions/EmailAction.lua
@@ -53,7 +53,6 @@ function _M.listRpc(agent, data) @@ -53,7 +53,6 @@ function _M.listRpc(agent, data)
53 content = email.content, 53 content = email.content,
54 attachments = email.attachments 54 attachments = email.attachments
55 }) 55 })
56 - role:log("mail_action", {desc = "get_global", key1 = email.title, key2 = email.attachments})  
57 end 56 end
58 end 57 end
59 end 58 end
@@ -90,21 +89,17 @@ function _M.drawAllAttachRpc(agent, data) @@ -90,21 +89,17 @@ function _M.drawAllAttachRpc(agent, data)
90 local ids = {} 89 local ids = {}
91 90
92 local emails = loadEmails(roleId) 91 local emails = loadEmails(roleId)
93 - redisproxy:pipelining(function (red)  
94 - for _, email in ipairs(emails) do  
95 - local attachments = getEmailAttachments(email)  
96 - if attachments ~= "" then  
97 - local emailId = email:getProperty("id")  
98 - ids[emailId] = 1  
99 - red:hset(string.format(R_EMAIL_ITEM, roleId, emailId), "status", 2)  
100 - role:log("mail_action", {desc = "draw_attach", int1 = emailId, key1 = email:getProperty("title"), key2 = attachments})  
101 -  
102 - for key, v in pairs(attachments:toNumMap()) do  
103 - reward[key] = (reward[key] or 0) + v  
104 - end 92 + for _, email in ipairs(emails) do
  93 + local attachments = getEmailAttachments(email)
  94 + if attachments ~= "" then
  95 + email:setProperty("status", 2)
  96 + email:log(role, 2)
  97 + ids[email:getProperty("id")] = 1
  98 + for key, v in pairs(attachments:toNumMap()) do
  99 + reward[key] = (reward[key] or 0) + v
105 end 100 end
106 end 101 end
107 - end) 102 + end
108 reward, change = role:award(reward, {log = {desc = "draw_attach"}}) 103 reward, change = role:award(reward, {log = {desc = "draw_attach"}})
109 SendPacket(actionCodes.Email_drawAllAttachRpc, MsgPack.pack({ids = ids, reward = reward, change = change})) 104 SendPacket(actionCodes.Email_drawAllAttachRpc, MsgPack.pack({ids = ids, reward = reward, change = change}))
110 return true 105 return true
@@ -124,11 +119,11 @@ function _M.drawAttachRpc(agent, data) @@ -124,11 +119,11 @@ function _M.drawAttachRpc(agent, data)
124 local attachments = getEmailAttachments(email) 119 local attachments = getEmailAttachments(email)
125 if attachments == "" then return end 120 if attachments == "" then return end
126 121
127 - local reward, change = role:award(attachments, {log = {desc = "draw_attach", int1 = emailId, key1 = email:getProperty("title")}})  
128 - redisproxy:hset(rds, "status", 2) -- 领取标记 122 + local reward, change = role:award(attachments, {log = {desc = "draw_attach", int1 = emailId}})
  123 + email:setProperty("status", 2)
  124 + email:log(role, 2)
129 SendPacket(actionCodes.Email_drawAttachRpc, MsgPack.pack({reward = reward, change = change})) 125 SendPacket(actionCodes.Email_drawAttachRpc, MsgPack.pack({reward = reward, change = change}))
130 126
131 - role:log("mail_action", {desc = "draw_attach", int1 = id, key1 = email:getProperty("title"), key2 = attachments})  
132 return true 127 return true
133 end 128 end
134 129
@@ -139,11 +134,12 @@ function _M.checkRpc(agent, data) @@ -139,11 +134,12 @@ function _M.checkRpc(agent, data)
139 local msg = MsgPack.unpack(data) 134 local msg = MsgPack.unpack(data)
140 local id = msg.id 135 local id = msg.id
141 136
142 - local rds = string.format(R_EMAIL_ITEM, roleId, id)  
143 - if not redisproxy:exists(rds) then return end 137 + local emailRds = string.format("email:%d:%s", roleId, id)
  138 + local email = require("models.Email").new({key = emailRds})
  139 + if not email:load() then return end
144 140
145 - redisproxy:hset(rds, "status", 1)  
146 - role:log("mail_action", {desc = "check_mail", int1 = id}) 141 + email:setProperty("status", 1)
  142 + email:log(role, 1)
147 143
148 SendPacket(actionCodes.Email_checkRpc, '') 144 SendPacket(actionCodes.Email_checkRpc, '')
149 return true 145 return true
@@ -171,6 +167,7 @@ function _M.delRpc(agent, data) @@ -171,6 +167,7 @@ function _M.delRpc(agent, data)
171 attachments = emailData.attachment 167 attachments = emailData.attachment
172 end 168 end
173 if status == 2 or (status == 1 and attachments:len() == 0) then 169 if status == 2 or (status == 1 and attachments:len() == 0) then
  170 + email:log(role, 3)
174 red:lrem(rds, 0, id) 171 red:lrem(rds, 0, id)
175 red:del(emailRds) 172 red:del(emailRds)
176 result[tonum(id)] = 1 173 result[tonum(id)] = 1
@@ -178,9 +175,6 @@ function _M.delRpc(agent, data) @@ -178,9 +175,6 @@ function _M.delRpc(agent, data)
178 end 175 end
179 end 176 end
180 end) 177 end)
181 - for delId, _ in ipairs(result) do  
182 - role:log("mail_action", {desc = "del_mail", int1 = delId})  
183 - end  
184 SendPacket(actionCodes.Email_delRpc, MsgPack.pack({result = result})) 178 SendPacket(actionCodes.Email_delRpc, MsgPack.pack({result = result}))
185 return true 179 return true
186 end 180 end
src/actions/FriendAction.lua
@@ -111,7 +111,6 @@ function _M.searchRpc(agent, data) @@ -111,7 +111,6 @@ function _M.searchRpc(agent, data)
111 })) 111 }))
112 end 112 end
113 113
114 - role:log("role_action", {desc = "searchFriend"})  
115 SendPacket(actionCodes.Friend_searchRpc, MsgPack.pack({searchList = searchList})) 114 SendPacket(actionCodes.Friend_searchRpc, MsgPack.pack({searchList = searchList}))
116 return true 115 return true
117 end 116 end
@@ -178,8 +177,6 @@ function _M.applyRpc(agent, data) @@ -178,8 +177,6 @@ function _M.applyRpc(agent, data)
178 myInfo.online = true 177 myInfo.online = true
179 myInfo.hadApply = true 178 myInfo.hadApply = true
180 179
181 - role:log("role_action", {desc = "addFriend", int1 = 1})  
182 -  
183 rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newApply = 1, info = {myInfo}})) -- 通知对方 180 rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newApply = 1, info = {myInfo}})) -- 通知对方
184 end 181 end
185 182
@@ -217,6 +214,7 @@ local function checkHandleApply(roleId, objectId, needAddNew) @@ -217,6 +214,7 @@ local function checkHandleApply(roleId, objectId, needAddNew)
217 red:sismember(FRIEND_BLACK_KEY:format(objectId), roleId) 214 red:sismember(FRIEND_BLACK_KEY:format(objectId), roleId)
218 red:sismember(FRIEND_BLACK_KEY:format(roleId), objectId) 215 red:sismember(FRIEND_BLACK_KEY:format(roleId), objectId)
219 end) 216 end)
  217 +
220 --自己好友满了 218 --自己好友满了
221 if (redret[1] + needAddNew) >= globalCsv.friendListLimit then 219 if (redret[1] + needAddNew) >= globalCsv.friendListLimit then
222 return 1 220 return 1
@@ -233,6 +231,8 @@ local function checkHandleApply(roleId, objectId, needAddNew) @@ -233,6 +231,8 @@ local function checkHandleApply(roleId, objectId, needAddNew)
233 if redret[4] == 1 then 231 if redret[4] == 1 then
234 return 4 232 return 4
235 end 233 end
  234 +
  235 + return nil, redret[1]
236 end 236 end
237 237
238 function _M.handleApplyRpc(agent, data) 238 function _M.handleApplyRpc(agent, data)
@@ -251,7 +251,8 @@ function _M.handleApplyRpc(agent, data) @@ -251,7 +251,8 @@ function _M.handleApplyRpc(agent, data)
251 if not redisproxy:zscore(FRIEND_APPLY_KEY:format(roleId), objectId) then 251 if not redisproxy:zscore(FRIEND_APPLY_KEY:format(roleId), objectId) then
252 return 252 return
253 end 253 end
254 - result = checkHandleApply(roleId, objectId) 254 + local curCount
  255 + result, curCount = checkHandleApply(roleId, objectId)
255 256
256 if not result then 257 if not result then
257 redisproxy:pipelining(function (red) 258 redisproxy:pipelining(function (red)
@@ -277,8 +278,11 @@ function _M.handleApplyRpc(agent, data) @@ -277,8 +278,11 @@ function _M.handleApplyRpc(agent, data)
277 otherInfo.pGet = redret[2] == 1 and 1 or nil 278 otherInfo.pGet = redret[2] == 1 and 1 or nil
278 SendPacket(actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = {otherInfo}})) 279 SendPacket(actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = {otherInfo}}))
279 280
280 - role:log("role_action", {desc = "addFriend", int1 = 1})  
281 - 281 + role:log("friend_opt", {
  282 + friend_opt_type = 100, -- 好友操作类型,见枚举表中 好友操作类型枚举表
  283 + friend_roleid = objectId, -- 好友账户下的角色id
  284 + friend_cnt = curCount + 1, -- 操作后好友数量
  285 + })
282 end 286 end
283 287
284 elseif cmd == 0 then -- 不同意 288 elseif cmd == 0 then -- 不同意
@@ -301,7 +305,7 @@ function _M.handleApplyRpc(agent, data) @@ -301,7 +305,7 @@ function _M.handleApplyRpc(agent, data)
301 local needAddInfo = {} 305 local needAddInfo = {}
302 for _, objId in ipairs(allIds) do 306 for _, objId in ipairs(allIds) do
303 objId = tonumber(objId) 307 objId = tonumber(objId)
304 - local cr = checkHandleApply(roleId, objId, #needAdd) 308 + local cr, curCount = checkHandleApply(roleId, objId, #needAdd)
305 if not cr then 309 if not cr then
306 table.insert(needAdd, objId) 310 table.insert(needAdd, objId)
307 table.insert(needAddMy, objId) 311 table.insert(needAddMy, objId)
@@ -312,6 +316,12 @@ function _M.handleApplyRpc(agent, data) @@ -312,6 +316,12 @@ function _M.handleApplyRpc(agent, data)
312 otherInfo.isFriend = true 316 otherInfo.isFriend = true
313 otherInfo.pGet = fpoint[objId] and 1 or nil 317 otherInfo.pGet = fpoint[objId] and 1 or nil
314 table.insert(needAddInfo, otherInfo) 318 table.insert(needAddInfo, otherInfo)
  319 +
  320 + role:log("friend_opt", {
  321 + friend_opt_type = 100, -- 好友操作类型,见枚举表中 好友操作类型枚举表
  322 + friend_roleid = objId, -- 好友账户下的角色id
  323 + friend_cnt = curCount + 1, -- 操作后好友数量
  324 + })
315 end 325 end
316 end 326 end
317 327
@@ -337,8 +347,6 @@ function _M.handleApplyRpc(agent, data) @@ -337,8 +347,6 @@ function _M.handleApplyRpc(agent, data)
337 rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = {myInfo}})) -- 通知对方 347 rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = {myInfo}})) -- 通知对方
338 end 348 end
339 if next(needAdd) then 349 if next(needAdd) then
340 - role:log("role_action", {desc = "addFriend", int1 = #needAdd})  
341 -  
342 SendPacket(actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = needAddInfo})) 350 SendPacket(actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = needAddInfo}))
343 else 351 else
344 result = 1 352 result = 1
@@ -420,6 +428,11 @@ function _M.deleteRpc(agent, data) @@ -420,6 +428,11 @@ function _M.deleteRpc(agent, data)
420 end 428 end
421 rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({deleteFriend = 1, roleId = roleId})) 429 rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({deleteFriend = 1, roleId = roleId}))
422 430
  431 + role:log("friend_opt", {
  432 + friend_opt_type = 200, -- 好友操作类型,见枚举表中 好友操作类型枚举表
  433 + friend_roleid = objectId, -- 好友账户下的角色id
  434 + friend_cnt = 0, -- 操作后好友数量
  435 + })
423 SendPacket(actionCodes.Friend_deleteRpc, MsgPack.pack("")) 436 SendPacket(actionCodes.Friend_deleteRpc, MsgPack.pack(""))
424 return true 437 return true
425 end 438 end
@@ -449,15 +462,18 @@ function _M.blockRpc(agent, data) @@ -449,15 +462,18 @@ function _M.blockRpc(agent, data)
449 red:ZREM(FRIEND_APPLY_KEY:format(objectId), roleId) 462 red:ZREM(FRIEND_APPLY_KEY:format(objectId), roleId)
450 red:sadd(FRIEND_BLACK_KEY:format(roleId), objectId) 463 red:sadd(FRIEND_BLACK_KEY:format(roleId), objectId)
451 end) 464 end)
452 - rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({deleteFriend = 1, roleId = roleId}))  
453 - 465 + rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({deleteFriend = 1, roleId = roleId}))
  466 + role:log("friend_opt", {
  467 + friend_opt_type = 300, -- 好友操作类型,见枚举表中 好友操作类型枚举表
  468 + friend_roleid = objectId, -- 好友账户下的角色id
  469 + friend_cnt = 0, -- 操作后好友数量
  470 + })
454 end 471 end
455 elseif cmd == 2 then 472 elseif cmd == 2 then
456 redisproxy:SREM(FRIEND_BLACK_KEY:format(roleId), objectId) 473 redisproxy:SREM(FRIEND_BLACK_KEY:format(roleId), objectId)
457 else 474 else
458 return 475 return
459 end 476 end
460 -  
461 SendPacket(actionCodes.Friend_blockRpc, MsgPack.pack({result = result})) 477 SendPacket(actionCodes.Friend_blockRpc, MsgPack.pack({result = result}))
462 return true 478 return true
463 end 479 end
@@ -537,8 +553,6 @@ function _M.pointRpc(agent, data) @@ -537,8 +553,6 @@ function _M.pointRpc(agent, data)
537 role.dailyData:updateProperty({field = "giveFP", value = giveP}) 553 role.dailyData:updateProperty({field = "giveFP", value = giveP})
538 role:checkTaskEnter("GiveFriendP", {count = 1}) 554 role:checkTaskEnter("GiveFriendP", {count = 1})
539 rpcRole(objId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newPoint = 1, roleId = roleId})) 555 rpcRole(objId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({newPoint = 1, roleId = roleId}))
540 -  
541 - role:log("role_action", {desc = "giveFPoint", int1 = 1})  
542 end 556 end
543 elseif cmd == 2 then -- 领取 557 elseif cmd == 2 then -- 领取
544 local objId = msg.roleId 558 local objId = msg.roleId
@@ -558,7 +572,6 @@ function _M.pointRpc(agent, data) @@ -558,7 +572,6 @@ function _M.pointRpc(agent, data)
558 role.dailyData:updateProperty({field = "getFP", value = getP}) 572 role.dailyData:updateProperty({field = "getFP", value = getP})
559 role:checkTaskEnter("GetFriendP", {count = 1}) 573 role:checkTaskEnter("GetFriendP", {count = 1})
560 574
561 - role:log("role_action", {desc = "getFPoint", int1 = 1})  
562 end 575 end
563 elseif cmd == 3 then -- 一键赠送领取 576 elseif cmd == 3 then -- 一键赠送领取
564 -- 赠送 577 -- 赠送
@@ -580,8 +593,6 @@ function _M.pointRpc(agent, data) @@ -580,8 +593,6 @@ function _M.pointRpc(agent, data)
580 role.dailyData:updateProperty({field = "giveFP", value = giveP}) 593 role.dailyData:updateProperty({field = "giveFP", value = giveP})
581 role:checkTaskEnter("GiveFriendP", {count = change}) 594 role:checkTaskEnter("GiveFriendP", {count = change})
582 595
583 - role:log("role_action", {desc = "giveFPoint", int1 = change})  
584 -  
585 else 596 else
586 result = 1 597 result = 1
587 end 598 end
@@ -606,7 +617,6 @@ function _M.pointRpc(agent, data) @@ -606,7 +617,6 @@ function _M.pointRpc(agent, data)
606 reward = role:award({[ItemId.FriendPoint] = getCount}, {log = {desc = "friendPoint"}}) 617 reward = role:award({[ItemId.FriendPoint] = getCount}, {log = {desc = "friendPoint"}})
607 role.dailyData:updateProperty({field = "getFP", value = getP}) 618 role.dailyData:updateProperty({field = "getFP", value = getP})
608 role:checkTaskEnter("GetFriendP", {count = getCount}) 619 role:checkTaskEnter("GetFriendP", {count = getCount})
609 - role:log("role_action", {desc = "getFPoint", int1 = getCount})  
610 else 620 else
611 result = (result or 0) + 2 621 result = (result or 0) + 2
612 end 622 end
src/actions/GmAction.lua
@@ -27,7 +27,6 @@ function _M.ignoreout(role, pms) @@ -27,7 +27,6 @@ function _M.ignoreout(role, pms)
27 else -- 解除 27 else -- 解除
28 role:updateProperty({field = "ignoreMt", value = 0}) 28 role:updateProperty({field = "ignoreMt", value = 0})
29 end 29 end
30 - role:log("gm_action", {desc = "ignoreout", key1 = pms.sender})  
31 return "指令生效" 30 return "指令生效"
32 end 31 end
33 32
@@ -47,17 +46,11 @@ function _M.ban(role, pms) @@ -47,17 +46,11 @@ function _M.ban(role, pms)
47 end) 46 end)
48 end 47 end
49 end 48 end
50 -  
51 - role:log("gm_action", {desc = "ban", int1 = time, int2 = ctype, key1 = pms.sender})  
52 -  
53 return isBan and "解封杀成功" or "封杀成功" 49 return isBan and "解封杀成功" or "封杀成功"
54 end 50 end
55 51
56 function _M.unban(role, pms) 52 function _M.unban(role, pms)
57 role:setBan(0, 0) 53 role:setBan(0, 0)
58 -  
59 - role:log("gm_action", {desc = "unban", key1 = pms.sender})  
60 -  
61 return "解封杀成功" 54 return "解封杀成功"
62 end 55 end
63 56
@@ -70,8 +63,6 @@ function _M.gmmsg(role, pms) @@ -70,8 +63,6 @@ function _M.gmmsg(role, pms)
70 skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd) 63 skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd)
71 end) 64 end)
72 end 65 end
73 - role:log("gm_action", {desc = "gmmsg", text1 = pms.pm1, key1 = pms.sender})  
74 -  
75 return "指令成功" 66 return "指令成功"
76 end 67 end
77 68
@@ -82,8 +73,6 @@ function _M.silent(role, pms) @@ -82,8 +73,6 @@ function _M.silent(role, pms)
82 return "解禁言成功" 73 return "解禁言成功"
83 end 74 end
84 role:updateProperty({field = "silent", value = specTime({hour = 0}, skynet.timex()) + pm1 * 86400}) 75 role:updateProperty({field = "silent", value = specTime({hour = 0}, skynet.timex()) + pm1 * 86400})
85 -  
86 - role:log("gm_action", {desc = "silent", int1 = pms.pm1, key1 = pms.sender})  
87 return "禁言成功" 76 return "禁言成功"
88 end 77 end
89 78
@@ -101,8 +90,6 @@ function _M.hero(role, pms) @@ -101,8 +90,6 @@ function _M.hero(role, pms)
101 if not role:addHero({type = heroType, log = {desc = "gm"}}) then 90 if not role:addHero({type = heroType, log = {desc = "gm"}}) then
102 return "失败" 91 return "失败"
103 end 92 end
104 -  
105 - role:log("gm_action", {desc = "hero", int1 = heroType, key1 = pms.sender})  
106 return "成功" 93 return "成功"
107 end 94 end
108 95
@@ -135,8 +122,6 @@ function _M.herol(role, pms) @@ -135,8 +122,6 @@ function _M.herol(role, pms)
135 hero:updateProperty({field = "level", delta = addLevel}) 122 hero:updateProperty({field = "level", delta = addLevel})
136 role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")}) 123 role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")})
137 124
138 - role:log("gm_action", {desc = "herol", int1 = heroType, int2 = addLevel, key1 = pms.sender})  
139 -  
140 return "成功" 125 return "成功"
141 end 126 end
142 127
@@ -148,8 +133,6 @@ function _M.herola(role, pms) @@ -148,8 +133,6 @@ function _M.herola(role, pms)
148 _M.herol(role, {pm1 = hero:getProperty("type"), pm2 = addLevel}) 133 _M.herol(role, {pm1 = hero:getProperty("type"), pm2 = addLevel})
149 end 134 end
150 135
151 - role:log("gm_action", {desc = "herola", int1 = addLevel, key1 = pms.sender})  
152 -  
153 return "成功" 136 return "成功"
154 end 137 end
155 138
@@ -160,7 +143,6 @@ function _M.equip(role, pms) @@ -160,7 +143,6 @@ function _M.equip(role, pms)
160 local level = tonum(pms.pm2) 143 local level = tonum(pms.pm2)
161 local count = tonum(pms.pm3) 144 local count = tonum(pms.pm3)
162 role:addEquip(typ, level, count, {log = {desc = "gm"}}) 145 role:addEquip(typ, level, count, {log = {desc = "gm"}})
163 - role:log("gm_action", {desc = "equip", int1 = typ, int2 = level, long1 = count, key1 = pms.sender})  
164 return "成功" 146 return "成功"
165 end 147 end
166 148
@@ -169,7 +151,6 @@ function _M.rune(role, pms) @@ -169,7 +151,6 @@ function _M.rune(role, pms)
169 local typ = tonum(pms.pm1) 151 local typ = tonum(pms.pm1)
170 local id = tonum(pms.pm2) 152 local id = tonum(pms.pm2)
171 local result = role:addRune({type = typ,id = id, log = {desc = "gm"}}) 153 local result = role:addRune({type = typ,id = id, log = {desc = "gm"}})
172 - role:log("gm_action", {desc = "rune", int1 = typ, int2 = id, key1 = pms.sender})  
173 154
174 return result 155 return result
175 end 156 end
@@ -190,8 +171,6 @@ function _M.fb(role, pms) -- 直接通关 @@ -190,8 +171,6 @@ function _M.fb(role, pms) -- 直接通关
190 role:hangFinish(carbonId) 171 role:hangFinish(carbonId)
191 addPre(carbonId) 172 addPre(carbonId)
192 173
193 - role:log("gm_action", {desc = "fb", int1 = carbonId, key1 = pms.sender})  
194 -  
195 role:checkTaskEnter("HangPass", {id = carbonId}) 174 role:checkTaskEnter("HangPass", {id = carbonId})
196 return "成功" 175 return "成功"
197 end 176 end
@@ -212,8 +191,6 @@ function _M.fbc(role, pms) -- 直接通关 @@ -212,8 +191,6 @@ function _M.fbc(role, pms) -- 直接通关
212 end 191 end
213 role:updateProperty({field = "hangPass", value = {}}) 192 role:updateProperty({field = "hangPass", value = {}})
214 addPre(carbonId) 193 addPre(carbonId)
215 -  
216 - role:log("gm_action", {desc = "fbc", int1 = carbonId, key1 = pms.sender})  
217 194
218 return "成功" 195 return "成功"
219 end 196 end
@@ -247,8 +224,6 @@ function _M.exp(role, pms) @@ -247,8 +224,6 @@ function _M.exp(role, pms)
247 exp = math.floor(math.max(exp, 0)) 224 exp = math.floor(math.max(exp, 0))
248 role:addPlayExp(exp, {log = {desc = "gm"}}) 225 role:addPlayExp(exp, {log = {desc = "gm"}})
249 226
250 - role:log("gm_action", {desc = "exp", int1 = exp, key1 = pms.sender})  
251 -  
252 return "成功" 227 return "成功"
253 end 228 end
254 229
@@ -305,7 +280,6 @@ function _M.get(role, pms) @@ -305,7 +280,6 @@ function _M.get(role, pms)
305 end 280 end
306 local count = tonum(pms.pm2, 1) 281 local count = tonum(pms.pm2, 1)
307 role:award({[itemId] = count}, {log = {desc = "gm"}}) 282 role:award({[itemId] = count}, {log = {desc = "gm"}})
308 - role:log("gm_action", {desc = "get", int1 = itemId, int2 = count, key1 = pms.sender})  
309 end 283 end
310 return "成功" 284 return "成功"
311 end 285 end
@@ -329,9 +303,6 @@ function _M.advc(role, pms) @@ -329,9 +303,6 @@ function _M.advc(role, pms)
329 advAFWear = {}, 303 advAFWear = {},
330 }, notNotify) 304 }, notNotify)
331 role.advData = nil 305 role.advData = nil
332 -  
333 - role:log("gm_action", {desc = "advc", key1 = pms.sender})  
334 -  
335 return "成功" 306 return "成功"
336 end 307 end
337 308
@@ -340,8 +311,6 @@ function _M.advf(role, pms) @@ -340,8 +311,6 @@ function _M.advf(role, pms)
340 role:updateProperty({field = "advC", value = 0}) 311 role:updateProperty({field = "advC", value = 0})
341 role.dailyData:updateProperty({field = "advElC", value = 0}) 312 role.dailyData:updateProperty({field = "advElC", value = 0})
342 313
343 - role:log("gm_action", {desc = "advf", key1 = pms.sender})  
344 -  
345 return "成功" 314 return "成功"
346 end 315 end
347 316
@@ -361,7 +330,6 @@ function _M.adv(role, pms) @@ -361,7 +330,6 @@ function _M.adv(role, pms)
361 advPass[chapterId] = layer 330 advPass[chapterId] = layer
362 role:updateProperty({field = "advPass", value = advPass}) 331 role:updateProperty({field = "advPass", value = advPass})
363 end 332 end
364 - role:log("gm_action", {desc = "adv", int1 = chapterId, int2 = layer, key1 = pms.sender})  
365 333
366 return "成功" 334 return "成功"
367 end 335 end
@@ -388,7 +356,6 @@ function _M.advt(role, pms) @@ -388,7 +356,6 @@ function _M.advt(role, pms)
388 isEnter = true, 356 isEnter = true,
389 debugMapId = mapId, 357 debugMapId = mapId,
390 }) 358 })
391 - role:log("gm_action", {desc = "advt", int1 = chapterId, int2 = layer, key1 = pms.sender})  
392 return "成功" 359 return "成功"
393 end 360 end
394 361
@@ -397,8 +364,6 @@ function _M.advl(role, pms) @@ -397,8 +364,6 @@ function _M.advl(role, pms)
397 local exp = tonum(pms.pm1) 364 local exp = tonum(pms.pm1)
398 role:addAdvLvExp(math.max(0, exp)) 365 role:addAdvLvExp(math.max(0, exp))
399 366
400 - role:log("gm_action", {desc = "advl", int1 = exp, key1 = pms.sender})  
401 -  
402 return "成功" 367 return "成功"
403 end 368 end
404 369
@@ -412,7 +377,6 @@ function _M.advcl(role, pms) @@ -412,7 +377,6 @@ function _M.advcl(role, pms)
412 end 377 end
413 advData.battle.player:addExp(exp) 378 advData.battle.player:addExp(exp)
414 advData:saveDB() 379 advData:saveDB()
415 - role:log("gm_action", {desc = "advcl", int1 = exp, key1 = pms.sender})  
416 380
417 return "成功" 381 return "成功"
418 end 382 end
@@ -422,7 +386,6 @@ function _M.idlec(role, pms) @@ -422,7 +386,6 @@ function _M.idlec(role, pms)
422 role:updateProperty({field = "hangTeam", value = {}}) 386 role:updateProperty({field = "hangTeam", value = {}})
423 role:updateProperty({field = "hangInfo", value = {}}) 387 role:updateProperty({field = "hangInfo", value = {}})
424 role:updateProperty({field = "hangBag", value = {}}) 388 role:updateProperty({field = "hangBag", value = {}})
425 - role:log("gm_action", {desc = "idlec", key1 = pms.sender})  
426 389
427 role.advData = nil 390 role.advData = nil
428 return "成功" 391 return "成功"
@@ -447,8 +410,6 @@ function _M.advit(role, pms) @@ -447,8 +410,6 @@ function _M.advit(role, pms)
447 local itemId = tonum(pms.pm1) 410 local itemId = tonum(pms.pm1)
448 local count = tonum(pms.pm2) 411 local count = tonum(pms.pm2)
449 reward[itemId] = count 412 reward[itemId] = count
450 -  
451 - role:log("gm_action", {desc = "advit", int1 = itemId, int2 = count, key1 = pms.sender})  
452 end 413 end
453 414
454 415
@@ -464,8 +425,6 @@ function _M.tower(role, pms) @@ -464,8 +425,6 @@ function _M.tower(role, pms)
464 if not csvdb["tower_battleCsv"][level] then return "不存在" end 425 if not csvdb["tower_battleCsv"][level] then return "不存在" end
465 role:updateProperty({field = "towerInfo", value = {c = globalCsv.tower_count_limit, l = level}}) 426 role:updateProperty({field = "towerInfo", value = {c = globalCsv.tower_count_limit, l = level}})
466 427
467 - role:log("gm_action", {desc = "tower", int1 = level, key1 = pms.sender})  
468 -  
469 return "成功" 428 return "成功"
470 end 429 end
471 430
@@ -484,8 +443,6 @@ function _M.email(role, pms) @@ -484,8 +443,6 @@ function _M.email(role, pms)
484 rewardPms = id ~= 0 and reward or nil, 443 rewardPms = id ~= 0 and reward or nil,
485 }) 444 })
486 445
487 - role:log("gm_action", {desc = "email", int1 = id, key1 = pms.sender})  
488 -  
489 return "成功" 446 return "成功"
490 end 447 end
491 448
@@ -503,7 +460,6 @@ function _M.cguide(role, pms) @@ -503,7 +460,6 @@ function _M.cguide(role, pms)
503 role:updateProperty({field = "funcGuide", value = ""}) 460 role:updateProperty({field = "funcGuide", value = ""})
504 end 461 end
505 462
506 - role:log("gm_action", {desc = "cguide", int1 = id, key1 = pms.sender})  
507 return "成功" 463 return "成功"
508 end 464 end
509 465
src/actions/HangAction.lua
@@ -39,9 +39,9 @@ local function checkReward(role) @@ -39,9 +39,9 @@ local function checkReward(role)
39 39
40 local items = role:getProperty("hangBag") 40 local items = role:getProperty("hangBag")
41 coinCount = coinCount + coinDoubleCount 41 coinCount = coinCount + coinDoubleCount
42 - items[ItemId.Gold] = (items[ItemId.Gold] or 0) + coinCount * carbonData.money  
43 - items[ItemId.Exp] = (items[ItemId.Exp] or 0) + coinCount * carbonData.exp  
44 - items[ItemId.PlayerExp] = (items[ItemId.PlayerExp] or 0) + coinCount * carbonData.playerExp 42 + items[ItemId.Gold] = math.floor((items[ItemId.Gold] or 0) + coinCount * carbonData.money)
  43 + items[ItemId.Exp] = math.floor((items[ItemId.Exp] or 0) + coinCount * carbonData.exp)
  44 + items[ItemId.PlayerExp] = math.floor((items[ItemId.PlayerExp] or 0) + coinCount * carbonData.playerExp)
45 45
46 local pool = {} 46 local pool = {}
47 for _, temp in pairs(carbonData.item:toArray()) do 47 for _, temp in pairs(carbonData.item:toArray()) do
@@ -69,7 +69,7 @@ local function checkReward(role) @@ -69,7 +69,7 @@ local function checkReward(role)
69 while #tempPool > 0 do 69 while #tempPool > 0 do
70 local idx = math.randWeight(tempPool, 3) 70 local idx = math.randWeight(tempPool, 3)
71 local cur = clone(pool[idx]) 71 local cur = clone(pool[idx])
72 - if cur[1] ~= 1 then -- 轮空 id 72 + if cur[1] ~= 0 then -- 轮空 id
73 if cur[1] == ItemId.BreakCost and doubleTime > 0 then 73 if cur[1] == ItemId.BreakCost and doubleTime > 0 then
74 cur[2] = cur[2] * 2 74 cur[2] = cur[2] * 2
75 end 75 end
@@ -156,7 +156,16 @@ function _M.startRpc( agent, data ) @@ -156,7 +156,16 @@ function _M.startRpc( agent, data )
156 end 156 end
157 role:updateProperty({field = "hangInfo", value = hangInfo}) 157 role:updateProperty({field = "hangInfo", value = hangInfo})
158 158
159 - role:log("hang_action", {desc = "startHang", int1 = carbonId}) 159 + -- 指定当前引导的步骤
  160 + if carbonId == 10101 then
  161 + role:saveGuide(5,11)
  162 + elseif carbonId == 10102 then
  163 + role:saveGuide(8,2)
  164 + elseif carbonId == 10103 then
  165 + role:saveGuide(9,2)
  166 + elseif carbonId == 10220 then
  167 + role:saveGuide(22,1)
  168 + end
160 169
161 SendPacket(actionCodes.Hang_startRpc, '') 170 SendPacket(actionCodes.Hang_startRpc, '')
162 return true 171 return true
@@ -211,6 +220,7 @@ function _M.endBattleRpc(agent, data) @@ -211,6 +220,7 @@ function _M.endBattleRpc(agent, data)
211 return true 220 return true
212 end 221 end
213 local carbonId = msg.carbonId 222 local carbonId = msg.carbonId
  223 + local isWin = msg.starNum and msg.starNum > 0
214 local carbonData = csvdb["idle_battleCsv"][carbonId] 224 local carbonData = csvdb["idle_battleCsv"][carbonId]
215 if not carbonData then 225 if not carbonData then
216 return 2 226 return 2
@@ -224,8 +234,9 @@ function _M.endBattleRpc(agent, data) @@ -224,8 +234,9 @@ function _M.endBattleRpc(agent, data)
224 if role:checkHangPass(carbonId) then 234 if role:checkHangPass(carbonId) then
225 return 4 235 return 4
226 end 236 end
  237 +
227 local reward, change 238 local reward, change
228 - if msg.starNum and msg.starNum > 0 then --win 239 + if isWin then --win
229 role:hangFinish(carbonId) 240 role:hangFinish(carbonId)
230 if carbonData.main ~= 1 then 241 if carbonData.main ~= 1 then
231 hangInfo.bossTime = nil 242 hangInfo.bossTime = nil
@@ -241,11 +252,35 @@ function _M.endBattleRpc(agent, data) @@ -241,11 +252,35 @@ function _M.endBattleRpc(agent, data)
241 reward, change = role:award(reward, {log = {desc = "hangBattle", int1 = carbonId}}) 252 reward, change = role:award(reward, {log = {desc = "hangBattle", int1 = carbonId}})
242 253
243 role:checkTaskEnter("HangPass", {id = carbonId}) 254 role:checkTaskEnter("HangPass", {id = carbonId})
  255 +
  256 + -- 引导
  257 + if carbonId == 10101 then
  258 + role:finishGuide(5)
  259 + elseif carbonId == 10102 then
  260 + role:finishGuide(8)
  261 + elseif carbonId == 10103 then
  262 + role:finishGuide(9)
  263 + elseif carbonId == 10220 then
  264 + role:finishGuide(22)
  265 + end
  266 + for _, guideData in pairs(csvdb["guide_unlockCsv"]) do
  267 + if guideData.type == 3 and guideData.carbonId == carbonId then
  268 + role:saveGuide(guideData.guideId,1,true)
  269 + break
  270 + end
  271 + end
  272 + end
  273 + if hangInfo.carbonId < carbonId then
  274 + hangInfo.carbonId = carbonId
244 end 275 end
245 role:updateProperty({field = "hangInfo", value = hangInfo}) 276 role:updateProperty({field = "hangInfo", value = hangInfo})
246 277
247 - local team = role:getProperty("pvpTC")  
248 - role:log("hang_action", {desc = "hangBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = carbonId, int2 = role:getProperty("hangTBV"), cint1 = role:getHerosCamp(team.heros)}) 278 + role:checkBattle("hang", {
  279 + id = carbonId,
  280 + isWin = isWin,
  281 + info = msg.info,
  282 + reward = reward,
  283 + })
249 284
250 SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({ 285 SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({
251 starNum = msg.starNum, 286 starNum = msg.starNum,
@@ -312,6 +347,17 @@ function _M.getRewardRpc(agent , data) @@ -312,6 +347,17 @@ function _M.getRewardRpc(agent , data)
312 if reward[ItemId.Gold] then 347 if reward[ItemId.Gold] then
313 role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) 348 role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]})
314 end 349 end
  350 +
  351 + role:log("residence_reward", {
  352 + mission_threadid = math.floor(hangInfo.carbonId / 10000), --大关卡ID
  353 + mission_id = hangInfo.carbonId, --关卡ID
  354 + mission_type = 100, --关卡类型,见关卡类型枚举表
  355 + residence_reward_type = 0, --领取奖励方式,快速(超前领取)记录为1,正常领取记录为0
  356 + residence_time = 0, --挂机或排名时长
  357 + residence_reward = reward, --获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  358 + })
  359 +
  360 +
315 SendPacket(actionCodes.Hang_getRewardRpc, MsgPack.pack({ 361 SendPacket(actionCodes.Hang_getRewardRpc, MsgPack.pack({
316 reward = reward, 362 reward = reward,
317 change = change 363 change = change
@@ -319,65 +365,6 @@ function _M.getRewardRpc(agent , data) @@ -319,65 +365,6 @@ function _M.getRewardRpc(agent , data)
319 return true 365 return true
320 end 366 end
321 367
322 --- function _M.getRewardItemRpc(agent , data)  
323 --- local role = agent.role  
324 --- checkReward(role)  
325 --- local items = role:getProperty("hangBag")  
326 --- if not next(items) then return end  
327 -  
328 --- local notNeed = {[ItemId.Gold] = 1, [ItemId.Exp] = 1, [ItemId.PlayerExp] = 1}  
329 --- local reward = {}  
330 --- for itemId , count in pairs(items) do  
331 --- if not notNeed[itemId] then  
332 --- reward[itemId] = count  
333 --- items[itemId] = nil  
334 --- end  
335 --- end  
336 --- if not next(reward) then return end  
337 --- local reward = role:award(reward)  
338 -  
339 --- local hangInfo = role:getProperty("hangInfo")  
340 --- local nowTime = skynet.timex()  
341 --- hangInfo.endItemTime = nowTime + globalCsv.idle_producetime_max  
342 --- hangInfo.itemTime = nowTime  
343 --- role:updateProperty({field = "hangBag", value = items})  
344 --- role:updateProperty({field = "hangInfo", value = hangInfo})  
345 -  
346 --- SendPacket(actionCodes.Hang_getRewardItemRpc, MsgPack.pack({  
347 --- reward = reward  
348 --- }))  
349 --- return true  
350 --- end  
351 -  
352 --- function _M.getRewardCoinRpc(agent , data)  
353 --- local role = agent.role  
354 --- checkReward(role)  
355 --- local items = role:getProperty("hangBag")  
356 --- if not next(items) then return end  
357 -  
358 --- local need = {[ItemId.Gold] = 1, [ItemId.Exp] = 1, [ItemId.PlayerExp] = 1}  
359 --- local reward = {}  
360 --- for itemId , count in pairs(items) do  
361 --- if need[itemId] then  
362 --- reward[itemId] = count  
363 --- items[itemId] = nil  
364 --- end  
365 --- end  
366 --- local reward = role:award(reward)  
367 -  
368 --- local hangInfo = role:getProperty("hangInfo")  
369 --- local nowTime = skynet.timex()  
370 --- hangInfo.endCoinTime = nowTime + globalCsv.idle_producetime_max  
371 --- hangInfo.coinTime = nowTime  
372 --- role:updateProperty({field = "hangBag", value = items})  
373 --- role:updateProperty({field = "hangInfo", value = hangInfo})  
374 -  
375 --- SendPacket(actionCodes.Hang_getRewardCoinRpc, MsgPack.pack({  
376 --- reward = reward  
377 --- }))  
378 --- return true  
379 --- end  
380 -  
381 function _M.quickRpc(agent , data) 368 function _M.quickRpc(agent , data)
382 local role = agent.role 369 local role = agent.role
383 370
@@ -400,8 +387,9 @@ function _M.quickRpc(agent , data) @@ -400,8 +387,9 @@ function _M.quickRpc(agent , data)
400 387
401 local coinCount = math.floor(time / globalCsv.idle_money_produce_cd) 388 local coinCount = math.floor(time / globalCsv.idle_money_produce_cd)
402 local itemCount = math.floor(time / globalCsv.idle_item_produce_cd) 389 local itemCount = math.floor(time / globalCsv.idle_item_produce_cd)
403 - reward[ItemId.Gold] = (reward[ItemId.Gold] or 0) + coinCount * carbonData.money  
404 - reward[ItemId.Exp] = (reward[ItemId.Exp] or 0) + coinCount * carbonData.exp 390 + reward[ItemId.Gold] = math.floor((reward[ItemId.Gold] or 0) + coinCount * carbonData.money)
  391 + reward[ItemId.Exp] = math.floor((reward[ItemId.Exp] or 0) + coinCount * carbonData.exp)
  392 + reward[ItemId.PlayerExp] = math.floor((reward[ItemId.PlayerExp] or 0) + coinCount * carbonData.playerExp)
405 393
406 local pool = {} 394 local pool = {}
407 for _, temp in pairs(carbonData.item:toArray()) do 395 for _, temp in pairs(carbonData.item:toArray()) do
@@ -412,11 +400,13 @@ function _M.quickRpc(agent , data) @@ -412,11 +400,13 @@ function _M.quickRpc(agent , data)
412 reward[cur[1]] = (reward[cur[1]] or 0) + cur[2] 400 reward[cur[1]] = (reward[cur[1]] or 0) + cur[2]
413 end 401 end
414 402
  403 + local doubleCoef = role.activity:isOpen("DoubleDrop") and 2 or 1
  404 +
415 -- 特权卡获取加速获得额外道具 405 -- 特权卡获取加速获得额外道具
416 local coef = role.storeData:getProduceItemSpeedCoef() 406 local coef = role.storeData:getProduceItemSpeedCoef()
417 if coef > 1 then 407 if coef > 1 then
418 for k, cnt in pairs(reward) do 408 for k, cnt in pairs(reward) do
419 - reward[k] = math.floor(cnt * coef) 409 + reward[k] = math.floor(cnt * coef * doubleCoef)
420 end 410 end
421 end 411 end
422 412
@@ -426,6 +416,15 @@ function _M.quickRpc(agent , data) @@ -426,6 +416,15 @@ function _M.quickRpc(agent , data)
426 role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) 416 role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]})
427 end 417 end
428 role:checkTaskEnter("HangQuick") 418 role:checkTaskEnter("HangQuick")
  419 +
  420 + role:log("residence_reward", {
  421 + mission_threadid = math.floor(hangInfo.carbonId / 10000), --大关卡ID
  422 + mission_id = hangInfo.carbonId, --关卡ID
  423 + mission_type = 100, --关卡类型,见关卡类型枚举表
  424 + residence_reward_type = 1, --领取奖励方式,快速(超前领取)记录为1,正常领取记录为0
  425 + residence_time = time, --挂机或排名时长
  426 + residence_reward = reward, --获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  427 + })
429 SendPacket(actionCodes.Hang_quickRpc, MsgPack.pack({ 428 SendPacket(actionCodes.Hang_quickRpc, MsgPack.pack({
430 reward = reward, 429 reward = reward,
431 change = change 430 change = change
@@ -480,7 +479,7 @@ function _M.buyBonusCountRpc(agent, data) @@ -480,7 +479,7 @@ function _M.buyBonusCountRpc(agent, data)
480 479
481 if not role:checkItemEnough({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}) then return 2 end 480 if not role:checkItemEnough({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}) then return 2 end
482 481
483 - role:costItems({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}, {log = {desc = "buyBonusCount", short1 = btype, int1 = count}}) 482 + role:costItems({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}, {log = {desc = "buyBonusCount", int1 = btype, int2 = count}})
484 bonusC[btype]["b"] = bonusC[btype]["b"] + count 483 bonusC[btype]["b"] = bonusC[btype]["b"] + count
485 bonusC[btype]["c"] = bonusC[btype]["c"] - count 484 bonusC[btype]["c"] = bonusC[btype]["c"] - count
486 485
@@ -551,8 +550,12 @@ function _M.endBonusBattleRpc(agent, data) @@ -551,8 +550,12 @@ function _M.endBonusBattleRpc(agent, data)
551 role:checkTaskEnter("BonusPass", {id = id}) 550 role:checkTaskEnter("BonusPass", {id = id})
552 end 551 end
553 552
554 - role:log("hang_action", {desc = "bonusBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id})  
555 - 553 + role:checkBattle("bonus", {
  554 + id = id,
  555 + isWin = starNum and starNum > 0,
  556 + info = msg.info,
  557 + reward = reward,
  558 + })
556 SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({ 559 SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({
557 starNum = starNum, 560 starNum = starNum,
558 reward = reward, 561 reward = reward,
@@ -573,7 +576,6 @@ function _M.hangGiftRpc(agent, data) @@ -573,7 +576,6 @@ function _M.hangGiftRpc(agent, data)
573 if hangGift[id] then return 2 end 576 if hangGift[id] then return 2 end
574 577
575 local reward, change = role:award(carbonData.item_clear_special, {log = {desc = "hangGift", int1 = id}}) 578 local reward, change = role:award(carbonData.item_clear_special, {log = {desc = "hangGift", int1 = id}})
576 - role:log("hang_action", {desc = "hangGift", int1 = id})  
577 579
578 role:changeUpdates({{type = "hangGift", field = id, value = 1}}) 580 role:changeUpdates({{type = "hangGift", field = id, value = 1}})
579 581
src/actions/HeroAction.lua
@@ -16,6 +16,18 @@ local table_unpack = table.unpack @@ -16,6 +16,18 @@ local table_unpack = table.unpack
16 16
17 local _M = {} 17 local _M = {}
18 18
  19 +local function getChangeAttrJson(oldAttr, newAttr)
  20 + local change = {}
  21 + for k, v in pairs(newAttr) do
  22 + change[k] = v - oldAttr[k]
  23 + change[k] = math.ceil(change[k])
  24 + if change[k] == 0 then
  25 + change[k] = nil
  26 + end
  27 + end
  28 + return change
  29 +end
  30 +
19 function _M.levelUpRpc( agent, data ) 31 function _M.levelUpRpc( agent, data )
20 local role = agent.role 32 local role = agent.role
21 local msg = MsgPack.unpack(data) 33 local msg = MsgPack.unpack(data)
@@ -28,9 +40,23 @@ function _M.levelUpRpc( agent, data ) @@ -28,9 +40,23 @@ function _M.levelUpRpc( agent, data )
28 local cost = {[ItemId.Exp] = curData.exp, [ItemId.Gold] = curData.gold} 40 local cost = {[ItemId.Exp] = curData.exp, [ItemId.Gold] = curData.gold}
29 if not role:checkItemEnough(cost) then return 3 end 41 if not role:checkItemEnough(cost) then return 3 end
30 role:costItems(cost, {log = {desc = "heroLevelUp", int1 = msg.id, int2 = hero:getProperty("type")}}) 42 role:costItems(cost, {log = {desc = "heroLevelUp", int1 = msg.id, int2 = hero:getProperty("type")}})
  43 +
  44 + local oldAttr = hero:getTotalAttrs()
  45 + local oldBattleV = hero:getProperty("battleV")
31 hero:updateProperty({field = "level", delta = 1}) 46 hero:updateProperty({field = "level", delta = 1})
32 47
33 - hero:log({desc = "levelUp", int1 = hero:getProperty("level")}) 48 + role:log("hero_upgrade", {
  49 + hero_id = hero:getProperty("type"), --英雄ID
  50 + hero_upgrade_cost = cost, -- 英雄升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
  51 + hero_upgrade_result = getChangeAttrJson(oldAttr, hero:getTotalAttrs()), -- 英雄升级效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}
  52 + hero_upgrade_type = 0, -- 英雄升级方式,连续升级:1,单击升级:0
  53 + hero_upgrade_score = hero:getProperty("battleV"), -- 英雄升级后评分
  54 + hero_upgrade_scoreget = hero:getProperty("battleV") - oldBattleV, -- 通过英雄升级提升的评分
  55 + })
  56 +
  57 + if hero:getProperty("type") == 103 then
  58 + role:finishGuide(7)
  59 + end
34 60
35 role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")}) 61 role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")})
36 SendPacket(actionCodes.Hero_levelUpRpc, '') 62 SendPacket(actionCodes.Hero_levelUpRpc, '')
@@ -49,9 +75,15 @@ function _M.breakRpc( agent, data ) @@ -49,9 +75,15 @@ function _M.breakRpc( agent, data )
49 local cost = {[ItemId.BreakCost] = curData.cost, [ItemId.Gold] = curData.gold} 75 local cost = {[ItemId.BreakCost] = curData.cost, [ItemId.Gold] = curData.gold}
50 if not role:checkItemEnough(cost) then return 4 end 76 if not role:checkItemEnough(cost) then return 4 end
51 role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}}) 77 role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}})
  78 + local oldAttr = hero:getTotalAttrs()
52 hero:updateProperty({field = "breakL", delta = 1}) 79 hero:updateProperty({field = "breakL", delta = 1})
53 80
54 - hero:log({desc = "break", int1 = hero:getProperty("breakL")}) 81 + role:log("hero_break", {
  82 + hero_id = hero:getProperty("type"), --英雄ID
  83 + hero_break_cost = cost, -- 英雄突破消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
  84 + hero_break_result = getChangeAttrJson(oldAttr, hero:getTotalAttrs()), -- 英雄突破效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}
  85 + hero_break_level = hero:getMaxLevel(), -- 英雄突破后等级上限
  86 + })
55 87
56 SendPacket(actionCodes.Hero_breakRpc, '') 88 SendPacket(actionCodes.Hero_breakRpc, '')
57 return true 89 return true
@@ -74,6 +106,7 @@ function _M.wakeRpc(agent, data) @@ -74,6 +106,7 @@ function _M.wakeRpc(agent, data)
74 106
75 role:costItems(cost, {log = {desc = "heroWake", int1 = msg.id, int2 = hero:getProperty("type")}}) 107 role:costItems(cost, {log = {desc = "heroWake", int1 = msg.id, int2 = hero:getProperty("type")}})
76 108
  109 + local oldAttr = hero:getTotalAttrs()
77 hero:updateProperty({field = "wakeL", delta = 1}) 110 hero:updateProperty({field = "wakeL", delta = 1})
78 111
79 local curLevel = hero:getProperty("wakeL") 112 local curLevel = hero:getProperty("wakeL")
@@ -81,9 +114,14 @@ function _M.wakeRpc(agent, data) @@ -81,9 +114,14 @@ function _M.wakeRpc(agent, data)
81 if curLevel == 4 then -- 解锁cg 114 if curLevel == 4 then -- 解锁cg
82 role:checkTaskEnter("WakeCG", {heroType = typ}) 115 role:checkTaskEnter("WakeCG", {heroType = typ})
83 end 116 end
84 - hero:log({desc = "wake", int1 = hero:getProperty("wakeL")})  
85 117
86 - 118 + role:log("hero_rise", {
  119 + hero_id = typ, --英雄ID
  120 + hero_rise_cost = cost, --英雄觉醒消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
  121 + hero_rise_score = hero:getProperty("battleV"), --英雄觉醒后评分提升
  122 + hero_rise_result = getChangeAttrJson(oldAttr, hero:getTotalAttrs()), --英雄觉醒效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}
  123 + })
  124 +
87 SendPacket(actionCodes.Hero_wakeRpc, '') 125 SendPacket(actionCodes.Hero_wakeRpc, '')
88 return true 126 return true
89 end 127 end
@@ -103,7 +141,10 @@ function _M.talentRpc(agent, data) @@ -103,7 +141,10 @@ function _M.talentRpc(agent, data)
103 local curStage = talent:getv(0, 1) 141 local curStage = talent:getv(0, 1)
104 local curData = csvdb["unit_talentCsv"][curStage] 142 local curData = csvdb["unit_talentCsv"][curStage]
105 if not curData then return 4 end 143 if not curData then return 4 end
  144 + local oldSkillLv = hero:getSkillLevel(1)
  145 +
106 146
  147 + local cost = {}
107 if index == 0 then 148 if index == 0 then
108 --是否进阶 149 --是否进阶
109 local max = true 150 local max = true
@@ -131,7 +172,7 @@ function _M.talentRpc(agent, data) @@ -131,7 +172,7 @@ function _M.talentRpc(agent, data)
131 172
132 if talentData.lvRequire > hero:getProperty("level") then return 6 end 173 if talentData.lvRequire > hero:getProperty("level") then return 6 end
133 174
134 - local cost = talentData.money:toNumMap() 175 + cost = talentData.money:toNumMap()
135 local cost2 = talentData.cost:toNumMap() 176 local cost2 = talentData.cost:toNumMap()
136 for k,v in pairs(cost2) do 177 for k,v in pairs(cost2) do
137 cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][k]] = v 178 cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][k]] = v
@@ -152,7 +193,12 @@ function _M.talentRpc(agent, data) @@ -152,7 +193,12 @@ function _M.talentRpc(agent, data)
152 193
153 hero:updateProperty({field = "talent", value = talent}) 194 hero:updateProperty({field = "talent", value = talent})
154 195
155 - hero:log({desc = "talent", int1 = index, int2 = talent:getv(index, 0)}) 196 + role:log("hero_talent", {
  197 + hero_id = hero:getProperty("type"), --英雄ID
  198 + hero_talent_cost = cost, -- 英雄天赋升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
  199 + hero_talent_levelbef = oldSkillLv, -- 英雄技能升级前等级
  200 + hero_talent_level = hero:getSkillLevel(1), -- 英雄技能升级后等级
  201 + })
156 202
157 SendPacket(actionCodes.Hero_talentRpc, '') 203 SendPacket(actionCodes.Hero_talentRpc, '')
158 return true 204 return true
@@ -252,6 +298,14 @@ function _M.commentHeroRpc(agent, data) @@ -252,6 +298,14 @@ function _M.commentHeroRpc(agent, data)
252 comment.like = 0 298 comment.like = 0
253 result.comment = comment 299 result.comment = comment
254 role.dailyData:setProperty("commentHero", curStutus:setv(heroType, 1)) 300 role.dailyData:setProperty("commentHero", curStutus:setv(heroType, 1))
  301 +
  302 +
  303 + role:log("hero_note", {
  304 + hero_id = heroType, -- 英雄ID
  305 + hero_note_action = 0, -- 英雄评价界面操作,发布评论:0,点赞:1,反对:2
  306 + hero_note_id = commentId, -- 操作的评价ID
  307 + hero_note_text = content, -- 操作的评价内容
  308 + })
255 end 309 end
256 SendPacket(actionCodes.Hero_commentHeroRpc, MsgPack.pack(result)) 310 SendPacket(actionCodes.Hero_commentHeroRpc, MsgPack.pack(result))
257 return true 311 return true
@@ -322,7 +376,7 @@ function _M.likeCommentRpc(agent, data) @@ -322,7 +376,7 @@ function _M.likeCommentRpc(agent, data)
322 local commentIndex = heroType .. ":" .. commentId 376 local commentIndex = heroType .. ":" .. commentId
323 local commentRoleKey = string.format("comment:%d:like", role:getProperty("id")) 377 local commentRoleKey = string.format("comment:%d:like", role:getProperty("id"))
324 local redret = redisproxy:pipelining(function (red) 378 local redret = redisproxy:pipelining(function (red)
325 - red:hexists(commentKey.commentKey, commentId) 379 + red:hget(commentKey.commentKey, commentId)
326 red:lrem(commentRoleKey, 1, commentIndex) 380 red:lrem(commentRoleKey, 1, commentIndex)
327 red:lpush(commentRoleKey, commentIndex) 381 red:lpush(commentRoleKey, commentIndex)
328 red:ltrim(commentRoleKey, 0, 999) 382 red:ltrim(commentRoleKey, 0, 999)
@@ -330,7 +384,8 @@ function _M.likeCommentRpc(agent, data) @@ -330,7 +384,8 @@ function _M.likeCommentRpc(agent, data)
330 if (tonumber(redret[2]) or 0) > 0 then 384 if (tonumber(redret[2]) or 0) > 0 then
331 result.status = 1 385 result.status = 1
332 else 386 else
333 - if redret[1] == 1 then-- 查不到也返回ture 387 + if redret[1] then-- 查不到也返回ture
  388 + local comment = json.decode(redret[1])
334 local redret2 = redisproxy:pipelining(function (red) 389 local redret2 = redisproxy:pipelining(function (red)
335 red:zrevrange(commentKey.commentRankKey, 0, RankLikeNum - 1) --热门 390 red:zrevrange(commentKey.commentRankKey, 0, RankLikeNum - 1) --热门
336 red:zincrby(commentKey.commentRankKey, add, commentId) 391 red:zincrby(commentKey.commentRankKey, add, commentId)
@@ -356,6 +411,13 @@ function _M.likeCommentRpc(agent, data) @@ -356,6 +411,13 @@ function _M.likeCommentRpc(agent, data)
356 red:lrem(commentKey.commentListKey, 0, tempId) 411 red:lrem(commentKey.commentListKey, 0, tempId)
357 end 412 end
358 end) 413 end)
  414 +
  415 + role:log("hero_note", {
  416 + hero_id = heroType, -- 英雄ID
  417 + hero_note_action = add > 0 and 1 or 2, -- 英雄评价界面操作,发布评论:0,点赞:1,反对:2
  418 + hero_note_id = commentId, -- 操作的评价ID
  419 + hero_note_text = comment.content, -- 操作的评价内容
  420 + })
359 end 421 end
360 end 422 end
361 423
@@ -363,108 +425,6 @@ function _M.likeCommentRpc(agent, data) @@ -363,108 +425,6 @@ function _M.likeCommentRpc(agent, data)
363 return true 425 return true
364 end 426 end
365 427
366 --- function _M.loveItemRpc(agent, data)  
367 --- local role = agent.role  
368 --- local msg = MsgPack.unpack(data)  
369 --- local hero = role.heros[msg.heroId]  
370 --- if not hero then  
371 --- return  
372 --- end  
373 --- local curL = hero:getProperty("loveL")  
374 --- local curExp = hero:getProperty("loveExp")  
375 --- local curType = hero:getProperty("type")  
376 --- local curPlus = csvdb["unit_love_plusCsv"][curType]  
377 --- if not curPlus then  
378 --- return  
379 --- end  
380 --- if curL >= curPlus.limit then  
381 --- SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 1})) --已满级  
382 --- return true  
383 --- end  
384 --- local curEffect = csvdb["unit_love_effectCsv"][curL]  
385 --- if not curEffect then  
386 --- return  
387 --- end  
388 --- if curExp >= curEffect.loveValue and not msg.bBreak then  
389 --- SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 2})) --当前等级经验已满  
390 --- return true  
391 --- end  
392 -  
393 --- if msg.bBreak then  
394 --- local cost = curEffect.cost:toArray(true, "=")  
395 --- if not role:checkItemEnough({[cost[1]] = cost[2]}) then  
396 --- SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 3, itemId = cost[1]})) --物品不足  
397 --- return true  
398 --- end  
399 --- role:costItems({[cost[1]] = cost[2]})  
400 --- local newLevel = curL + 1  
401 --- hero:updateProperty({field = "loveL", value = newLevel})  
402 --- hero:updateProperty({field = "loveExp", value = 0})  
403 -  
404 --- if role:getProperty("loveStatus"):getv(curType, 0) < newLevel then  
405 --- role:changeUpdates({{type = "loveStatus", field = curType, value = newLevel}}) -- 总的  
406 --- end  
407 -  
408 --- role:checkTaskEnter("LoveBreak", {heroType = curType, loveL = newLevel})  
409 -  
410 --- else  
411 --- local delta = globalCsv.unit_love_presentValue[msg.itemId]  
412 --- if not delta then  
413 --- return  
414 --- end  
415 --- if not role:checkItemEnough({[msg.itemId] = 1}) then  
416 --- SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 3, itemId = msg.itemId}))  
417 --- return true  
418 --- end  
419 --- local newExp = curExp + delta  
420 --- if newExp > curEffect.loveValue then  
421 --- newExp = curEffect.loveValue  
422 --- end  
423 --- role:costItems({[msg.itemId] = 1})  
424 --- hero:updateProperty({field = "loveExp", value = newExp})  
425 --- end  
426 --- SendPacket(actionCodes.Hero_loveItemRpc, "")  
427 --- return true  
428 --- end  
429 -  
430 --- function _M.loveTaskRpc(agent, data)  
431 --- local role = agent.role  
432 --- local msg = MsgPack.unpack(data)  
433 --- local hero = role.heros[msg.id]  
434 --- if not hero then return end  
435 -  
436 --- local curL = hero:getProperty("loveL")  
437 --- local curExp = hero:getProperty("loveExp")  
438 --- local curType = hero:getProperty("type")  
439 --- local curPlus = csvdb["unit_love_plusCsv"][curType]  
440 --- if not curPlus or curL >= curPlus.limit then return end  
441 -  
442 --- local curEffect = csvdb["unit_love_effectCsv"][curL]  
443 --- if not curEffect or curExp < curEffect.loveValue then return end  
444 -  
445 --- local lastEffect = csvdb["unit_love_effectCsv"][curL + 1]  
446 --- local newExp = curExp - curEffect.loveValue  
447 --- if lastEffect and curL + 1 < curPlus.limit then  
448 --- if newExp >= lastEffect.loveValue then  
449 --- -- todo 发任务  
450 --- end  
451 --- else  
452 --- newExp = 0  
453 --- end  
454 --- local newLevel = curL + 1  
455 --- hero:updateProperty({field = "loveExp", value = newExp})  
456 --- hero:updateProperty({field = "loveL", value = newLevel})  
457 -  
458 --- if role:getProperty("loveStatus"):getv(curType, 0) < newLevel then  
459 --- role:changeUpdates({{type = "loveStatus", field = curType, value = newLevel}}) -- 总的  
460 --- end  
461 -  
462 --- role:checkTaskEnter("LoveBreak", {heroType = curType, loveL = newLevel})  
463 -  
464 --- SendPacket(actionCodes.Hero_loveTaskRpc, "")  
465 --- return true  
466 --- end  
467 -  
468 function _M.createHeroRpc(agent, data) 428 function _M.createHeroRpc(agent, data)
469 local role = agent.role 429 local role = agent.role
470 local msg = MsgPack.unpack(data) 430 local msg = MsgPack.unpack(data)
@@ -493,6 +453,7 @@ function _M.referEquipsRpc(agent, data) @@ -493,6 +453,7 @@ function _M.referEquipsRpc(agent, data)
493 local hero = role.heros[msg.id] 453 local hero = role.heros[msg.id]
494 if not hero then return 10 end 454 if not hero then return 10 end
495 local equips = msg.equips 455 local equips = msg.equips
  456 + local isAuto = msg.isAuto
496 if not equips or not next(equips) then return 11 end 457 if not equips or not next(equips) then return 11 end
497 458
498 for typ = 1, 4 do -- 4件装备 459 for typ = 1, 4 do -- 4件装备
@@ -502,6 +463,11 @@ function _M.referEquipsRpc(agent, data) @@ -502,6 +463,11 @@ function _M.referEquipsRpc(agent, data)
502 end 463 end
503 end 464 end
504 end 465 end
  466 +
  467 + local oldAttr = hero:getTotalAttrs()
  468 + local oldBattleV = hero:getProperty("battleV")
  469 + local wear = {}
  470 +
505 local curEquip = hero:getProperty("equip") 471 local curEquip = hero:getProperty("equip")
506 for typ = 1, 4 do -- 4件装备 472 for typ = 1, 4 do -- 4件装备
507 if equips[typ] then 473 if equips[typ] then
@@ -512,17 +478,37 @@ function _M.referEquipsRpc(agent, data) @@ -512,17 +478,37 @@ function _M.referEquipsRpc(agent, data)
512 else 478 else
513 role:addEquip(typ, equips[typ], -1, {log = {desc = "refer"}}) -- 穿上 479 role:addEquip(typ, equips[typ], -1, {log = {desc = "refer"}}) -- 穿上
514 curEquip = curEquip:setv(typ, equips[typ]) 480 curEquip = curEquip:setv(typ, equips[typ])
  481 +
  482 + wear[typ] = {id = equips[typ], act = 0}
515 end 483 end
516 484
517 if cur ~= 0 then 485 if cur ~= 0 then
518 role:addEquip(typ, cur, 1, {log = {desc = "refer"}}) -- 脱掉 486 role:addEquip(typ, cur, 1, {log = {desc = "refer"}}) -- 脱掉
  487 +
  488 + wear[typ] = {id = cur, act = 1}
519 end 489 end
520 end 490 end
521 end 491 end
522 end 492 end
  493 +
523 -- 更新角色 494 -- 更新角色
524 hero:updateProperty({field = "equip", value = curEquip}) 495 hero:updateProperty({field = "equip", value = curEquip})
525 496
  497 + role:finishGuide(23)
  498 +
  499 + local curAttr = hero:getTotalAttrs()
  500 + local attrChange = getChangeAttrJson(oldAttr, curAttr)
  501 + for typ, data in pairs(wear) do
  502 + role:log("equip_wear", {
  503 + hero_id = hero:getProperty("type"), --英雄ID
  504 + equip_id = data.id, --装备ID
  505 + equip_wear_action = data.act, --装备操作类型:装备:0,卸载:1
  506 + equip_wear_part = typ, --装备部位,记录部位ID
  507 + equip_wear_result = curAttr, --装备操作后结果,记录属性变化,json格式记录,{“aa”:1234,"bb":4567}
  508 + equip_wear_change = attrChange, --装备操作变化值,记录属性变化,记录正负值,json格式记录,{“aa”:1234,"bb":-45}
  509 + equip_wear_mode = isAuto and 0 or 1, --用以区分自动装备还是手动装备,自动记录为0,手动记录为1
  510 + })
  511 + end
526 SendPacket(actionCodes.Hero_referEquipsRpc, "") 512 SendPacket(actionCodes.Hero_referEquipsRpc, "")
527 return true 513 return true
528 end 514 end
@@ -559,6 +545,9 @@ function _M.referRunesRpc(agent, data) @@ -559,6 +545,9 @@ function _M.referRunesRpc(agent, data)
559 chero:updateProperty({field = "rune", value = hrunes}) 545 chero:updateProperty({field = "rune", value = hrunes})
560 end 546 end
561 547
  548 + local oldAttr = hero:getTotalAttrs()
  549 + local oldBattleV = hero:getProperty("battleV")
  550 + local wear = {}
562 local curRune = hero:getProperty("rune") 551 local curRune = hero:getProperty("rune")
563 for typ = 1, 6 do 552 for typ = 1, 6 do
564 if runes[typ] then 553 if runes[typ] then
@@ -570,6 +559,7 @@ function _M.referRunesRpc(agent, data) @@ -570,6 +559,7 @@ function _M.referRunesRpc(agent, data)
570 local newRune = role.runeBag[runes[typ]] 559 local newRune = role.runeBag[runes[typ]]
571 newRune:updateProperty({field = "refer",value = hero:getProperty("id")}) 560 newRune:updateProperty({field = "refer",value = hero:getProperty("id")})
572 curRune = curRune:setv(typ, runes[typ]) 561 curRune = curRune:setv(typ, runes[typ])
  562 + wear[runes[typ]] = typ
573 end 563 end
574 564
575 if cur ~= 0 then 565 if cur ~= 0 then
@@ -581,7 +571,22 @@ function _M.referRunesRpc(agent, data) @@ -581,7 +571,22 @@ function _M.referRunesRpc(agent, data)
581 end 571 end
582 end 572 end
583 end 573 end
  574 +
584 hero:updateProperty({field = "rune", value = curRune}) 575 hero:updateProperty({field = "rune", value = curRune})
  576 +
  577 + local attrChange = getChangeAttrJson(oldAttr, hero:getTotalAttrs())
  578 + for runeId, typ in pairs(wear) do
  579 + 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 + })
  588 + end
  589 +
585 SendPacket(actionCodes.Hero_referRunesRpc, "") 590 SendPacket(actionCodes.Hero_referRunesRpc, "")
586 return true 591 return true
587 end 592 end
@@ -666,256 +671,39 @@ function _M.getResetRewardRpc(agent, data) @@ -666,256 +671,39 @@ function _M.getResetRewardRpc(agent, data)
666 end 671 end
667 end 672 end
668 673
669 - hero:updateProperty({field = "level", value = level})  
670 - hero:updateProperty({field = "breakL", value = breakL})  
671 - hero:updateProperty({field = "talent", value = ""})  
672 - hero:log({desc = "resetHero"})  
673 -  
674 - for itemId, count in pairs(reward) do  
675 - reward[itemId] = math.floor(count * globalCsv.unit_back_discount)  
676 - end  
677 - local change  
678 - reward, change = role:award(reward, {log = {desc = "resetHero", int1 = msg.id, int2 = hero:getProperty("type")}})  
679 -  
680 - SendPacket(actionCodes.Hero_getResetRewardRpc, MsgPack.pack(role:packReward(reward, change)))  
681 - return true  
682 -end  
683 -  
684 -function _M.unuse_drawHeroRpc(agent, data)  
685 - local role = agent.role  
686 - local msg = MsgPack.unpack(data)  
687 -  
688 - if not role:isFuncUnlock(FuncUnlock.GetHero) then return end  
689 - local btype = msg.pool -- 1 2 3 4  
690 - local drawType = msg.type -- 1 单抽 2 十连  
691 - local guide = msg.guide -- 是否是引导抽的  
692 -  
693 - local buildTypeData = csvdb["build_typeCsv"][btype]  
694 - if not buildTypeData then return 1 end  
695 -  
696 - local drawCount = {1, 10} -- 抽取次数  
697 - if not drawCount[drawType] then return 2 end  
698 -  
699 - local newerDraw  
700 - if btype == 4 then  
701 - newerDraw = role:getProperty("newerDraw")  
702 - if math.illegalNum(globalCsv.draw_newer[2] - (newerDraw[1] or 0), drawCount[drawType], globalCsv.draw_newer[2]) then return 11 end  
703 - end  
704 -  
705 - local cost = {}  
706 - local lastCount = drawCount[drawType]  
707 - for _, costType in ipairs({"draw_card", "draw_coin"}) do  
708 - if buildTypeData[costType] ~= "" then  
709 - local curCost = buildTypeData[costType]:toArray(true, "=")  
710 - local hadCount = role:getItemCount(curCost[1])  
711 - local curCount = math.floor(hadCount / curCost[2])  
712 - if curCount >= lastCount then  
713 - cost[curCost[1]] = curCost[2] * lastCount  
714 - lastCount = 0  
715 - break  
716 - elseif curCount > 0 then  
717 - cost[curCost[1]] = curCost[2] * curCount  
718 - lastCount = lastCount - curCount  
719 - end  
720 - end 674 + local equip = hero:getProperty("equip")
  675 + for k, v in pairs(equip:toNumMap()) do
  676 + role:addEquip(k, v, 1, {log = {desc = "resetHero", int1 = msg.id, int2 = hero:getProperty("type")}})
721 end 677 end
722 - if lastCount > 0 then -- 钱不够  
723 - return 3  
724 - end  
725 -  
726 - -- pool 固定的  
727 - local poolEnum = {  
728 - [1] = {  
729 - [1] = 1,  
730 - [2] = 2,  
731 - [3] = 3,  
732 - },  
733 - [2] = 10,  
734 - [3] = 11,  
735 - [4] = 12,  
736 - }  
737 678
738 - -- 抽取的池子  
739 - local pool = poolEnum[btype]  
740 - if btype == 1 then  
741 - -- 超级卡池子 每周轮换 有活动覆盖之  
742 - --TODO 活动判断  
743 - if false then  
744 - else  
745 - for idx, poolId in pairs(pool) do  
746 - if role:isTimeResetOpen(TimeReset["DrawType" .. idx]) then  
747 - pool = poolId  
748 - break  
749 - end  
750 - end  
751 - if type(pool) ~= "number" then  
752 - pool = -1  
753 - end 679 + local rune = hero:getProperty("rune")
  680 + for _, id in pairs(rune:toNumMap()) do
  681 + local curRune = role.runeBag[id]
  682 + if curRune then
  683 + curRune:updateProperty({field = "refer", value = 0})
754 end 684 end
755 end 685 end
756 - local unitPool = csvdb["build_unitCsv"][pool]  
757 - if not unitPool then return 4 end  
758 686
759 - -- 开始抽  
760 - local resultPool = {}  
761 - local function fillDrawPool(fixRare, fixCamp, ssrUp, floorBack)  
762 - local condition = {"rare", "camp"}  
763 - local values = {fixRare, fixCamp} 687 + hero:updateProperties({
  688 + level = level,
  689 + breakL = breakL,
  690 + talent = "",
  691 + equip = "",
  692 + rune = "",
  693 + })
764 694
765 - for idx, field in ipairs(condition) do  
766 - if not values[idx] then  
767 - local lpool = {}  
768 - local curIdx = 1  
769 - while unitPool[field .. "_" .. curIdx] do  
770 - lpool[curIdx] = {unitPool[field .. "_" .. curIdx]}  
771 - curIdx = curIdx + 1  
772 - end  
773 -  
774 - -- 稀有度 ssr up  
775 - if field == "rare" then  
776 - local all = 0  
777 - for _, weight in pairs(lpool) do  
778 - all = all + weight[1]  
779 - end  
780 - --[[  
781 - SSR概率值:初始概率 + 步长概率  
782 - SR概率值:初始概率 * [ (初始概率+R初始概率) - 步长概率 ] /(初始概率+R初始概率)  
783 - R概率值:初始概率 * [ (初始概率+SR初始概率) - 步长概率 ] /(初始概率+SR初始概率)  
784 - ]]  
785 - local ssrAdd = (ssrUp or 0) * all  
786 - local last = all - lpool[4][1]  
787 - lpool[4][1] = lpool[4][1] + ssrAdd  
788 - lpool[3][1] = lpool[3][1] * (last - ssrAdd) / last  
789 - lpool[2][1] = lpool[2][1] * (last - ssrAdd) / last  
790 - end  
791 -  
792 - if next(lpool) then  
793 - values[idx] = math.randWeight(lpool, 1)  
794 - end  
795 - end  
796 - end  
797 -  
798 - for itemId, oneData in pairs(floorBack and csvdb["build_floorCsv"] or csvdb["build_poolCsv"]) do  
799 - if oneData["pool_" .. pool] and oneData["pool_" .. pool] ~= "" then  
800 - local itemData = csvdb["itemCsv"][itemId]  
801 - while itemData do  
802 - if itemData.type ~= ItemType.Hero then break end  
803 - local heroData = csvdb["unitCsv"][itemData.id - ItemStartId.Hero]  
804 - if not heroData then break end  
805 - local ok = true  
806 - for idx, field in ipairs(condition) do  
807 - if heroData[field] ~= values[idx] then ok = false break end  
808 - end  
809 - if not ok then break end  
810 - if oneData["pool_" .. pool] > 0 then  
811 - resultPool[itemId] = {oneData["pool_" .. pool]} -- itemId, count, 概率  
812 - end  
813 - break  
814 - end  
815 - end  
816 - end  
817 - end  
818 -  
819 - role:costItems(cost, {log = {desc = "drawHero", short1 = btype, int1 = pool}})  
820 -  
821 - local draw_floor_back_counts = globalCsv.draw_floor_back_counts[btype]  
822 - local draw_ssr_up_count_rate = globalCsv.draw_ssr_up_count_rate[btype]  
823 - local floorHeroCount = role:getProperty("floorHero")[btype] or 0  
824 - local ssrUpCount = role:getProperty("ssrUp")[btype] or 0  
825 -  
826 - local newerDrawCount, newerHadSSR  
827 - if btype == 4 then  
828 - newerDrawCount = newerDraw[1] or 0  
829 - newerHadSSR = newerDraw[2] or 0  
830 - end  
831 -  
832 - local ssrCount = 0  
833 - local reward = {}  
834 - for i = 1, drawCount[drawType] do  
835 - floorHeroCount = floorHeroCount + 1  
836 - if btype == 4 then  
837 - newerDrawCount = newerDrawCount + 1  
838 - end  
839 -  
840 - resultPool = {}  
841 - local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts  
842 - local isNewerSSR = btype == 4 and (newerHadSSR == 0 and newerDrawCount >= globalCsv.draw_newer[1]) or false  
843 -  
844 - local ssrUp = 0  
845 - if draw_ssr_up_count_rate and ssrUpCount > draw_ssr_up_count_rate[1] then  
846 - ssrUp = math.min((ssrUpCount - draw_ssr_up_count_rate[1]) * draw_ssr_up_count_rate[2], draw_ssr_up_count_rate[3]) / 100  
847 - end  
848 - while not next(resultPool) do  
849 - if isNewerSSR then  
850 - fillDrawPool(4) -- 新手保底的 ssr  
851 - elseif isFloorBack then  
852 - -- 保底 sr 【郑斌】明确  
853 - -- 保底 sr 改为 池子随机 sr 或者 ssr【郑斌】  
854 - fillDrawPool(nil, nil, nil, true)  
855 - else  
856 - fillDrawPool(nil, nil, ssrUp)  
857 - end  
858 - end  
859 -  
860 - -- 引导必送 613 丝路德  
861 - local itemId = (guide and drawType == 1) and 613 or math.randWeight(resultPool, 1)  
862 - local itemData = csvdb["itemCsv"][itemId]  
863 - if itemData.quality == 4 then  
864 - ssrCount = ssrCount + 1  
865 - ssrUpCount = 0  
866 - if btype == 4 then  
867 - newerHadSSR = newerHadSSR + 1  
868 - end  
869 - else  
870 - ssrUpCount = ssrUpCount + 1  
871 - end  
872 -  
873 - if itemData.quality >= 3 then  
874 - floorHeroCount = 0  
875 - end  
876 -  
877 - if role:isHaveHero(itemData.id - ItemStartId.Hero) then  
878 - local fragId = itemData.id - ItemStartId.Hero  
879 - local heroData = csvdb["unitCsv"][fragId]  
880 - local count = globalCsv.draw_unit_tofragment[heroData.rare]  
881 - role:award({[fragId] = count}, {log = {desc = "drawHero", short1 = btype, int1 = pool}})  
882 - table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1})  
883 - else  
884 - role:award({[itemId] = 1}, {log = {desc = "drawHero", short1 = btype, int1 = pool}})  
885 - table.insert(reward, {id = itemId, count = 1})  
886 - end  
887 - end  
888 -  
889 - if draw_floor_back_counts then  
890 - local floorHero = role:getProperty("floorHero")  
891 - floorHero[btype] = floorHeroCount  
892 - role:setProperty("floorHero", floorHero)  
893 - end  
894 -  
895 - if draw_ssr_up_count_rate then  
896 - local ssrUp = role:getProperty("ssrUp")  
897 - ssrUp[btype] = ssrUpCount  
898 - role:setProperty("ssrUp", ssrUp)  
899 - end  
900 -  
901 - if btype == 4 then  
902 - newerDraw[1] = newerDrawCount  
903 - newerDraw[2] = newerHadSSR  
904 - role:updateProperty({field = "newerDraw", value = newerDraw}) 695 + for itemId, count in pairs(reward) do
  696 + reward[itemId] = math.floor(count * globalCsv.unit_back_discount)
905 end 697 end
  698 + local change
  699 + reward, change = role:award(reward, {log = {desc = "resetHero", int1 = msg.id, int2 = hero:getProperty("type")}})
906 700
907 - -- if pool == 1 then  
908 - -- local repayHero = role:getProperty("repayHero")  
909 - -- repayHero = math.min(globalCsv.draw_super_repay_count, repayHero + drawCount[drawType])  
910 - -- role:updateProperty({field = "repayHero", value = repayHero})  
911 - -- end  
912 -  
913 - role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]})  
914 - if ssrCount > 0 then  
915 - role:checkTaskEnter("DrawSSR", {count = ssrCount})  
916 - end  
917 - role:log("hero_action", {desc = "drawHero", short1 = btype, int1 = drawCount[drawType], int2 = pool})  
918 - SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 701 + role:log("hero_recycle", {
  702 + hero_recycle_list = {[hero:getProperty("type")] = 1}, -- 回收的英雄id列表,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  703 + hero_recycle_reward = reward, -- 回收后获得的奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  704 + hero_recycle_cnt = 1, -- 总回收英雄量
  705 + })
  706 + SendPacket(actionCodes.Hero_getResetRewardRpc, MsgPack.pack(role:packReward(reward, change)))
919 return true 707 return true
920 end 708 end
921 709
@@ -927,7 +715,6 @@ function _M.drawHeroRpc(agent, data) @@ -927,7 +715,6 @@ function _M.drawHeroRpc(agent, data)
927 local btype = msg.pool -- 1 2 3 卡池类型 715 local btype = msg.pool -- 1 2 3 卡池类型
928 local subType = msg.subType or 1-- 定向卡池需要传 子类型 716 local subType = msg.subType or 1-- 定向卡池需要传 子类型
929 local drawType = msg.type -- 1 单抽 2 十连 717 local drawType = msg.type -- 1 单抽 2 十连
930 - local guide = msg.guide -- 是否是引导抽的  
931 if btype ~= 1 then 718 if btype ~= 1 then
932 subType = 1 719 subType = 1
933 end 720 end
@@ -938,6 +725,9 @@ function _M.drawHeroRpc(agent, data) @@ -938,6 +725,9 @@ function _M.drawHeroRpc(agent, data)
938 local drawCount = {1, 10} -- 抽取次数 725 local drawCount = {1, 10} -- 抽取次数
939 if not drawCount[drawType] then return 2 end 726 if not drawCount[drawType] then return 2 end
940 727
  728 + local draw_floor_back_counts = globalCsv.draw_floor_back_counts[btype]
  729 + local floorHeroCount = role:getProperty("floorHero")[btype] or 0
  730 +
941 -- 计算抽卡消耗品 731 -- 计算抽卡消耗品
942 local cost = {} 732 local cost = {}
943 local lastCount = drawCount[drawType] 733 local lastCount = drawCount[drawType]
@@ -976,16 +766,21 @@ function _M.drawHeroRpc(agent, data) @@ -976,16 +766,21 @@ function _M.drawHeroRpc(agent, data)
976 end 766 end
977 767
978 --TODO 活动覆盖 768 --TODO 活动覆盖
  769 + local actPoolId = role.activity:getActivityPool(btype, subType)
  770 + if actPoolId ~= 0 then
  771 + poolId = actPoolId
  772 + end
979 773
980 local unitPool = csvdb["build_unitCsv"][poolId] 774 local unitPool = csvdb["build_unitCsv"][poolId]
981 if not unitPool then return 4 end 775 if not unitPool then return 4 end
982 776
983 -- 开始抽 777 -- 开始抽
984 local resultPool = {} 778 local resultPool = {}
985 - local function fillDrawPool() 779 + local function fillDrawPool(isFloorBack)
986 local condition = {"rare", "camp"} 780 local condition = {"rare", "camp"}
987 local values = {} 781 local values = {}
988 782
  783 +
989 for idx, field in ipairs(condition) do 784 for idx, field in ipairs(condition) do
990 if not values[idx] then 785 if not values[idx] then
991 local lpool = {} 786 local lpool = {}
@@ -1001,20 +796,24 @@ function _M.drawHeroRpc(agent, data) @@ -1001,20 +796,24 @@ function _M.drawHeroRpc(agent, data)
1001 end 796 end
1002 end 797 end
1003 798
1004 - for itemId, oneData in pairs(csvdb["build_poolCsv"]) do  
1005 - if oneData["pool_" .. poolId] and oneData["pool_" .. poolId] ~= "" then 799 + for itemId, oneData in pairs(isFloorBack and csvdb["build_floorCsv"] or csvdb["build_poolCsv"]) do
  800 + local pool_str = "pool_" .. poolId
  801 + if oneData[pool_str] and oneData[pool_str] ~= "" then
1006 local itemData = csvdb["itemCsv"][itemId] 802 local itemData = csvdb["itemCsv"][itemId]
1007 while itemData do 803 while itemData do
1008 if itemData.type ~= ItemType.Hero then break end 804 if itemData.type ~= ItemType.Hero then break end
1009 local heroData = csvdb["unitCsv"][itemData.id - ItemStartId.Hero] 805 local heroData = csvdb["unitCsv"][itemData.id - ItemStartId.Hero]
1010 if not heroData then break end 806 if not heroData then break end
1011 local ok = true 807 local ok = true
1012 - for idx, field in ipairs(condition) do  
1013 - if heroData[field] ~= values[idx] then ok = false break end 808 + -- 保底是全随机,不用比较类型
  809 + if not isFloorBack then
  810 + for idx, field in ipairs(condition) do
  811 + if heroData[field] ~= values[idx] then ok = false break end
  812 + end
1014 end 813 end
1015 if not ok then break end 814 if not ok then break end
1016 - if oneData["pool_" .. poolId] > 0 then  
1017 - resultPool[itemId] = {oneData["pool_" .. poolId]} -- itemId, count, 概率 815 + if oneData[pool_str] > 0 then
  816 + resultPool[itemId] = {oneData[pool_str]} -- itemId, count, 概率
1018 end 817 end
1019 break 818 break
1020 end 819 end
@@ -1022,35 +821,58 @@ function _M.drawHeroRpc(agent, data) @@ -1022,35 +821,58 @@ function _M.drawHeroRpc(agent, data)
1022 end 821 end
1023 end 822 end
1024 823
1025 - role:costItems(cost, {log = {desc = "drawHero", short1 = btype, int1 = poolId}}) 824 + role:costItems(cost, {log = {desc = "drawHero", int1 = btype, int2 = poolId}})
  825 +
  826 + local guideHero
  827 + if role:getProperty("newerGuide") == "11=1" then
  828 + guideHero = 613
  829 + end
1026 830
1027 local ssrCount = 0 831 local ssrCount = 0
1028 local reward = {} 832 local reward = {}
1029 for i = 1, drawCount[drawType] do 833 for i = 1, drawCount[drawType] do
  834 + floorHeroCount = floorHeroCount + 1
  835 + local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts
1030 resultPool = {} 836 resultPool = {}
1031 - while not next(resultPool) do  
1032 - fillDrawPool() 837 + fillDrawPool(isFloorBack)
  838 + if not next(resultPool) then
  839 + skynet.error("random pool error, poolId:" .. poolId)
  840 + return
  841 + end
  842 +
  843 + local itemId = math.randWeight(resultPool, 1)
  844 + if guideHero then
  845 + itemId = guideHero
  846 + guideHero = nil
1033 end 847 end
1034 848
1035 - -- 引导必送 613 丝路德  
1036 - local itemId = guide and 613 or math.randWeight(resultPool, 1)  
1037 local itemData = csvdb["itemCsv"][itemId] 849 local itemData = csvdb["itemCsv"][itemId]
1038 if itemData.quality == HeroQuality.SSR then 850 if itemData.quality == HeroQuality.SSR then
1039 ssrCount = ssrCount + 1 851 ssrCount = ssrCount + 1
1040 end 852 end
1041 853
  854 + if itemData.quality >= HeroQuality.SR then
  855 + floorHeroCount = 0
  856 + end
  857 +
1042 if role:isHaveHero(itemData.id - ItemStartId.Hero) then 858 if role:isHaveHero(itemData.id - ItemStartId.Hero) then
1043 local fragId = itemData.id - ItemStartId.Hero 859 local fragId = itemData.id - ItemStartId.Hero
1044 local heroData = csvdb["unitCsv"][fragId] 860 local heroData = csvdb["unitCsv"][fragId]
1045 local count = globalCsv.draw_unit_tofragment[heroData.rare] 861 local count = globalCsv.draw_unit_tofragment[heroData.rare]
1046 - role:award({[fragId] = count}, {log = {desc = "drawHero", short1 = btype, int1 = poolId}}) 862 + role:award({[fragId] = count}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}})
1047 table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1}) 863 table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1})
1048 else 864 else
1049 - role:award({[itemId] = 1}, {log = {desc = "drawHero", short1 = btype, int1 = poolId}}) 865 + role:award({[itemId] = 1}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}})
1050 table.insert(reward, {id = itemId, count = 1}) 866 table.insert(reward, {id = itemId, count = 1})
1051 end 867 end
1052 end 868 end
1053 869
  870 + if draw_floor_back_counts then
  871 + local floorHero = role:getProperty("floorHero")
  872 + floorHero[btype] = floorHeroCount
  873 + role:setProperty("floorHero", floorHero)
  874 + end
  875 +
1054 if btype == 1 or btype == 2 then 876 if btype == 1 or btype == 2 then
1055 local repayHero = role:getProperty("repayHero") or 0 877 local repayHero = role:getProperty("repayHero") or 0
1056 repayHero = repayHero + drawCount[drawType] 878 repayHero = repayHero + drawCount[drawType]
@@ -1061,7 +883,16 @@ function _M.drawHeroRpc(agent, data) @@ -1061,7 +883,16 @@ function _M.drawHeroRpc(agent, data)
1061 if ssrCount > 0 then 883 if ssrCount > 0 then
1062 role:checkTaskEnter("DrawSSR", {count = ssrCount}) 884 role:checkTaskEnter("DrawSSR", {count = ssrCount})
1063 end 885 end
1064 - role:log("hero_action", {desc = "drawHero", short1 = btype, int1 = drawCount[drawType], int2 = poolId}) 886 + role:finishGuide(11)
  887 +
  888 + role:log("gacha", {
  889 + gacha_id = poolId, -- 卡池ID
  890 + gacha_type = btype, -- 卡池类型
  891 + gacha_up = 0, -- 卡池UP角色
  892 + gacha_times = drawCount[drawType], -- 抽卡次数
  893 + gacha_reward = reward, -- 抽卡结果,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  894 + currency = cost, -- 购买道具消耗的货币
  895 + })
1065 SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 896 SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组
1066 return true 897 return true
1067 end 898 end
@@ -1091,7 +922,6 @@ function _M.repayHeroRpc(agent, data) @@ -1091,7 +922,6 @@ function _M.repayHeroRpc(agent, data)
1091 role:award({[id] = 1}, {log = {desc = "heroRepay"}}) 922 role:award({[id] = 1}, {log = {desc = "heroRepay"}})
1092 reward = {id = id, count = 1} 923 reward = {id = id, count = 1}
1093 end 924 end
1094 - role:log("hero_action", {desc = "heroRepay", int1=result})  
1095 SendPacket(actionCodes.Hero_repayHeroRpc, MsgPack.pack({reward = reward})) 925 SendPacket(actionCodes.Hero_repayHeroRpc, MsgPack.pack({reward = reward}))
1096 return true 926 return true
1097 end 927 end
@@ -1114,7 +944,7 @@ function _M.unlockPoolRpc(agent, data) @@ -1114,7 +944,7 @@ function _M.unlockPoolRpc(agent, data)
1114 end 944 end
1115 945
1116 if needCost then 946 if needCost then
1117 - if not role:costDiamond({count = globalCsv.draw_unlock_pool_diamond or 300, log = {desc = "unlockPool", short1 = type}}) then 947 + if not role:costDiamond({count = globalCsv.draw_unlock_pool_diamond or 300, log = {desc = "unlockPool", int1 = type}}) then
1118 return 948 return
1119 end 949 end
1120 end 950 end
@@ -1123,9 +953,24 @@ function _M.unlockPoolRpc(agent, data) @@ -1123,9 +953,24 @@ function _M.unlockPoolRpc(agent, data)
1123 role.dailyData:updateProperty({field="unlockPool", value = unlockPool}) 953 role.dailyData:updateProperty({field="unlockPool", value = unlockPool})
1124 role.dailyData:updateProperty({field="curPool", value = type}) 954 role.dailyData:updateProperty({field="curPool", value = type})
1125 955
1126 - role:log("hero_action", {desc = "unlockPool", short1=type}) 956 + --role:log("hero_action", {desc = "unlockPool", int1=type})
1127 SendPacket(actionCodes.Hero_unlockPoolRpc, MsgPack.pack({})) 957 SendPacket(actionCodes.Hero_unlockPoolRpc, MsgPack.pack({}))
1128 return true 958 return true
1129 end 959 end
1130 960
  961 +function _M.changeCrown(agnet, data)
  962 + local role = agent.role
  963 + local msg = MsgPack.unpack(data)
  964 +
  965 + local heroType = msg.heroType
  966 +
  967 + if not role:isHaveHero(heroType) then return true end
  968 + role:setProperty("crown", heroType)
  969 +
  970 + role:log("hero_show", {
  971 + hero_id = heroType,
  972 + })
  973 + return true
  974 +end
  975 +
1131 return _M 976 return _M
1132 \ No newline at end of file 977 \ No newline at end of file
src/actions/PvpAction.lua
@@ -287,7 +287,7 @@ function _M.startBattleRpc(agent, data) @@ -287,7 +287,7 @@ function _M.startBattleRpc(agent, data)
287 if pvpFree >= globalCsv.pvp_battle_free_count then 287 if pvpFree >= globalCsv.pvp_battle_free_count then
288 local cost = {[ItemId.PvpKey] = 1} 288 local cost = {[ItemId.PvpKey] = 1}
289 if not role:checkItemEnough(cost) then return 5 end 289 if not role:checkItemEnough(cost) then return 5 end
290 - role:costItems(cost, {log = {desc = "startPvp", short1 = 1}}) 290 + role:costItems(cost, {log = {desc = "startPvp", int1 = 1}})
291 else 291 else
292 role.dailyData:updateProperty({field = "pvpFree", delta = 1}) 292 role.dailyData:updateProperty({field = "pvpFree", delta = 1})
293 end 293 end
@@ -296,9 +296,6 @@ function _M.startBattleRpc(agent, data) @@ -296,9 +296,6 @@ 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:log("pvp_action", {desc = "startBattle", short1 = 1, int1 = revenge and 1 or 0})  
302 end 299 end
303 300
304 SendPacket(actionCodes.Pvp_startBattleRpc, MsgPack.pack({matchInfo = matchInfo, key = key, result = result, wait = wait})) 301 SendPacket(actionCodes.Pvp_startBattleRpc, MsgPack.pack({matchInfo = matchInfo, key = key, result = result, wait = wait}))
@@ -338,11 +335,6 @@ function _M.endBattleRpc(agent, data) @@ -338,11 +335,6 @@ function _M.endBattleRpc(agent, data)
338 local reward, change = role:award({[temp[1]] = temp[2]}, {log = {desc = "pvpBattleC"}}) 335 local reward, change = role:award({[temp[1]] = temp[2]}, {log = {desc = "pvpBattleC"}})
339 local myScore, matchScore, oldmyScore, oldMatchScore, myRank, oldMyRank = role:changePvpScoreCommon(match.t == 1 and match.id or -1, isWin) 336 local myScore, matchScore, oldmyScore, oldMatchScore, myRank, oldMyRank = role:changePvpScoreCommon(match.t == 1 and match.id or -1, isWin)
340 337
341 - _pvpBattleInfoCacheC = {} --重新发阵容了 没毛病  
342 - _pvpRecordInfoCacheC = {} -- 记录刷新了  
343 - _pvpRecordBattleInfoCacheC = {} -- 取新纪录的时候搞  
344 - _pvpStartBattleCacheC = nil  
345 -  
346 -- 请求上传录像 338 -- 请求上传录像
347 local params = { 339 local params = {
348 ["roleid"] = roleId, 340 ["roleid"] = roleId,
@@ -392,8 +384,21 @@ function _M.endBattleRpc(agent, data) @@ -392,8 +384,21 @@ function _M.endBattleRpc(agent, data)
392 role:checkTaskEnter("PvpWin", {score = myScore}) 384 role:checkTaskEnter("PvpWin", {score = myScore})
393 end 385 end
394 386
395 - role:log("pvp_action", {desc = "battleEnd", short1 = 1, int1 = isWin and 1 or 0, int2 = revenge and 1 or 0}) 387 + role:checkBattle("pvpc", {
  388 + isWin = isWin,
  389 + info = msg.info,
  390 + robotId = match.t == 2 and match.id or nil,
  391 + enemy = match.t == 1 and _pvpBattleInfoCacheC[match.id] or nil,
  392 + score = myScore,
  393 + reward = reward,
  394 + rank = myRank,
  395 + })
396 396
  397 + _pvpBattleInfoCacheC = {} --重新发阵容了 没毛病
  398 + _pvpRecordInfoCacheC = {} -- 记录刷新了
  399 + _pvpRecordBattleInfoCacheC = {} -- 取新纪录的时候搞
  400 + _pvpStartBattleCacheC = nil
  401 +
397 SendPacket(actionCodes.Pvp_endBattleRpc, MsgPack.pack({ 402 SendPacket(actionCodes.Pvp_endBattleRpc, MsgPack.pack({
398 reward = reward, 403 reward = reward,
399 change = change, 404 change = change,
@@ -494,7 +499,7 @@ function _M.startBattleHRpc(agent, data) @@ -494,7 +499,7 @@ function _M.startBattleHRpc(agent, data)
494 if pvpFreeH >= globalCsv.pvp_battle_free_count_high then 499 if pvpFreeH >= globalCsv.pvp_battle_free_count_high then
495 local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost} 500 local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost}
496 if not role:checkItemEnough(cost) then return 5 end 501 if not role:checkItemEnough(cost) then return 5 end
497 - role:costItems(cost, {log = {desc = "startPvp", short1 = 2}}) 502 + role:costItems(cost, {log = {desc = "startPvp", int1 = 2}})
498 else 503 else
499 role.dailyData:updateProperty({field = "pvpFreeH", delta = 1}) 504 role.dailyData:updateProperty({field = "pvpFreeH", delta = 1})
500 end 505 end
@@ -520,8 +525,6 @@ function _M.startBattleHRpc(agent, data) @@ -520,8 +525,6 @@ function _M.startBattleHRpc(agent, data)
520 525
521 role:checkTaskEnter("PvpBattle") 526 role:checkTaskEnter("PvpBattle")
522 527
523 - role:log("pvp_action", {desc = "startBattle", short1 = 2, int1 = revenge and 1 or 0})  
524 -  
525 end 528 end
526 529
527 SendPacket(actionCodes.Pvp_startBattleHRpc, MsgPack.pack({ 530 SendPacket(actionCodes.Pvp_startBattleHRpc, MsgPack.pack({
@@ -683,6 +686,17 @@ function _M.endBattleHRpc(agent, data) @@ -683,6 +686,17 @@ function _M.endBattleHRpc(agent, data)
683 end 686 end
684 end) 687 end)
685 688
  689 + role:checkBattle("pvph", {
  690 + isWin = isWin,
  691 + info = msg.info,
  692 + robotId = match.t == 2 and match.id or nil,
  693 + enemy = match.t == 1 and (revenge and _pvpRecordBattleInfoCacheH[match.id] or _pvpBattleInfoCacheH[match.id]) or nil,
  694 + score = myScore,
  695 + reward = reward,
  696 + rank = myRank,
  697 + })
  698 +
  699 +
686 _pvpBattleInfoCacheH = {} --重新发阵容了 没毛病 700 _pvpBattleInfoCacheH = {} --重新发阵容了 没毛病
687 _pvpRecordInfoCacheH = {} -- 记录刷新了 701 _pvpRecordInfoCacheH = {} -- 记录刷新了
688 _pvpRecordBattleInfoCacheH = {} -- 取新纪录的时候搞 702 _pvpRecordBattleInfoCacheH = {} -- 取新纪录的时候搞
@@ -693,8 +707,7 @@ function _M.endBattleHRpc(agent, data) @@ -693,8 +707,7 @@ function _M.endBattleHRpc(agent, data)
693 if isWin then 707 if isWin then
694 role:checkTaskEnter("PvpWin", {score = myScore}) 708 role:checkTaskEnter("PvpWin", {score = myScore})
695 end 709 end
696 - role:log("pvp_action", {desc = "battleEnd", short1 = 2, int1 = isWin and 1 or 0, int2 = revenge and 1 or 0})  
697 - 710 +
698 SendPacket(actionCodes.Pvp_endBattleHRpc, MsgPack.pack({ 711 SendPacket(actionCodes.Pvp_endBattleHRpc, MsgPack.pack({
699 reward = reward, 712 reward = reward,
700 change = change, 713 change = change,
@@ -842,7 +855,6 @@ function _M.highDivisionGiftRpc(agent, data) @@ -842,7 +855,6 @@ function _M.highDivisionGiftRpc(agent, data)
842 }) 855 })
843 856
844 local reward, change = role:award(newReward, {log = {desc = "pvpDivisionH"}}) 857 local reward, change = role:award(newReward, {log = {desc = "pvpDivisionH"}})
845 - role:log("pvp_action", {desc = "pvpDivisionH"})  
846 858
847 SendPacket(actionCodes.Pvp_highDivisionGiftRpc, MsgPack.pack(role:packReward(reward, change))) 859 SendPacket(actionCodes.Pvp_highDivisionGiftRpc, MsgPack.pack(role:packReward(reward, change)))
848 return true 860 return true
@@ -877,8 +889,6 @@ function _M.shopBuyRpc(agent, data) @@ -877,8 +889,6 @@ function _M.shopBuyRpc(agent, data)
877 end 889 end
878 local reward, change = role:award(gift, {log = {desc = "pvpShop", int1 = id, int2 = count}}) 890 local reward, change = role:award(gift, {log = {desc = "pvpShop", int1 = id, int2 = count}})
879 891
880 - role:log("pvp_action", {desc = "pvpShop", int1 = id, int2 = count})  
881 -  
882 SendPacket(actionCodes.Pvp_shopBuyRpc, MsgPack.pack(role:packReward(reward, change))) 892 SendPacket(actionCodes.Pvp_shopBuyRpc, MsgPack.pack(role:packReward(reward, change)))
883 return true 893 return true
884 end 894 end
@@ -970,7 +980,6 @@ function _M.crossBetRpc(agent, data) @@ -970,7 +980,6 @@ function _M.crossBetRpc(agent, data)
970 local result, code = role:setCrossServerPvpBet(msg.idx) 980 local result, code = role:setCrossServerPvpBet(msg.idx)
971 if not result then return 10 + code end 981 if not result then return 10 + code end
972 982
973 - role:log("pvp_action", {desc = "crossBet"})  
974 SendPacket(actionCodes.Pvp_crossBetRpc, MsgPack.pack(result)) 983 SendPacket(actionCodes.Pvp_crossBetRpc, MsgPack.pack(result))
975 return true 984 return true
976 end 985 end
src/actions/RoleAction.lua
@@ -99,6 +99,29 @@ function _M.loginRpc( agent, data ) @@ -99,6 +99,29 @@ function _M.loginRpc( agent, data )
99 role:reloadWhenLogin() 99 role:reloadWhenLogin()
100 end 100 end
101 101
  102 +
  103 + role.sysVersion = msg.sysVersion
  104 + role.ip = agent.ip:toArray(false, ":")[1]
  105 + role.clientVersion = msg.clientVersion
  106 + role.network = msg.network
  107 +
  108 + if msg.subId then
  109 + role:setProperty("sid", msg.subId)
  110 + end
  111 +
  112 + if msg.deviceMode then
  113 + local deviceMode = tostring(msg.deviceMode)
  114 + if role:getProperty("dmode") ~= deviceMode then
  115 + role:setProperty("dmode", deviceMode)
  116 + end
  117 + end
  118 + if msg.device then
  119 + local device = tostring(msg.device)
  120 + if role:getProperty("device") ~= device then
  121 + role:setProperty("device", device)
  122 + end
  123 + end
  124 +
102 if not msg.isGMlogin then 125 if not msg.isGMlogin then
103 local banTime = role:getProperty("banTime") 126 local banTime = role:getProperty("banTime")
104 if banTime > now then 127 if banTime > now then
@@ -114,6 +137,20 @@ function _M.loginRpc( agent, data ) @@ -114,6 +137,20 @@ function _M.loginRpc( agent, data )
114 role:setBan(0) 137 role:setBan(0)
115 end 138 end
116 end 139 end
  140 +
  141 + if msg.deviceMode then
  142 + local deviceMode = tostring(msg.deviceMode)
  143 + if role:getProperty("dmode") ~= deviceMode then
  144 + role:setProperty("dmode", deviceMode)
  145 + end
  146 + end
  147 + if msg.device then
  148 + local device = tostring(msg.device)
  149 + if role:getProperty("device") ~= device then
  150 + role:setProperty("device", device)
  151 + end
  152 + end
  153 +
117 SERV_OPEN = redisproxy:hget("autoincrement_set", "server_start") 154 SERV_OPEN = redisproxy:hget("autoincrement_set", "server_start")
118 155
119 role:changeStructVersion() -- 数据结构 版本更新 156 role:changeStructVersion() -- 数据结构 版本更新
@@ -253,7 +290,7 @@ function _M.loginRpc( agent, data ) @@ -253,7 +290,7 @@ function _M.loginRpc( agent, data )
253 role:savePvpHTeam() 290 role:savePvpHTeam()
254 291
255 local hangPass = role:getProperty("hangPass") 292 local hangPass = role:getProperty("hangPass")
256 - role:log("login", {key1 = agent.ip:toArray(false, ":")[1], int1 = hangPass[1] or 0}) 293 + role:log("onLogin")
257 294
258 return true 295 return true
259 end 296 end
@@ -271,6 +308,13 @@ function _M.createRpc(agent, data) @@ -271,6 +308,13 @@ function _M.createRpc(agent, data)
271 SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response)) 308 SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response))
272 return true 309 return true
273 end 310 end
  311 + local stopcreate = tonumber(redisproxy:hget("autoincrement_set", "stopcreate"))
  312 + if stopcreate and stopcreate > 0 then
  313 + response.result = "STOP_CREATE"
  314 + SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response))
  315 + return true
  316 + end
  317 +
274 318
275 local roleId = getNextRoleId() 319 local roleId = getNextRoleId()
276 if not roleId then 320 if not roleId then
@@ -286,7 +330,8 @@ function _M.createRpc(agent, data) @@ -286,7 +330,8 @@ function _M.createRpc(agent, data)
286 sid = msg.subId or 0, 330 sid = msg.subId or 0,
287 name = roleName, 331 name = roleName,
288 uname = msg.uname or "", 332 uname = msg.uname or "",
289 - device = tostring(msg.device) 333 + device = tostring(msg.device),
  334 + dmode = msg.deviceMode and tostring(msg.deviceMode) or nil
290 }) 335 })
291 336
292 if newRole:create() then 337 if newRole:create() then
@@ -300,11 +345,20 @@ function _M.createRpc(agent, data) @@ -300,11 +345,20 @@ function _M.createRpc(agent, data)
300 return true 345 return true
301 end 346 end
302 newRole:startActionUcode() 347 newRole:startActionUcode()
  348 + newRole.sysVersion = msg.sysVersion
  349 + newRole.ip = agent.ip:toArray(false, ":")[1]
  350 + newRole.clientVersion = msg.clientVersion
  351 + newRole.network = msg.network
  352 +
303 newRole:award(globalCsv.birthItem, {log = {desc = "birth"}, notNotify = true}) 353 newRole:award(globalCsv.birthItem, {log = {desc = "birth"}, notNotify = true})
304 -- 欢迎邮件 354 -- 欢迎邮件
305 redisproxy:insertEmail({roleId = roleId, emailId = 1}) 355 redisproxy:insertEmail({roleId = roleId, emailId = 1})
306 356
307 - newRole:log("create", {key1 = agent.ip:toArray(false, ":")[1]}) 357 + if msg.newuser then
  358 + newRole:log("onCreateAccount")
  359 + end
  360 + newRole:log("onCreateRole")
  361 +
308 362
309 SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response)) 363 SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response))
310 return true 364 return true
@@ -406,11 +460,21 @@ function _M.saleItemRpc(agent, data) @@ -406,11 +460,21 @@ function _M.saleItemRpc(agent, data)
406 end 460 end
407 local sellEffect = itemData.sell_effect:toArray(true, "=") 461 local sellEffect = itemData.sell_effect:toArray(true, "=")
408 reward[sellEffect[1]] = (reward[sellEffect[1]] or 0) + sellEffect[2] * count 462 reward[sellEffect[1]] = (reward[sellEffect[1]] or 0) + sellEffect[2] * count
  463 +
  464 + role:log("carriage_decals", {
  465 + item_id = itemId, --道具id
  466 + item_type = itemData.type, --道具类型,具体见枚举表中道具类型枚举表
  467 + item_level = 0, --道具等级
  468 + item_number = count, --道具变化数量的绝对值
  469 + carriage_decals_rwdid = sellEffect[1], --拆解获得物资ID
  470 + carriage_decals_rwdnum = sellEffect[2] * count, --拆解获得物资数量
  471 + })
409 end 472 end
410 473
411 role:costItems(backs, {log = {desc = "saleItem"}}) 474 role:costItems(backs, {log = {desc = "saleItem"}})
412 local reward, change = role:award(reward, {log = {desc = "saleItem"}}) 475 local reward, change = role:award(reward, {log = {desc = "saleItem"}})
413 role:checkTaskEnter("DecoFrag", {count = fragCount}) 476 role:checkTaskEnter("DecoFrag", {count = fragCount})
  477 +
414 SendPacket(actionCodes.Role_saleItemRpc, MsgPack.pack(role:packReward(reward, change))) 478 SendPacket(actionCodes.Role_saleItemRpc, MsgPack.pack(role:packReward(reward, change)))
415 return true 479 return true
416 end 480 end
@@ -483,12 +547,14 @@ function _M.openTimeBoxRpc(agent, data) @@ -483,12 +547,14 @@ function _M.openTimeBoxRpc(agent, data)
483 elseif oper == 2 then -- 领取 547 elseif oper == 2 then -- 领取
484 local quick = msg.quick 548 local quick = msg.quick
485 if not boxL[slot] then return end 549 if not boxL[slot] then return end
  550 + local costKey = 0
  551 + local costTime = skynet.timex() - boxL[slot].time
486 if boxL[slot].time > skynet.timex() then -- 没开完 552 if boxL[slot].time > skynet.timex() then -- 没开完
487 if not quick then return end 553 if not quick then return end
488 local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") 554 local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=")
489 - local costD = math.ceil((boxL[slot].time - skynet.timex()) / (cost_pre[1] * 60)) * cost_pre[2]  
490 - if not role:checkItemEnough({[ItemId.BoxKey] = costD}) then return end  
491 - role:costItems({[ItemId.BoxKey] = costD}, {log = {desc = "openTimeBox"}}) 555 + local costKey = math.ceil((boxL[slot].time - skynet.timex()) / (cost_pre[1] * 60)) * cost_pre[2]
  556 + if not role:checkItemEnough({[ItemId.BoxKey] = costKey}) then return end
  557 + role:costItems({[ItemId.BoxKey] = costKey}, {log = {desc = "openTimeBox"}})
492 end 558 end
493 local boxId = boxL[slot].id 559 local boxId = boxL[slot].id
494 local itemData = csvdb["itemCsv"][boxId] 560 local itemData = csvdb["itemCsv"][boxId]
@@ -518,6 +584,17 @@ function _M.openTimeBoxRpc(agent, data) @@ -518,6 +584,17 @@ function _M.openTimeBoxRpc(agent, data)
518 boxL[slot] = nil 584 boxL[slot] = nil
519 reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = boxId}}) 585 reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = boxId}})
520 role:checkTaskEnter("OpenBox", {id = boxId, count=1}) 586 role:checkTaskEnter("OpenBox", {id = boxId, count=1})
  587 +
  588 + role:log("carriage_dismantle", {
  589 + item_id = boxId, -- 道具id
  590 + item_type = itemData.type, -- 道具类型,具体见枚举表中道具类型枚举表
  591 + item_level = 0, -- 道具等级
  592 + item_number = 1, -- 道具变化数量的绝对值
  593 + carriage_dismantle_type = quick and 1 or 0, -- 拆解方式,时间到期:0,钥匙开启:1
  594 + carriage_dismantle_time = costTime, -- 拆解耗时,填写实际耗时
  595 + carriage_dismantle_cost = costKey, -- 拆解花费钥匙数量,未使用填写0
  596 + carriage_dismantle_rwd = reward, -- 拆解获得物资,json格式记录,{'itemid1':2,'itemid2':3,…………..}
  597 + })
521 else 598 else
522 return 599 return
523 end 600 end
@@ -605,6 +682,15 @@ function _M.storyBookRewardRpc(agent, data) @@ -605,6 +682,15 @@ function _M.storyBookRewardRpc(agent, data)
605 storyStatus[storyId].s = -1 682 storyStatus[storyId].s = -1
606 role:changeUpdates({{ type = "storyB", field = storyId, value = storyStatus[storyId] }}) 683 role:changeUpdates({{ type = "storyB", field = storyId, value = storyStatus[storyId] }})
607 local reward, change = role:award(storyBookData.gift, {log = {desc = "storybookReward", int1 = storyId}}) 684 local reward, change = role:award(storyBookData.gift, {log = {desc = "storybookReward", int1 = storyId}})
  685 +
  686 + role:log("carriage_decals", {
  687 + carriage_video_type = storyBookData.type, --放映室类型,剧情CG:0, 角色CG:1, 主线剧情:2, 角色剧情:3, 活动剧情:4, 图鉴:5
  688 + carriage_video_id = storyId, --放映室片段ID
  689 + carriage_video_coinid = reward[ItemId.Gold] and ItemId.Gold or 0, --放映奖励货币类型,无奖励则填写0
  690 + carriage_video_coinnum = reward[ItemId.Gold] or 0, --放映奖励货币数量,无奖励则填写0
  691 + carriage_video_item = reward, --放映奖励其他物品数量,json格式记录,{'itemid1':10,'itemid2':5,…………..},无奖励则填写0
  692 + })
  693 +
608 SendPacket(actionCodes.Role_storyBookRewardRpc, MsgPack.pack(role:packReward(reward, change))) 694 SendPacket(actionCodes.Role_storyBookRewardRpc, MsgPack.pack(role:packReward(reward, change)))
609 return true 695 return true
610 end 696 end
@@ -667,6 +753,12 @@ function _M.taskRpc(agent, data) @@ -667,6 +753,12 @@ function _M.taskRpc(agent, data)
667 local oldVal = role:getProperty("battlePoint") or 0 753 local oldVal = role:getProperty("battlePoint") or 0
668 role:updateProperty({field = "battlePoint", value = oldVal + taskData.active}) 754 role:updateProperty({field = "battlePoint", value = oldVal + taskData.active})
669 755
  756 + role:log("task_reward", {
  757 + task_reward_id = taskId, --任务奖励ID
  758 + task_reward_type = taskType, --任务奖励类型,见 任务奖励类型枚举表
  759 + task_reward_detail = reward, --任务奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  760 + })
  761 +
670 SendPacket(actionCodes.Role_taskRpc, MsgPack.pack(role:packReward(reward, change))) 762 SendPacket(actionCodes.Role_taskRpc, MsgPack.pack(role:packReward(reward, change)))
671 return true 763 return true
672 end 764 end
@@ -756,6 +848,12 @@ function _M.achiveRpc(agent, data) @@ -756,6 +848,12 @@ function _M.achiveRpc(agent, data)
756 end 848 end
757 end 849 end
758 850
  851 + role:log("achievement", {
  852 + achievement_id = taskId, -- 成就id
  853 + achievement_type = achiveTask.type, -- 成就类型,具体枚举表中成就类型枚举表
  854 + achievement_reward = reward, -- 达成成就奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
  855 + })
  856 +
759 SendPacket(actionCodes.Role_achiveRpc, MsgPack.pack(role:packReward(reward, change))) 857 SendPacket(actionCodes.Role_achiveRpc, MsgPack.pack(role:packReward(reward, change)))
760 return true 858 return true
761 end 859 end
@@ -874,6 +972,13 @@ function _M.chatRpc(agent, data) @@ -874,6 +972,13 @@ function _M.chatRpc(agent, data)
874 if not result then 972 if not result then
875 check[cmd]() 973 check[cmd]()
876 end 974 end
  975 +
  976 + role:log("communication", {
  977 + publish_type = cmd, --发言类型,1,世界 2私聊
  978 + publish_status = 0, --发送状态,发送成功:0,发送失败:1,被屏蔽:2,其他:3
  979 + publish_receive_roleid = msg.roleId, --接收者角色ID
  980 + publish_text = content, --发言内容
  981 + })
877 SendPacket(actionCodes.Role_chatRpc, MsgPack.pack({result = result, waitTime = waitTime})) 982 SendPacket(actionCodes.Role_chatRpc, MsgPack.pack({result = result, waitTime = waitTime}))
878 return true 983 return true
879 end 984 end
@@ -902,8 +1007,6 @@ function _M.changeSettingRpc(agent, data) @@ -902,8 +1007,6 @@ function _M.changeSettingRpc(agent, data)
902 setting[id] = status 1007 setting[id] = status
903 role:updateProperty({field = "setting", value = setting}) 1008 role:updateProperty({field = "setting", value = setting})
904 1009
905 - role:log("role_action", {desc = "changeSetting", int1 = id, int2 = status})  
906 -  
907 SendPacket(actionCodes.Role_changeSettingRpc, '') 1010 SendPacket(actionCodes.Role_changeSettingRpc, '')
908 return true 1011 return true
909 end 1012 end
@@ -932,8 +1035,15 @@ function _M.drawCodeRpc(agent, data) @@ -932,8 +1035,15 @@ function _M.drawCodeRpc(agent, data)
932 if ret == 0 then 1035 if ret == 0 then
933 local giftId = tonumber(result.giftId) 1036 local giftId = tonumber(result.giftId)
934 role:setProperty("codeStr", codestr:setv(giftId, 1)) 1037 role:setProperty("codeStr", codestr:setv(giftId, 1))
935 - local reward, change = role:award(result.gift, {log = {desc = "drawCode", key1 = code, int1 = giftId}}) 1038 + local reward, change = role:award(result.gift, {log = {desc = "drawCode", int1 = giftId}})
936 1039
  1040 + role:log("get_gift", {
  1041 + gift_id = giftId, -- 礼包ID
  1042 + gift_key = code, -- 礼包key
  1043 + gift_reward = reward, -- 礼包奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
  1044 + gift_name = "", -- 礼包名称
  1045 + gift_reason = 0, -- 礼包发放原因,见发放原因枚举表
  1046 + })
937 SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({ 1047 SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({
938 result = ret, 1048 result = ret,
939 reward = reward, 1049 reward = reward,
@@ -988,17 +1098,15 @@ function _M.guideRpc(agent, data) @@ -988,17 +1098,15 @@ function _M.guideRpc(agent, data)
988 local cmdType = msg.cmdType 1098 local cmdType = msg.cmdType
989 1099
990 local funcGuide = role:getProperty("funcGuide") 1100 local funcGuide = role:getProperty("funcGuide")
991 - local newerGuide = role:getProperty("newerGuide")  
992 if cmdType == 1 then 1101 if cmdType == 1 then
993 -- 新手引导 1102 -- 新手引导
994 local master = msg.master or -1 1103 local master = msg.master or -1
995 local slave = msg.slave or -1 1104 local slave = msg.slave or -1
996 if master < 0 or slave < 0 then return end 1105 if master < 0 or slave < 0 then return end
997 - newerGuide = string.format("%d=%d",master,slave)  
998 - role:updateProperty({field = "newerGuide", value = newerGuide})  
999 - role:log("guide", {desc = "guide_new",int1 = master*1000+slave}) 1106 +
  1107 + role:saveGuide(master, slave)
1000 elseif cmdType == 2 then 1108 elseif cmdType == 2 then
1001 - -- 系统引导 1109 + -- 系统引导(玩家可选择是否进行)
1002 if not msg.skip then return end 1110 if not msg.skip then return end
1003 local new = math.min(funcGuide:getv(0, 0), msg.skip) 1111 local new = math.min(funcGuide:getv(0, 0), msg.skip)
1004 if new < 0 then 1112 if new < 0 then
@@ -1009,15 +1117,23 @@ function _M.guideRpc(agent, data) @@ -1009,15 +1117,23 @@ function _M.guideRpc(agent, data)
1009 1117
1010 if msg.funcType then 1118 if msg.funcType then
1011 funcGuide = funcGuide:setv(msg.funcType, 1) 1119 funcGuide = funcGuide:setv(msg.funcType, 1)
1012 - role:log("guide", {desc = "guide_sys", int1 = msg.funcType}) 1120 + role:log("onGuidePoint", {guild_type = 2, guild_id = msg.funcType, guild_point = 0, guild_pass = 0})
1013 end 1121 end
1014 role:updateProperty({field = "funcGuide", value = funcGuide}) 1122 role:updateProperty({field = "funcGuide", value = funcGuide})
1015 elseif cmdType == 3 then 1123 elseif cmdType == 3 then
1016 - -- 弱引导 1124 + -- 系统引导(强制进行)
  1125 + if msg.funcType and csvdb["guide_unlockCsv"][msg.funcType] then
  1126 + role:saveGuide(csvdb["guide_unlockCsv"][msg.funcType].guideId,1)
  1127 + funcGuide = funcGuide:setv(msg.funcType, 1)
  1128 + role:updateProperty({field = "funcGuide", value = funcGuide})
  1129 + role:log("onGuidePoint", {guild_type = 1, guild_id = msg.funcType, guild_point = 0, guild_pass = 0})
  1130 + end
  1131 + elseif cmdType == 4 then
  1132 + -- 弹出一个tips(进入功能界面也许要自动弹说明,value要区分1、2)
1017 if msg.funcType then 1133 if msg.funcType then
1018 local value = msg.value or 1 1134 local value = msg.value or 1
1019 for _, funcIdx in pairs(msg.funcType:toArray(true,"=")) do 1135 for _, funcIdx in pairs(msg.funcType:toArray(true,"=")) do
1020 - role:log("guide", {desc = "guide_weak", int1 = funcIdx}) 1136 + role:log("onGuidePoint", {guild_type = 3, guild_id = funcIdx, guild_point = 0, guild_pass = 0})
1021 funcGuide = funcGuide:setv(funcIdx, value) 1137 funcGuide = funcGuide:setv(funcIdx, value)
1022 end 1138 end
1023 role:updateProperty({field = "funcGuide", value = funcGuide}) 1139 role:updateProperty({field = "funcGuide", value = funcGuide})
@@ -1065,4 +1181,17 @@ function _M.goldBuyRpc(agent, data) @@ -1065,4 +1181,17 @@ function _M.goldBuyRpc(agent, data)
1065 return true 1181 return true
1066 end 1182 end
1067 1183
  1184 +function _M.getDownloadCvRewardRpc(agent, data)
  1185 + local role = agent.role
  1186 + local flag = role:getProperty("downCvR") or 0
  1187 + if flag ~= 0 then
  1188 + return 1
  1189 + end
  1190 + local r = globalCsv.role_download_cv_reward
  1191 + local reward, change = role:award(r, {log = {desc = "downloadCv"}})
  1192 + role:updateProperty({field="downCvR", value=1})
  1193 + SendPacket(actionCodes.Role_getDownloadCvRewardRpc, MsgPack.pack(role:packReward(reward, change)))
  1194 + return true
  1195 +end
  1196 +
1068 return _M 1197 return _M
1069 \ No newline at end of file 1198 \ No newline at end of file
src/actions/StoreAction.lua
@@ -31,6 +31,7 @@ function _M.rechargeRpc(agent , data) @@ -31,6 +31,7 @@ function _M.rechargeRpc(agent , data)
31 local partnerOrderId = makeOrder(roleId, id) 31 local partnerOrderId = makeOrder(roleId, id)
32 SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({ order = partnerOrderId })) 32 SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({ order = partnerOrderId }))
33 33
  34 +
34 -- 测试的 直接发奖励了 35 -- 测试的 直接发奖励了
35 skynet.timeout(10, function () 36 skynet.timeout(10, function ()
36 role:handlePurchase({ 37 role:handlePurchase({
@@ -84,7 +85,7 @@ function _M.googleRechargeRpc(agent, data) @@ -84,7 +85,7 @@ function _M.googleRechargeRpc(agent, data)
84 money = dataSet.rmb * 100, 85 money = dataSet.rmb * 100,
85 game_money = dataSet.diamond, 86 game_money = dataSet.diamond,
86 product_id = dataSet.productId, 87 product_id = dataSet.productId,
87 - notify_url = "http://l11-ts-pub-all-wasteland.komoejoy.com/pay/google" 88 + notify_url = msg.notifyUrl
88 } 89 }
89 local sign = signPms(need, secret_key) 90 local sign = signPms(need, secret_key)
90 91
@@ -110,7 +111,7 @@ function _M.myCardRechargeRpc(agent, data) @@ -110,7 +111,7 @@ function _M.myCardRechargeRpc(agent, data)
110 out_trade_no = partnerOrderId, 111 out_trade_no = partnerOrderId,
111 money = dataSet.rmb * 100, 112 money = dataSet.rmb * 100,
112 game_money = dataSet.diamond, 113 game_money = dataSet.diamond,
113 - notify_url = "http://l11-ts-pub-all-wasteland.komoejoy.com/pay/mycard" 114 + notify_url = msg.notifyUrl
114 } 115 }
115 local sign = signPms(need, secret_key) 116 local sign = signPms(need, secret_key)
116 117
@@ -137,7 +138,7 @@ function _M.iosRechargeRpc(agent, data) @@ -137,7 +138,7 @@ function _M.iosRechargeRpc(agent, data)
137 money = dataSet.rmb * 100, 138 money = dataSet.rmb * 100,
138 game_money = dataSet.diamond, 139 game_money = dataSet.diamond,
139 product_id = dataSet.iap_product_id, 140 product_id = dataSet.iap_product_id,
140 - notify_url = "http://l11-ts-pub-all-wasteland.komoejoy.com/pay/ios" 141 + notify_url = msg.notifyUrl
141 } 142 }
142 local sign = signPms(need, secret_key) 143 local sign = signPms(need, secret_key)
143 144
@@ -164,6 +165,22 @@ function _M.purchaseOrderResult(agent, data) @@ -164,6 +165,22 @@ function _M.purchaseOrderResult(agent, data)
164 165
165 if msg.status == "success" then 166 if msg.status == "success" then
166 orderObject:setProperty("transactionId", msg.platformOrder or "") 167 orderObject:setProperty("transactionId", msg.platformOrder or "")
  168 + local rechargeId = orderObject:getProperty("rechargeId")
  169 + local dataSet = csvdb["shop_rechargeCsv"][rechargeId]
  170 +
  171 + role:log("setOrder", {
  172 + order_status = 100, -- "订单状态:100 - 开始下单(玩家还未开始付费行为记录)200 - 支付完成并发货(SDK通知可以发货时记录),300 - 订单被取消,1000 - 其他"
  173 + item_id = rechargeId, -- 道具id
  174 + item_type = dataSet.type, -- 购买的道具类型,具体见"onItems"方法中道具类型枚举表
  175 + item_name = dataSet.title, -- 购买的道具名
  176 + item_number = 1, -- 购买的道具数量
  177 + item_level = 1, -- 购买的道具等级
  178 + order_cost = dataSet.rmb * 100, -- 此次消费的现金金额(单位:分),如 51800即未518元,对应客户端SDK传入的'total_fee'
  179 + order_currency = "CNY", -- 货币类型,默认为"CNY"(人民币),遵循ISO 4217规范
  180 + order_type = self.getProperty("rmbC") > 0 and 0 or 1, -- 订单类型,首充记录为1,否则为0
  181 + order_id = msg.platformOrder, -- 本条记录的订单号,对应客户端SDK返回的'bs_trade_no'
  182 + })
  183 +
167 return true 184 return true
168 end 185 end
169 186
@@ -178,82 +195,6 @@ function _M.purchaseOrderResult(agent, data) @@ -178,82 +195,6 @@ function _M.purchaseOrderResult(agent, data)
178 end 195 end
179 196
180 197
181 -function _M.dailyBuyRpc(agent , data)  
182 - local role = agent.role  
183 - local msg = MsgPack.unpack(data)  
184 - local id = msg.id  
185 - local count = msg.count or 1  
186 -  
187 - local dataSet = csvdb["shop_diamondCsv"][id]  
188 - if not dataSet then return 1 end  
189 -  
190 - local dailySDC = role.dailyData:getProperty("dailySDC")  
191 -  
192 - if math.illegalNum(count, 1, (dataSet.limit == 0 and math.huge or dataSet.limit - (dailySDC[id] or 0))) then return 1 end  
193 -  
194 - local cost = dataSet.cost  
195 -  
196 - local dailySDD = role.dailyData:getProperty("dailySDD")  
197 - if dailySDD[id] then -- 折扣  
198 - cost = math.ceil(cost * (1 - dataSet.disount / 100))  
199 - end  
200 -  
201 - if not role:costDiamond({count = cost * count, log = {desc = "dailyShop", int1 = id, int2 = count}}) then  
202 - return 4  
203 - end  
204 -  
205 - if dataSet.limit ~= 0 then  
206 - dailySDC[id] = (dailySDC[id] or 0) + count  
207 - role.dailyData:updateProperty({field = "dailySDC", value = dailySDC})  
208 - end  
209 - local gift = {}  
210 - for itemId, count_ in pairs(dataSet.gift:toNumMap()) do  
211 - gift[itemId] = count_ * count  
212 - end  
213 - local reward = role:award(gift, {log = {desc = "dailyShop", int1 = id, int2 = count}})  
214 - role:checkTaskEnter("ShopAll", {count = count})  
215 -  
216 - role:log("role_action", {desc = "dailyShop", int1 = id, int2 = count})  
217 -  
218 - SendPacket(actionCodes.Store_dailyBuyRpc, MsgPack.pack({reward = reward}))  
219 - return true  
220 -end  
221 -  
222 -  
223 -function _M.dinerBuyRpc(agent , data)  
224 - local role = agent.role  
225 - local msg = MsgPack.unpack(data)  
226 - local id = msg.id  
227 - local count = msg.count or 1  
228 -  
229 - local dataSet = csvdb["shop_dinerCsv"][id]  
230 - if not dataSet then return end  
231 -  
232 - local dinerS = role:getProperty("dinerS")  
233 - if math.illegalNum(count, 1, (dataSet.limit == 0 and math.huge or dataSet.limit - (dinerS[id] or 0))) then return 1 end  
234 -  
235 - local cost = {[ItemId.DinerCoin] = dataSet.cost * count}  
236 - if not role:checkItemEnough(cost) then return end  
237 -  
238 - if dataSet.limit ~= 0 then  
239 - dinerS[id] = (dinerS[id] or 0) + count  
240 - role:updateProperty({field = "dinerS", value = dinerS})  
241 - end  
242 -  
243 - role:costItems(cost, {log = {desc = "dinerShop", int1 = id, int2 = count}})  
244 -  
245 - local gift = {}  
246 - for _id, _count in pairs(dataSet.gift:toNumMap()) do  
247 - gift[_id] = _count * count  
248 - end  
249 - local reward = role:award(gift, {log = {desc = "dinerShop", int1 = id, int2 = count}})  
250 -  
251 - role:log("role_action", {desc = "dinerShop", int1 = id, int2 = count})  
252 -  
253 - SendPacket(actionCodes.Store_dinerBuyRpc, MsgPack.pack({reward = reward}))  
254 - return true  
255 -end  
256 -  
257 function _M.shopBuyRpc(agent , data) 198 function _M.shopBuyRpc(agent , data)
258 local role = agent.role 199 local role = agent.role
259 local msg = MsgPack.unpack(data) 200 local msg = MsgPack.unpack(data)
@@ -263,6 +204,13 @@ function _M.shopBuyRpc(agent , data) @@ -263,6 +204,13 @@ function _M.shopBuyRpc(agent , data)
263 local dataSet = csvdb["shop_normalCsv"][id] 204 local dataSet = csvdb["shop_normalCsv"][id]
264 if not dataSet then return end 205 if not dataSet then return end
265 206
  207 + if dataSet.unlock ~= "" then
  208 + if not role:checkHangPass(tonumber(config.unlock)) then
  209 + skynet.error(string.format("shopBuyRpc,user do not finish hang pass, user_id:%d", role:getProperty("id")))
  210 + return 1
  211 + end
  212 + end
  213 +
266 local buyRecord = role.storeData:getProperty("buyR") 214 local buyRecord = role.storeData:getProperty("buyR")
267 if math.illegalNum(count, 1, (dataSet.limit == 0 and math.huge or dataSet.limit - (buyRecord[id] or 0))) then 215 if math.illegalNum(count, 1, (dataSet.limit == 0 and math.huge or dataSet.limit - (buyRecord[id] or 0))) then
268 skynet.error(string.format("shop buy over limit, user_id:%d, goods_id:%d", role:getProperty("id"), id)) 216 skynet.error(string.format("shop buy over limit, user_id:%d, goods_id:%d", role:getProperty("id"), id))
@@ -301,8 +249,17 @@ function _M.shopBuyRpc(agent , data) @@ -301,8 +249,17 @@ function _M.shopBuyRpc(agent , data)
301 if dataSet.shop == 1 then 249 if dataSet.shop == 1 then
302 role:checkTaskEnter("ShopAll", {count = count}) 250 role:checkTaskEnter("ShopAll", {count = count})
303 end 251 end
304 - role:log("role_action", {desc = desc, int1 = id, int2 = count})  
305 - 252 + local costId, costCount = next(cost)
  253 +
  254 + role:log("shop_purchase", {
  255 + item_id = id, -- 道具id
  256 + item_type = 0, -- 道具类型,具体见枚举表中道具类型枚举表
  257 + item_level = 0, -- 道具等级
  258 + item_cnt = count, -- 购买数量技术
  259 + currency_type = costId or 0, -- 购买道具消耗的货币类型,记录货币ID
  260 + shop_purchase_current = costCount or 0, -- 购买道具消耗的货币数量
  261 + shop_id = dataSet.shop, -- 商店ID
  262 + })
306 SendPacket(actionCodes.Store_shopBuyRpc, MsgPack.pack({reward = reward})) 263 SendPacket(actionCodes.Store_shopBuyRpc, MsgPack.pack({reward = reward}))
307 return true 264 return true
308 end 265 end
src/actions/TowerAction.lua
@@ -76,8 +76,6 @@ function _M.startBattleRpc(agent, data) @@ -76,8 +76,6 @@ function _M.startBattleRpc(agent, data)
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
79 - role:log("tower_action", {desc = "startBattle", int1 = id})  
80 -  
81 SendPacket(actionCodes.Tower_startBattleRpc, '') 79 SendPacket(actionCodes.Tower_startBattleRpc, '')
82 return true 80 return true
83 end 81 end
@@ -116,7 +114,20 @@ function _M.endBattleRpc(agent, data) @@ -116,7 +114,20 @@ function _M.endBattleRpc(agent, data)
116 towerInfo.k = nil 114 towerInfo.k = nil
117 role:updateProperty({field = "towerInfo", value = towerInfo}) 115 role:updateProperty({field = "towerInfo", value = towerInfo})
118 116
119 - role:log("tower_action", {desc = "endBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id}) 117 +
  118 + local rank = redisproxy:ZREVRANK(RANK_TOWER, role:getProperty("id"))
  119 + if not rank then
  120 + rank = -1
  121 + else
  122 + rank = rank + 1
  123 + end
  124 + role:checkBattle("tower", {
  125 + id = id,
  126 + isWin = msg.starNum and msg.starNum > 0,
  127 + info = msg.info,
  128 + reward = reward,
  129 + rank = rank,
  130 + })
120 131
121 SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({reward = reward, change = change})) 132 SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({reward = reward, change = change}))
122 return true 133 return true
@@ -140,7 +151,6 @@ function _M.bugCountRpc(agent, data) @@ -140,7 +151,6 @@ function _M.bugCountRpc(agent, data)
140 towerInfo.c = curCount 151 towerInfo.c = curCount
141 towerInfo.t = nextTime 152 towerInfo.t = nextTime
142 role:updateProperty({field = "towerInfo", value = towerInfo}) 153 role:updateProperty({field = "towerInfo", value = towerInfo})
143 - role:log("tower_action", {desc = "bugCount"})  
144 154
145 SendPacket(actionCodes.Tower_bugCountRpc, '') 155 SendPacket(actionCodes.Tower_bugCountRpc, '')
146 return true 156 return true
@@ -24,17 +24,6 @@ function Adv:ctor(owner) @@ -24,17 +24,6 @@ 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:log(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:log("adv_action", contents)  
36 -end  
37 -  
38 --初始化adv 信息 27 --初始化adv 信息
39 function Adv:initByInfo(advInfo) 28 function Adv:initByInfo(advInfo)
40 if not next(advInfo) then return end --还没有 开始新地图 29 if not next(advInfo) then return end --还没有 开始新地图
@@ -509,18 +498,18 @@ function Adv:awardArtifact(id, params) @@ -509,18 +498,18 @@ function Adv:awardArtifact(id, params)
509 self:checkAchievement(Adv.AchievType.GetMWeapon, 1, id) 498 self:checkAchievement(Adv.AchievType.GetMWeapon, 1, id)
510 499
511 500
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:log("in_artifact", log)  
521 - else  
522 - print("awardArtifact no log ", debug.traceback())  
523 - end 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
524 if not params.isChoose then 513 if not params.isChoose then
525 self:pushBackEvent(AdvBackEventType.Artifact, {id = id}) 514 self:pushBackEvent(AdvBackEventType.Artifact, {id = id})
526 end 515 end
@@ -609,7 +598,6 @@ function Adv:wearArtifact(slot, id) @@ -609,7 +598,6 @@ function Adv:wearArtifact(slot, id)
609 else 598 else
610 id = nil 599 id = nil
611 end 600 end
612 - self:log({desc = "wearArtifact", int1 = id})  
613 601
614 self.owner:changeUpdates({{type = "advAFWear", field = slot, value = id}}) 602 self.owner:changeUpdates({{type = "advAFWear", field = slot, value = id}})
615 return true 603 return true
@@ -668,9 +656,6 @@ function Adv:artifactLevelUp(id, level) @@ -668,9 +656,6 @@ function Adv:artifactLevelUp(id, level)
668 end 656 end
669 if newLv == advAFGet[id] then return end 657 if newLv == advAFGet[id] then return end
670 658
671 - self:log({desc = "artifactLevelUp", int1 = id, int2 = level})  
672 -  
673 -  
674 local status = 0 659 local status = 0
675 if curWear[id] then -- 穿着呢 660 if curWear[id] then -- 穿着呢
676 local oldData = csvdb["adv_artifactCsv"][id][advAFGet[id]] 661 local oldData = csvdb["adv_artifactCsv"][id][advAFGet[id]]
@@ -715,8 +700,6 @@ function Adv:chooseArtifact(index) @@ -715,8 +700,6 @@ function Adv:chooseArtifact(index)
715 if not self.waitArtifact or not self.waitArtifact[index] then return end 700 if not self.waitArtifact or not self.waitArtifact[index] then return end
716 self:award({[self.waitArtifact[index]] = 1}, {log = {desc = "chooseArtifact"}, isChoose = true}) 701 self:award({[self.waitArtifact[index]] = 1}, {log = {desc = "chooseArtifact"}, isChoose = true})
717 702
718 - self:log({desc = "chooseArtifact", int1 = self.waitArtifact[index]})  
719 -  
720 self.waitArtifact = nil 703 self.waitArtifact = nil
721 704
722 -- 支援效果继续选择 705 -- 支援效果继续选择
@@ -809,8 +792,6 @@ function Adv:over(success, rewardRatio, overType) @@ -809,8 +792,6 @@ function Adv:over(success, rewardRatio, overType)
809 end 792 end
810 self:clearAdvUnlockCache() 793 self:clearAdvUnlockCache()
811 794
812 - self:log({desc = "over", short1 = success and 1 or 0, int1 = overType})  
813 -  
814 local chapterId = self.chapterId 795 local chapterId = self.chapterId
815 self:clear() 796 self:clear()
816 self.owner:checkTaskEnter("AdvScore", {score = score}) 797 self.owner:checkTaskEnter("AdvScore", {score = score})
@@ -903,6 +884,9 @@ function Adv:award(gift, params) @@ -903,6 +884,9 @@ function Adv:award(gift, params)
903 884
904 if csvdb["adv_artifactCsv"][itemId] then -- 获得神器 885 if csvdb["adv_artifactCsv"][itemId] then -- 获得神器
905 self:awardArtifact(itemId, params) 886 self:awardArtifact(itemId, params)
  887 + if not self.owner:checkOverGuide(55) then
  888 + self.owner:saveGuide(55,1,true)
  889 + end
906 else 890 else
907 if nums <= 0 then 891 if nums <= 0 then
908 items = items:delk(itemId) 892 items = items:delk(itemId)
@@ -911,23 +895,23 @@ function Adv:award(gift, params) @@ -911,23 +895,23 @@ function Adv:award(gift, params)
911 items = items:setv(itemId, nums) 895 items = items:setv(itemId, nums)
912 end 896 end
913 897
914 - if params.log then  
915 - local log = clone(params.log)  
916 - if log["cint1"] or log["cint2"] or log["cint3"] or log["long1"] then  
917 - print("addAdvItem error log have cint1 or cint2 or cint3 ", debug.traceback())  
918 - end  
919 - log["cint1"] = itemId  
920 - log["cint2"] = math.abs(count)  
921 - log["cint3"] = self.chapterId  
922 - log["long1"] = self.level  
923 - if count >= 0 then  
924 - self.owner:log("in_adv", log)  
925 - else  
926 - self.owner:log("out_adv", log)  
927 - end  
928 - else  
929 - print("addAdvItem no log ", debug.traceback())  
930 - end 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
931 end 915 end
932 end 916 end
933 if items ~= oldItems then 917 if items ~= oldItems then
@@ -1021,7 +1005,6 @@ local function clickOut(self, room, block, params, isExit) @@ -1021,7 +1005,6 @@ local function clickOut(self, room, block, params, isExit)
1021 isRelay = true, 1005 isRelay = true,
1022 }) 1006 })
1023 else 1007 else
1024 - self:log({desc = "pass"})  
1025 self:initByChapter({ 1008 self:initByChapter({
1026 chapterId = self.chapterId, 1009 chapterId = self.chapterId,
1027 level = self.level + 1, 1010 level = self.level + 1,
@@ -1357,6 +1340,10 @@ local function clickDrop(self, room, block, params) @@ -1357,6 +1340,10 @@ local function clickDrop(self, room, block, params)
1357 1340
1358 local reward = self:award({[block.event.item[1]] = block.event.item[2]}, {log = {desc = "clickDrop"}}) 1341 local reward = self:award({[block.event.item[1]] = block.event.item[2]}, {log = {desc = "clickDrop"}})
1359 -- local reward = self:award({[5801] = 1}) 1342 -- local reward = self:award({[5801] = 1})
  1343 + -- 获取绷带的引导
  1344 + if block.event.item[1] == 5020 and not self.owner:checkOverGuide(53,2) then
  1345 + self.owner:saveGuide(53,2)
  1346 + end
1360 block:clear() 1347 block:clear()
1361 self:backReward(reward, {roomId = room.roomId, blockId = block.blockId}) 1348 self:backReward(reward, {roomId = room.roomId, blockId = block.blockId})
1362 return true 1349 return true
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
@@ -567,7 +567,7 @@ createMap = function(self, mapId, isEnter, isNewRelay) @@ -567,7 +567,7 @@ createMap = function(self, mapId, isEnter, isNewRelay)
567 end 567 end
568 --建筑 568 --建筑
569 randomFunc[AdvEventType.Build] = function() 569 randomFunc[AdvEventType.Build] = function()
570 - if self.adv.isRelay and isEnter then return false end 570 + -- if self.adv.isRelay and isEnter then return false end
571 return randomCommon() 571 return randomCommon()
572 end 572 end
573 --陷阱 573 --陷阱
src/adv/AdvPassive.lua
@@ -300,8 +300,8 @@ function Passive:canEffect(effType, effValue) @@ -300,8 +300,8 @@ function Passive:canEffect(effType, effValue)
300 return 300 return
301 end 301 end
302 --禁用被动技 302 --禁用被动技
303 - local count, bc = self.owner:getDisablePassiveCount()  
304 - if bc > 0 and (count == 0 or self.owner:getPassiveIdx(self) <= count) then 303 + local count = self.owner:getDisablePassiveCount()
  304 + if count and (count == 0 or self.owner:getPassiveIdx(self) <= count) then
305 return 305 return
306 end 306 end
307 return true 307 return true
@@ -466,7 +466,8 @@ function Passive:effect8(dropId) @@ -466,7 +466,8 @@ function Passive:effect8(dropId)
466 skynet.error(string.format("CSVDATA Error adv_map_passive %s effect 8 not id %s in event_drop", self.id, dropId)) 466 skynet.error(string.format("CSVDATA Error adv_map_passive %s effect 8 not id %s in event_drop", self.id, dropId))
467 end 467 end
468 local item = dropData["range"]:randWeight(true) 468 local item = dropData["range"]:randWeight(true)
469 - self.owner.battle.adv:award({[item[1]] = item[2]}, {log = {desc = "passive", int1 = self.id}}) 469 + self.owner.battle.adv:backReward(self.owner.battle.adv:award({[item[1]] = item[2]}, {log = {desc = "passive", int1 = self.id}}), {roomId = self.owner.roomId, blockId = self.owner.blockId})
  470 +
470 end 471 end
471 472
472 --9=直接获得item(可在结算触发时使用) 473 --9=直接获得item(可在结算触发时使用)
@@ -480,7 +481,7 @@ function Passive:effect9(itemId, triggerPms, ratio, max) @@ -480,7 +481,7 @@ function Passive:effect9(itemId, triggerPms, ratio, max)
480 return 481 return
481 end 482 end
482 if not cond then return end 483 if not cond then return end
483 - self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio)))}, {log = {desc = "passive", int1 = self.id}}) 484 + self.owner.battle.adv:backReward(self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio)))}, {log = {desc = "passive", int1 = self.id}}), {roomId = self.owner.roomId, blockId = self.owner.blockId})
484 end 485 end
485 486
486 --10=战斗额外掉落次数 487 --10=战斗额外掉落次数
@@ -520,5 +521,17 @@ function Passive:effect13(eventType, triggerPms, eventId, count) @@ -520,5 +521,17 @@ function Passive:effect13(eventType, triggerPms, eventId, count)
520 end 521 end
521 end 522 end
522 523
  524 +--14=给所有场上怪物增加buff 《 限定 怪 id》 除了自己
  525 +function Passive:effect14(value, triggerPms, enemyId)
  526 + local aims = self.owner.battle.player:getTeam(2)
  527 + for k , aim in pairs(aims) do
  528 + if aim ~= self.owner then
  529 + if not enemyId or enemyId == 0 or aim.monsterId == enemyId then
  530 + aim:addBuff(value, self.owner)
  531 + end
  532 + end
  533 + end
  534 +end
  535 +
523 536
524 return Passive 537 return Passive
525 \ No newline at end of file 538 \ No newline at end of file
src/adv/AdvPlayer.lua
@@ -122,14 +122,16 @@ function BaseObject:getPassiveIdx(passive) @@ -122,14 +122,16 @@ function BaseObject:getPassiveIdx(passive)
122 end 122 end
123 123
124 function BaseObject:getDisablePassiveCount() 124 function BaseObject:getDisablePassiveCount()
125 - local count, bc = 0, 0 125 + local count
126 for _, buff in ipairs(self.buffs) do 126 for _, buff in ipairs(self.buffs) do
127 if not buff.isDel and buff:getType() == Buff.DISABLE_BUFF then 127 if not buff.isDel and buff:getType() == Buff.DISABLE_BUFF then
128 - count = count + buff:effect()  
129 - bc = bc + 1 128 + if buff:effect() == 0 then
  129 + return 0
  130 + end
  131 + count = (count or 0) + buff:effect()
130 end 132 end
131 end 133 end
132 - return count, bc 134 + return count
133 end 135 end
134 136
135 function BaseObject:addBuff(buffId, releaser) 137 function BaseObject:addBuff(buffId, releaser)
@@ -208,6 +210,9 @@ function BaseObject:hadBuffById(bId) @@ -208,6 +210,9 @@ function BaseObject:hadBuffById(bId)
208 end 210 end
209 end 211 end
210 212
  213 +function BaseObject:reSetSpMax()
  214 +end
  215 +
211 216
212 -- 通用的buff 效果汇总 -- 0 固定 1百分比 两种分类 217 -- 通用的buff 效果汇总 -- 0 固定 1百分比 两种分类
213 function BaseObject:getCommonBuffEffect(bType, otherCond) 218 function BaseObject:getCommonBuffEffect(bType, otherCond)
src/adv/AdvTask.lua
@@ -365,7 +365,6 @@ function AdvTask.bind(Adv) @@ -365,7 +365,6 @@ function AdvTask.bind(Adv)
365 else 365 else
366 if (status or -1) >= data.value1 then 366 if (status or -1) >= data.value1 then
367 status = -1 367 status = -1
368 - self.owner:log("adv_action", {desc = "finishAchiev", short1 = 1, int1 = self.chapterId, int2 = taskId})  
369 end 368 end
370 if status and status ~= oldStatus then 369 if status and status ~= oldStatus then
371 insertChange(self, self.chapterId, taskId, status) 370 insertChange(self, self.chapterId, taskId, status)
@@ -282,7 +282,7 @@ function CMD.close() @@ -282,7 +282,7 @@ function CMD.close()
282 mcast_util.usub_union() 282 mcast_util.usub_union()
283 local role = agentInfo.role 283 local role = agentInfo.role
284 if not role then return end 284 if not role then return end
285 - role:log("logout", {int1 = skynet.timex()-role:getProperty("ltime")}) 285 + role:log("onLogout", {logtime = skynet.timex()-role:getProperty("ltime")})
286 role:onOfflineEvent() 286 role:onOfflineEvent()
287 end 287 end
288 288
1 -Subproject commit f52151f947b019976eac7ef15ec914bf7d552d64 1 +Subproject commit 2de1748bed665c9220f68eeb23a8ce3d1f810bda
src/models/Activity.lua
@@ -8,6 +8,8 @@ Activity.ActivityType = { @@ -8,6 +8,8 @@ Activity.ActivityType = {
8 DrawHero = 4, --抽卡周 招募 8 DrawHero = 4, --抽卡周 招募
9 AdvDraw = 5, --拾荒抽周 资助 9 AdvDraw = 5, --拾荒抽周 资助
10 OpenBox = 6, --拆解周 时钟箱 10 OpenBox = 6, --拆解周 时钟箱
  11 +
  12 + SsrUpPoolChange = 10, -- 特定英雄活动,切卡池
11 } 13 }
12 14
13 15
@@ -181,13 +183,16 @@ activityFunc[Activity.ActivityType.Sign] = { @@ -181,13 +183,16 @@ activityFunc[Activity.ActivityType.Sign] = {
181 --loop2:累计招募N次 183 --loop2:累计招募N次
182 --loop3:累计资助N次 184 --loop3:累计资助N次
183 --loop4:时钟箱拆解N个 185 --loop4:时钟箱拆解N个
184 -function Activity:checkWeeklyAct(actType, notify, count) 186 +function Activity:checkWeeklyAct(actType, notify, count, pool)
185 local actInfoMap = { 187 local actInfoMap = {
186 [Activity.ActivityType.DrawHero] = {mailId = MailId.ActDrawCardReward, table = "activity_loop2Csv"}, 188 [Activity.ActivityType.DrawHero] = {mailId = MailId.ActDrawCardReward, table = "activity_loop2Csv"},
187 [Activity.ActivityType.AdvDraw] = {mailId = MailId.ActAdvDrawReward, table = "activity_loop3Csv"}, 189 [Activity.ActivityType.AdvDraw] = {mailId = MailId.ActAdvDrawReward, table = "activity_loop3Csv"},
188 [Activity.ActivityType.OpenBox] = {mailId = MailId.ActOpenBoxReward, table = "activity_loop4Csv"}, 190 [Activity.ActivityType.OpenBox] = {mailId = MailId.ActOpenBoxReward, table = "activity_loop4Csv"},
189 [Activity.ActivityType.FoodSell] = {mailId = MailId.ActSellFoodReward, table = "activity_loop1Csv"} 191 [Activity.ActivityType.FoodSell] = {mailId = MailId.ActSellFoodReward, table = "activity_loop1Csv"}
190 } 192 }
  193 + if actType == Activity.ActivityType.DrawHero and pool == DrawCardType.FriendDraw then
  194 + return
  195 + end
191 local info = actInfoMap[actType] 196 local info = actInfoMap[actType]
192 if not info then return end 197 if not info then return end
193 198
@@ -210,6 +215,13 @@ function Activity:checkWeeklyAct(actType, notify, count) @@ -210,6 +215,13 @@ function Activity:checkWeeklyAct(actType, notify, count)
210 end 215 end
211 if not curData[cfg.id] and curData[0] >= cfg.condition1 then 216 if not curData[cfg.id] and curData[0] >= cfg.condition1 then
212 if info.mailId then 217 if info.mailId then
  218 +
  219 + self.owner:log("activity", {
  220 + activity_id = cfg.id, -- 活动ID(或活动指定任务的ID)
  221 + activity_type = actType, -- 活动类型,见活动类型枚举表
  222 + activity_reward = cfg.reward:toNumMap(), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  223 + })
  224 +
213 self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1}) 225 self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1})
214 curData[cfg.id] = 1 226 curData[cfg.id] = 1
215 end 227 end
@@ -234,8 +246,8 @@ end @@ -234,8 +246,8 @@ end
234 246
235 -- 抽卡周 247 -- 抽卡周
236 activityFunc[Activity.ActivityType.DrawHero] = { 248 activityFunc[Activity.ActivityType.DrawHero] = {
237 - ["check"] = function(self, actType, notify, count) -- 检查  
238 - self:checkWeeklyAct(actType, notify, count) 249 + ["check"] = function(self, actType, notify, count, pool) -- 检查
  250 + self:checkWeeklyAct(actType, notify, count, pool)
239 end, 251 end,
240 ["init"] = function(self, actType, isCrossDay, notify) 252 ["init"] = function(self, actType, isCrossDay, notify)
241 local roundData = self:getProperty("round") 253 local roundData = self:getProperty("round")
@@ -281,7 +293,6 @@ activityFunc[Activity.ActivityType.AdvDraw] = { @@ -281,7 +293,6 @@ activityFunc[Activity.ActivityType.AdvDraw] = {
281 -- ["close"] = function(self, actType, notify) 293 -- ["close"] = function(self, actType, notify)
282 -- end, 294 -- end,
283 ["crossDay"] = function(self, actType, notify) 295 ["crossDay"] = function(self, actType, notify)
284 - print("cross day act adv cost")  
285 self.owner:sendMail(MailId.ActAdvDraw) 296 self.owner:sendMail(MailId.ActAdvDraw)
286 end, 297 end,
287 } 298 }
@@ -355,5 +366,23 @@ function Activity:getActHangDoubleTime(lastTs, nowTs) @@ -355,5 +366,23 @@ function Activity:getActHangDoubleTime(lastTs, nowTs)
355 return 0 366 return 0
356 end 367 end
357 368
  369 +-- 获取活动卡池id
  370 +function Activity:getActivityPool(mainType, subType)
  371 + if not self:isOpen(Activity.ActivityType.SsrUpPoolChange) then
  372 + return 0
  373 + end
  374 + local actData = csvdb["activity_ctrlCsv"][Activity.ActivityType.SsrUpPoolChange]
  375 + if not actData then return 0 end
  376 +
  377 + local poolMap = actData.condition2:toMap(true, "=")
  378 + local key = mainType .. "_" .. subType
  379 + for k, v in pairs(poolMap) do
  380 + if k == key then
  381 + return v
  382 + end
  383 + end
  384 + return 0
  385 +end
  386 +
358 387
359 return Activity 388 return Activity
src/models/Diner.lua
@@ -70,12 +70,10 @@ function Diner:refreshDailyData(notify) @@ -70,12 +70,10 @@ function Diner:refreshDailyData(notify)
70 end 70 end
71 end 71 end
72 72
73 - local guide = self.owner:getProperty("newerGuide")  
74 - local master, slave = string.match(guide,"(%d+)=(%d+)")  
75 - if self.owner:getProperty("funcGuide"):getv(51,0) == 0 or tonumber(master) <= 26 then 73 + if self.owner:getProperty("funcGuide"):getv(51,0) == 0 or (not self.owner:checkOverGuide(27) and self.owner:checkOverGuide(25)) then
76 entrust[1] = 1001 74 entrust[1] = 1001
77 entrust[2] = 1 75 entrust[2] = 1
78 - elseif tonumber(master) <= 29 then 76 + elseif not self.owner:checkOverGuide(29,4) and self.owner:checkOverGuide(29) then
79 local temp = entrust[1] 77 local temp = entrust[1]
80 entrust[1] = 1 78 entrust[1] = 1
81 entrust[2] = temp 79 entrust[2] = temp
@@ -306,6 +304,7 @@ function Diner:expediteSell(slot) @@ -306,6 +304,7 @@ function Diner:expediteSell(slot)
306 lastCount = lastCount, 304 lastCount = lastCount,
307 reward = reward, 305 reward = reward,
308 popular = popular, 306 popular = popular,
  307 + deltaTime = deltaTime,
309 } 308 }
310 end 309 end
311 310
src/models/Email.lua
@@ -18,6 +18,23 @@ Email.schema = { @@ -18,6 +18,23 @@ Email.schema = {
18 rewardPms = {"table", {}}, 18 rewardPms = {"table", {}},
19 } 19 }
20 20
  21 +function Email:log(role, action)
  22 + role:log("onMail", {
  23 + mail_action_type = action, -- 操作(1=收,2=领,3=删)
  24 + mail_receivetime = self:getProperty("createtime"), -- 收件时间
  25 + mail_textid = self:getProperty("emailId"), -- 邮件文本ID
  26 + mial_title = self:getProperty("title"), -- 邮件标题参数
  27 + mail_content = json.encode(self:getProperty("contentPms")), -- 邮件内容参数
  28 + mail_attach = self:getProperty("attachments"), -- 邮件附件
  29 + mail_reason = self:getProperty("stitle"), -- 原因
  30 + mail_readstatus = self:getProperty("status") >= 1 and 1 or 0, -- 邮件读取状态
  31 + mail_attachstatus = self:getProperty("status") >= 2 and 1 or 0, -- 邮件附件状态
  32 + mail_timeout = 0, -- 邮件超时时间
  33 + mail_friend_id = 0, -- 收件方账号id
  34 + mail_friend_roleid = 0, -- 收件方角色id
  35 + })
  36 +end
  37 +
21 function Email:data() 38 function Email:data()
22 local emailId = self:getProperty("emailId") 39 local emailId = self:getProperty("emailId")
23 local title = self:getProperty("title") 40 local title = self:getProperty("title")
src/models/Role.lua
@@ -7,6 +7,7 @@ local RoleTask = import(&quot;.RoleTask&quot;) --角色任务 @@ -7,6 +7,7 @@ local RoleTask = import(&quot;.RoleTask&quot;) --角色任务
7 local RoleChangeStruct = import(".RoleChangeStruct") --角色数据额结构更改 7 local RoleChangeStruct = import(".RoleChangeStruct") --角色数据额结构更改
8 local RolePvp = import(".RolePvp") -- pvp 8 local RolePvp = import(".RolePvp") -- pvp
9 local RoleCross = import(".RoleCross") -- 跨服务请求相关 9 local RoleCross = import(".RoleCross") -- 跨服务请求相关
  10 +local RoleBattle = import(".RoleBattle") -- 跨服务请求相关
10 11
11 RoleLog.bind(Role) 12 RoleLog.bind(Role)
12 RolePlugin.bind(Role) 13 RolePlugin.bind(Role)
@@ -15,6 +16,7 @@ RoleTask.bind(Role) @@ -15,6 +16,7 @@ RoleTask.bind(Role)
15 RoleChangeStruct.bind(Role) 16 RoleChangeStruct.bind(Role)
16 RolePvp.bind(Role) 17 RolePvp.bind(Role)
17 RoleCross.bind(Role) 18 RoleCross.bind(Role)
  19 +RoleBattle.bind(Role)
18 20
19 function Role:ctor( properties ) 21 function Role:ctor( properties )
20 Role.super.ctor(self, properties) 22 Role.super.ctor(self, properties)
@@ -38,6 +40,8 @@ Role.schema = { @@ -38,6 +40,8 @@ Role.schema = {
38 headId = {"number", globalCsv.defaultHead}, 40 headId = {"number", globalCsv.defaultHead},
39 sid = {"number", 0}, 41 sid = {"number", 0},
40 device = {"string", ""}, 42 device = {"string", ""},
  43 + dmode = {"string", ""},
  44 + lday = {"number", 0},
41 banTime = {"number", 0}, 45 banTime = {"number", 0},
42 banType = {"number", 0}, 46 banType = {"number", 0},
43 heartWarning = {"number", 0}, 47 heartWarning = {"number", 0},
@@ -159,6 +163,8 @@ Role.schema = { @@ -159,6 +163,8 @@ Role.schema = {
159 redp = {"table", {}}, -- 待消除红点 -- 通常打开对应界面就消除的红点 红点消除的方法 在对应的协议中使用 {tag = pms } 163 redp = {"table", {}}, -- 待消除红点 -- 通常打开对应界面就消除的红点 红点消除的方法 在对应的协议中使用 {tag = pms }
160 164
161 chatline = {"table", {}}, -- 奖励发放 id=时间 165 chatline = {"table", {}}, -- 奖励发放 id=时间
  166 +
  167 + downCvR = {"number", 0}, -- 下载cv扩展包奖励
162 } 168 }
163 169
164 170
@@ -375,6 +381,8 @@ function Role:data() @@ -375,6 +381,8 @@ function Role:data()
375 381
376 redp = self:getProperty("redp"), 382 redp = self:getProperty("redp"),
377 chatline = self:getProperty("chatline"), 383 chatline = self:getProperty("chatline"),
  384 +
  385 + downCvR = self:getProperty("downCvR"), -- 下载cv扩展包奖励
378 } 386 }
379 end 387 end
380 388
src/models/RoleBattle.lua 0 → 100644
@@ -0,0 +1,185 @@ @@ -0,0 +1,185 @@
  1 +local RoleBattle = {}
  2 +
  3 +--[[
  4 + 100 剧情关卡类
  5 + 200 非剧情类普通关卡
  6 + 300 每日任务类、日常本类
  7 + 400 资源获取类关卡
  8 + 500 PVP关卡
  9 + 1000 活动期间限定类关卡
  10 + 2000 其他
  11 +]]
  12 +
  13 +local BattleType = {
  14 + hang = 100,
  15 + tower = 200,
  16 + bonus = 300,
  17 + pvpc = 500,
  18 + pvph = 501,
  19 +}
  20 +
  21 +RoleBattle.bind = function (Role)
  22 +
  23 +
  24 +-- TODO 检查战斗是否作弊
  25 +local function checkBattleCheat()
  26 +
  27 +end
  28 +
  29 +
  30 +
  31 +function Role:checkBattle(battleType, params)
  32 + local clientInfo = params.info or {}
  33 +
  34 + if not BattleType[battleType] then
  35 + print(string.format("NO find battleType: %s", battleType))
  36 + return
  37 + end
  38 +
  39 + local selflist = {}
  40 + local heroscore = 0
  41 + local teamskill = {}
  42 + local enemylist = {}
  43 +
  44 + local fixData = {
  45 + hang = function()
  46 + for slot, hero in pairs(self:getProperty("hangTS")) do
  47 + selflist[slot] = hero.type
  48 + end
  49 + heroscore = self:getProperty("hangTBV")
  50 + for slot , one in pairs(self:getProperty("hangTB").supports) do
  51 + teamskill[one[1]] = one[2]
  52 + end
  53 + local carbonData = csvdb["idle_battleCsv"][params.id]
  54 + local monsterData = csvdb[carbonData.monster:match("/([^/]*)$") .. "Csv"]
  55 + for slot, one in pairs(monsterData[1]) do
  56 + enemylist[#enemylist + 1] = one["unitType"]
  57 + end
  58 + end,
  59 + tower = function()
  60 + local towerF = self:getProperty("towerF")
  61 + for slot, hero in pairs(self:getTeamHerosInfo(towerF.heros)) do
  62 + selflist[slot] = hero.type
  63 + end
  64 + heroscore = self:getTeamBattleValue(towerF.heros)
  65 + for slot , one in pairs(self:getTeamBattleInfo(towerF).supports) do
  66 + teamskill[one[1]] = one[2]
  67 + end
  68 + local carbonData = csvdb["tower_battleCsv"][params.id]
  69 + local monsterData = csvdb[carbonData.monster:match("/([^/]*)$") .. "Csv"]
  70 + for slot, one in pairs(monsterData[1]) do
  71 + enemylist[#enemylist + 1] = one["unitType"]
  72 + end
  73 + end,
  74 + bonus = function()
  75 + local bTeam = self:getProperty("bTeam")
  76 + for slot, hero in pairs(self:getTeamHerosInfo(bTeam.heros)) do
  77 + selflist[slot] = hero.type
  78 + end
  79 + heroscore = self:getTeamBattleValue(bTeam.heros)
  80 + for slot , one in pairs(self:getTeamBattleInfo(bTeam).supports) do
  81 + teamskill[one[1]] = one[2]
  82 + end
  83 + local carbonData = csvdb["tower_battleCsv"][params.id]
  84 + local monsterData = csvdb[carbonData.monster:match("/([^/]*)$") .. "Csv"]
  85 + for slot, one in pairs(monsterData[1]) do
  86 + enemylist[#enemylist + 1] = one["unitType"]
  87 + end
  88 + end,
  89 + pvpc = function()
  90 + for slot, hero in pairs(self:getProperty("pvpTSC")) do
  91 + selflist[slot] = hero.type
  92 + end
  93 + heroscore = self:getProperty("pvpTBVC")
  94 + for slot , one in pairs(self:getProperty("pvpTBC").supports) do
  95 + teamskill[one[1]] = one[2]
  96 + end
  97 + if params.robotId then
  98 + local carbonData = csvdb["pvp_robotCsv"][params.robotId]
  99 + local monsterData = csvdb[carbonData.monster:match("/([^/]*)$") .. "Csv"]
  100 + for slot, one in pairs(monsterData[1]) do
  101 + enemylist[#enemylist + 1] = one["unitType"]
  102 + end
  103 + else
  104 + for slot, one in pairs((params.enemy or {})["heros"] or {}) do
  105 + enemylist[slot] = one["type"]
  106 + end
  107 + end
  108 + end,
  109 + pvph = function()
  110 + for idx, team in pairs(self:getProperty("pvpTSH")) do
  111 + selflist[idx] = selflist[idx] or {}
  112 + for slot, hero in pairs(team) do
  113 + selflist[idx][slot] = hero.type
  114 + end
  115 + end
  116 + for _, one in pairs(self:getProperty("pvpTBVH")) do
  117 + heroscore = heroscore + one
  118 + end
  119 + for idx, team in pairs(self:getProperty("pvpTBH")) do
  120 + for slot , one in pairs(team.supports) do
  121 + teamskill[one[1]] = one[2]
  122 + end
  123 + end
  124 +
  125 + if params.robotId then
  126 + local carbonData = csvdb["pvp_robot_groupCsv"][params.robotId]
  127 + for idx = 1, 3 do
  128 + enemylist[idx] = enemylist[idx] or {}
  129 + local monsterData = csvdb[carbonData["monster" .. idx]:match("/([^/]*)$") .. "Csv"]
  130 + for slot, one in pairs(monsterData[1]) do
  131 + enemylist[idx][#enemylist + 1] = one["unitType"]
  132 + end
  133 + end
  134 + else
  135 + for idx, team in pairs(params.enemy or {}) do
  136 + enemylist[idx] = enemylist[idx] or {}
  137 + for slot, one in pairs(team["heros"] or {}) do
  138 + enemylist[idx][slot] = one["type"]
  139 + end
  140 + end
  141 + end
  142 + end
  143 + }
  144 +
  145 + if fixData[battleType] then
  146 + fixData[battleType]()
  147 + end
  148 +
  149 + -- robotId = match.t == 2 and match.id or nil,
  150 + -- enemy = match.t == 1 and (revenge and _pvpRecordBattleInfoCacheH[match.id] or _pvpBattleInfoCacheH[match.id]) or nil,
  151 + -- score = myScore,
  152 + -- reward = reward,
  153 + self:log("mission", {
  154 + mission_threadid = battleType == "hang" and math.floor((params.id % 100) / 100) or 0, -- 大关卡ID
  155 + mission_id = params.id or 0, -- 关卡ID
  156 + mission_type = BattleType[battleType], -- 关卡类型,见关卡类型枚举表
  157 + mission_herolist = selflist, -- 英雄ID,排序以玩家出战设置为准,PVP多个队伍则记录多个列表。示例:[[1,2,3],[456]]
  158 + mission_heroscore = heroscore, -- 编队总评分
  159 + mission_enemylist = enemylist, -- 地方英雄ID,排序以玩家出战设置为准,PVP多个队伍则记录多个列表。示例:[[1,2,3],[456]]
  160 + mission_damage = clientInfo.damage or {}, -- 英雄输出值。示例:{'heroid1':1000,'heroid2':2000,………..}
  161 + mission_ultskill = clientInfo.ultskill or {}, -- 大招使用情况。示例:{'heroid1':1000,'heroid2':2000,………..}
  162 + mission_reward = params.reward or {}, -- 获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  163 + mission_starttime = clientInfo.start or 0, -- 战斗开始时间,格式 unixtime 秒级
  164 + mission_roundtime = clientInfo.atime or 0, -- 对局时长(秒)
  165 + mission_result = params.isWin and 1 or 2, -- 战斗结果(0-无效,1-胜利,2-失败)
  166 + mission_star = 0, -- 战斗完成星数,无星级的话填写0
  167 + mission_restriction = 0, -- 周期内参与限制(0表示没有上限)
  168 + mission_difficulty = 0, -- 关卡困难度,无难度区分的话填写0
  169 + mission_strength = 1, -- 消耗的体力或次数
  170 + mission_score = params.score or 0, -- 本局分数,PVP玩法记录为对战后积分,无得分的填0
  171 + mission_cleartype = 1, -- 1正常通关;2代理拾荒
  172 + mission_rank = params.rank, -- 对战后排名,适用于PVP玩法和电波塔,其他玩法留空
  173 + misson_monsterkill = clientInfo.kill or {}, -- 击杀怪物ID和数量,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  174 + misson_teamskill = teamskill, -- 编队支援技能和技能等级情况,json格式记录,{"teamskill1":1,"teamskill2":2,………..}
  175 + })
  176 +end
  177 +
  178 +
  179 +
  180 +
  181 +
  182 +end
  183 +
  184 +
  185 +return RoleBattle
0 \ No newline at end of file 186 \ No newline at end of file
src/models/RoleLog.lua
  1 +local server_id = (skynet.getenv("serverType") or "localtest") .. "_" .. skynet.getenv("servId")
1 2
2 --- logType  
3 -local LogType = {  
4 - create = "common",  
5 - login = "common",  
6 - logout = "common",  
7 - guide = "common", 3 +--[[
  4 + 100 购买/兑换行为
  5 + 200 交易行为(与其他玩家)
  6 + 300 通过关卡产出或消耗
  7 + 400 通过任务产出或消耗
  8 + 500 通过公会产出或消耗
  9 + 600 通过成就产出或消耗
  10 + 700 通过邮件产出或消耗
  11 + 1000 其他行为
  12 +--]]
  13 +local ItemReason = {
  14 + recharge = 100,
  15 + advWheelSurf = 101, -- 资助
  16 + advRepayWheelSurf = 102, -- 资助回馈
  17 + saleEquip = 103, -- 卖装备
  18 + saleRune = 104, -- 卖铭文
  19 + drawHero = 105, -- 抽卡
  20 + pvpShop = 106, -- pvp商店
  21 + saleItem = 107, -- 售卖道具
  22 + openItem = 108, -- 打开箱子
  23 + openTimeBox = 109, -- 打开时间箱
  24 + speedUpBox = 110, -- 速度箱
  25 + dailyShop = 111, -- 每日商城
  26 + dinershop = 112, -- 餐厅商店
  27 + goldBuy = 113, -- 购买金币
  28 + buyAdvCount = 114, -- 购买冒险次数
  29 + advReSupport = 115, -- 刷新拾荒支援技
  30 + advQuickHang = 116, -- 冒险快速挂机
  31 + makePotion = 117, -- 制造药剂
  32 + equipUp = 118, -- 装备升级
  33 + runeUp = 119, -- 符文升级
  34 + talentUp = 120, -- 天赋升级
  35 + buyBonusCount = 121, -- 购买奖励副本次数
  36 + bagField = 122, -- 背包栏位
  37 + buyPvpKey = 123, -- 购买pvp钥匙
  38 + startPvp = 124, -- 开始pvp
  39 + unlockStory = 125, -- 解锁剧情
  40 + towerCount = 126, -- 电波塔次数
  41 +
  42 +
  43 + advHang = 301, -- 拾荒挂机
  44 + hangBattle = 302, -- 挂机战斗
  45 + hangReward = 303, -- 挂机奖励
  46 + quickHang = 304, -- 快速挂机
  47 + bonusBattle = 305, -- 奖励副本
  48 + hangGift = 306, -- 奖励关卡奖励
  49 + pvpBattleC = 307, -- pvp战斗普通
  50 + pvpBattleH = 308, -- pvp战斗高级
  51 + pvpDivisionH = 309, -- pvp高级段位奖励
  52 + towerBattle = 310, -- 电波塔战斗
  53 + advOver = 311, -- 冒险结算
  54 + advUnlock = 312, -- 拾荒解锁
8 55
9 - in_item = "common",  
10 - out_item = "common",  
11 - in_diamond = "common",  
12 - out_diamond = "common",  
13 - in_hero = "common",  
14 - out_hero = "common",  
15 - in_equip = "common",  
16 - out_equip = "common",  
17 - in_rune = "common",  
18 - out_rune = "common",  
19 - player_exp = "common",  
20 - func_open = "common",  
21 - in_adv = "common",  
22 - out_adv = "common",  
23 - in_artifact = "common",  
24 -  
25 - mail_action = "common",  
26 - role_action = "common",  
27 - hang_action = "common",  
28 - hero_action = "common",  
29 - adv_action = "common",  
30 - rune_action = "common",  
31 - pvp_action = "common",  
32 - diner_action = "common",  
33 - tower_action = "common",  
34 - gm_action = "common",  
35 - act_action = "common", 56 + dinerFinishTask = 401, -- 餐厅完成任务
  57 + storybookReward = 402, -- 剧情奖励
  58 + finishTask = 403, -- 任务
  59 + taskActive = 404, -- 完成活跃任务
  60 + advMainTask = 405, -- 拾荒主线
  61 +
  62 + finishAchive = 601, -- 完成成就
  63 + advAchiev = 602, -- 拾荒成就
  64 + advAchievReward = 603, -- 拾慌成就奖励
  65 +
  66 + draw_attach = 701, -- 邮件奖励
  67 +
  68 + gm = 1000, -- 获取途径:GM
  69 +
  70 + -- 活动
  71 + sudoku = 1001, -- 九宫格
  72 + sudokuR = 1002, -- 九宫格连线奖励
  73 + sudokuRP = 1003, -- 九宫格阶段奖励
  74 + sign = 1004, -- 签到
  75 + friendPoint = 1005, -- 友情
  76 + birth = 1006, -- 出生奖励
  77 + actSign = 1007, -- 活动签到
  78 +
  79 + -- 餐厅
  80 + greenHourse = 1101, -- 食材获得
  81 + dinerEntrus = 1102, -- 餐厅委托
  82 + dinerCollect = 1103, -- 餐厅小人收集
  83 + dinerCombo = 1104, -- 小人组合
  84 + dinerSkillUp = 1105, -- 餐厅技能升级
  85 + dinerReTask = 1106, -- 餐厅刷新任务
  86 + addSell = 1107, -- 餐厅贩卖
  87 + dinerBuildUp = 1108, -- 建筑升级
  88 + removeSell = 1109, -- 移除售卖
  89 + dinerSell = 1110, -- 餐饮售卖
  90 +
  91 + -- 英雄
  92 + heroLevelUp = 1201, -- 英雄升级
  93 + heroBreak = 1202, -- 英雄突破
  94 + heroWake = 1203, -- 英雄觉醒
  95 + heroTalent = 1204, -- 英雄天赋
  96 + createHero = 1205, -- 碎片合成
  97 + createHeroRandom = 1206, -- 随机合成
  98 + resetHero = 1207, -- 重置养成
  99 + unlockPool = 1208, -- 解锁英雄定向抽卡池
  100 + downloadCv = 1209, -- 下载 cv包奖励
  101 + refer = 1210, -- 穿戴
36 } 102 }
37 103
38 --- 如要修改 要提前修改 _template mapping -- 对应 mapping 为 gamelog-*  
39 -local Mapping = {  
40 - -- 预留一些数据格式 担心integer 范围不够用 将 通用的int* 全部换为long  
41 - common = {  
42 - desc = "keyword",--索引的短字符串  
43 - ucode = "keyword",--关联日志对应ucode  
44 - key1 = "keyword", --可索引的短字符串  
45 - key2 = "keyword", --可索引的短字符串  
46 - -- 几乎不用的长文本  
47 - text1 = "text", --长字符串不索引的类型  
48 - -- 五个不同类型的数字 基本上满足数量要求 尽量从低到高用  
49 - short1 = "short",  
50 - int1 = "long",  
51 - int2 = "long",  
52 - long1 = "long",  
53 - float1 = "float",  
54 -  
55 - -- 底层使用的 一些参数  
56 - cint1 = "long",  
57 - cint2 = "long",  
58 - cint3 = "long",  
59 - } 104 +
  105 +--[[
  106 +100 教学
  107 +200 主线
  108 +300 日常
  109 +400 周常
  110 +500 联盟
  111 +1000 限时任务
  112 +2000 其他
  113 +--]]
  114 +local TaskType = {
  115 +
60 } 116 }
61 117
62 --- 所有的日志都包括的部分 role 里面的信息 -- mapping 信息在 gamelog-role  
63 -local commonRoleField = {  
64 - name = "keyword",  
65 - id = "integer",  
66 - uid = "keyword",  
67 - sid = "short",  
68 - device = "keyword",  
69 - ctime = "integer",  
70 - ltime = "integer",  
71 - level = "short",  
72 - rmbC = "integer", 118 +
  119 +local MethodType = {
  120 + onCreateAccount = {}, -- 创建游戏账号
  121 + onCreateRole = {}, -- 创建游戏角色
  122 + onLogin = {}, -- 玩家登录
  123 + onLogout = { -- 登出
  124 + logtime = true, --登录时长
  125 + },
  126 + setLevel = { -- 设置等级
  127 + level_before = true, -- 变动前的等级,可以跳级
  128 + level_changemain = true, -- 等级变动原因,副本通关:mission,领取奖励:reward
  129 + level_changedetail = true, -- 等级变动原因明细,副本通关则记录关卡ID,领取奖励则记录奖励ID
  130 + level_reward = "json", -- 等级变动奖励,json格式记录,{道具ID1:道具数量,道具ID2:道具数量}
  131 + },
  132 + onGuidePoint = { --游戏引导
  133 + guild_type = true, --引导类型,新手引导:0,系统引导:1,弱引导:2
  134 + guild_id = true, --节点ID
  135 + guild_point = true, --步骤ID
  136 + guild_pass = true, --正常操作:0,自动播放:1,跳过:2
  137 + },
  138 + setOrder = { --玩家订单记录
  139 + order_status = true, -- "订单状态:100 - 开始下单(玩家还未开始付费行为记录)200 - 支付完成并发货(SDK通知可以发货时记录),300 - 订单被取消,1000 - 其他"
  140 + item_id = true, -- 道具id
  141 + item_type = true, -- 购买的道具类型,具体见"onItems"方法中道具类型枚举表
  142 + item_name = true, -- 购买的道具名
  143 + item_number = true, -- 购买的道具数量
  144 + item_level = true, -- 购买的道具等级
  145 + order_cost = true, -- 此次消费的现金金额(单位:分),如 51800即未518元,对应客户端SDK传入的'total_fee'
  146 + order_currency = true, -- 货币类型,默认为"CNY"(人民币),遵循ISO 4217规范
  147 + order_type = true, -- 订单类型,首充记录为1,否则为0
  148 + order_id = true, -- 本条记录的订单号,对应客户端SDK返回的'bs_trade_no'
  149 + },
  150 + onMail = { --玩家邮件操作
  151 + mail_action_type = true, -- 操作(1=收,2=领,3=删)
  152 + mail_receivetime = true, -- 收件时间
  153 + mail_textid = true, -- 邮件文本ID
  154 + mial_title = true, -- 邮件标题参数
  155 + mail_content = true, -- 邮件内容参数
  156 + mail_attach = true, -- 邮件附件
  157 + mail_reason = true, -- 原因
  158 + mail_readstatus = true, -- 邮件读取状态
  159 + mail_attachstatus = true, -- 邮件附件状态
  160 + mail_timeout = true, -- 邮件超时时间
  161 + mail_friend_id = true, -- 收件方账号id
  162 + mail_friend_roleid = true, -- 收件方角色id
  163 + },
  164 + onItems = { --道具流通
  165 + item_id = true, -- 道具id
  166 + item_sequenceid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个礼包多个物品等情形
  167 + item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表
  168 + item_level = true, -- 道具等级
  169 + item_number = true, -- 道具变化数量的绝对值
  170 + action_type = true, -- 变化类型(玩家获取:1,玩家消耗:0)
  171 + item_before = true, -- 道具变化前的数量
  172 + item_after = true, -- 道具变化后的数量
  173 + item_reason = true, -- 道具流动一级原因,如抽卡、装备强化、副本掉落,可参考道具动作类型枚举表
  174 + item_subreason = true, -- 道具流动二级原因,抽卡:卡池ID,装备强化:装备ID,副本掉落:副本ID
  175 + item_other = true, -- 其他(可包含阶数,强化等级,随机属性)
  176 + },
  177 + mission = { --玩家副本完成情况
  178 + mission_threadid = true, -- 大关卡ID
  179 + mission_id = true, -- 关卡ID
  180 + mission_type = true, -- 关卡类型,见关卡类型枚举表
  181 + mission_sequenceid = "ucode", -- 本次对战ID,用于关联一次动作产生多条不同类型的日志
  182 + mission_herolist = "json", -- 英雄ID,排序以玩家出战设置为准,PVP多个队伍则记录多个列表。示例:[[1,2,3],[456]]
  183 + mission_heroscore = true, -- 编队总评分
  184 + mission_enemylist = "json", -- 地方英雄ID,排序以玩家出战设置为准,PVP多个队伍则记录多个列表。示例:[[1,2,3],[456]]
  185 + mission_damage = "json", -- 英雄输出值。示例:{'heroid1':1000,'heroid2':2000,………..}
  186 + mission_ultskill = "json", -- 大招使用情况。示例:{'heroid1':1000,'heroid2':2000,………..}
  187 + mission_reward = "json", -- 获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  188 + mission_starttime = true, -- 战斗开始时间,格式 unixtime 秒级
  189 + mission_roundtime = true, -- 对局时长(秒)
  190 + mission_result = true, -- 战斗结果(0-无效,1-胜利,2-失败)
  191 + mission_star = true, -- 战斗完成星数,无星级的话填写0
  192 + mission_restriction = true, -- 周期内参与限制(0表示没有上限)
  193 + mission_difficulty = true, -- 关卡困难度,无难度区分的话填写0
  194 + mission_strength = true, -- 消耗的体力或次数
  195 + mission_score = true, -- 本局分数,PVP玩法记录为对战后积分,无得分的填0
  196 + mission_cleartype = true, -- 1正常通关;2代理拾荒
  197 + mission_rank = true, -- 对战后排名,适用于PVP玩法和电波塔,其他玩法留空
  198 + misson_monsterkill = "json", -- 击杀怪物ID和数量,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  199 + misson_teamskill = "json", -- 编队支援技能和技能等级情况,json格式记录,{"teamskill1":1,"teamskill2":2,………..}
  200 + misson_teambond = "json", -- 编队羁绊和羁绊等级,json格式记录,{"bondid1":1,"bondid2":2,………..}
  201 + },
  202 + residence_reward = { --玩家挂机或排名奖励
  203 + mission_threadid = true, --大关卡ID
  204 + mission_id = true, --关卡ID
  205 + mission_type = true, --关卡类型,见关卡类型枚举表
  206 + residence_reward_type = true, --领取奖励方式,快速(超前领取)记录为1,正常领取记录为0
  207 + residence_time = true, --挂机或排名时长
  208 + residence_reward = "json", --获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  209 + },
  210 + hero_rise = { --英雄觉醒
  211 + hero_id = true, --英雄ID
  212 + hero_rise_cost = "json", --英雄觉醒消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
  213 + hero_rise_score = true, --英雄觉醒后评分提升
  214 + hero_rise_result = "json", --英雄觉醒效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}
  215 + },
  216 + hero_upgrade = { --英雄升级
  217 + hero_id = true, -- 英雄ID
  218 + hero_upgrade_cost = "json", -- 英雄升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
  219 + hero_upgrade_result = "json", -- 英雄升级效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}
  220 + hero_upgrade_type = true, -- 英雄升级方式,连续升级:1,单击升级:0
  221 + hero_upgrade_score = true, -- 英雄升级后评分
  222 + hero_upgrade_scoreget = true, -- 通过英雄升级提升的评分
  223 + },
  224 + hero_break = { --英雄突破
  225 + hero_id = true, -- 英雄ID
  226 + hero_break_cost = "json", -- 英雄突破消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
  227 + hero_break_result = "json", -- 英雄突破效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}
  228 + hero_break_level = true, -- 英雄突破后等级上限
  229 + },
  230 + hero_talent = { --英雄天赋升级
  231 + hero_id = true, -- 英雄ID
  232 + hero_talent_cost = "json", -- 英雄天赋升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
  233 + hero_talent_levelbef = true, -- 英雄技能升级前等级
  234 + hero_talent_level = true, -- 英雄技能升级后等级
  235 + },
  236 + hero_jewel = { --英雄铭文
  237 + hero_id = true, -- 英雄ID
  238 + hero_jewel_sequence = "ucode", -- 铭文装备编号,用以关联一次装备时产生的多条日志
  239 + hero_jewel_id = true, -- 铭文ID
  240 + hero_jewel_part = true, -- 铭文装备部位
  241 + hero_jewel_score = true, -- 铭文装备后的英雄分值
  242 + hero_jewel_scorebefore = true, -- 铭文装备前的英雄分值
  243 + hero_jewel_result = "json", -- 铭文装备后效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..}
  244 + },
  245 + hero_note = { --英雄评价
  246 + hero_id = true, -- 英雄ID
  247 + hero_note_action = true, -- 英雄评价界面操作,发布评论:0,点赞:1,反对:2
  248 + hero_note_id = true, -- 操作的评价ID
  249 + hero_note_text = true, -- 操作的评价内容
  250 + },
  251 + hero_show = { --展示英雄
  252 + hero_id = true, -- 英雄ID
  253 + },
  254 + hero_recycle = { --英雄回收
  255 + hero_recycle_list = "json", -- 回收的英雄id列表,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  256 + hero_recycle_reward = "json", -- 回收后获得的奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  257 + hero_recycle_cnt = true, -- 总回收英雄量
  258 + },
  259 + gacha = { --英雄招募
  260 + gacha_id = true, -- 卡池ID
  261 + gacha_type = true, -- 卡池类型
  262 + gacha_up = true, -- 卡池UP角色
  263 + gacha_times = true, -- 抽卡次数
  264 + gacha_reward = "json", -- 抽卡结果,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"}
  265 + currency = "json", -- 消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
  266 + },
  267 + equip_wear = { --装备穿戴与卸载
  268 + hero_id = true, --英雄ID
  269 + equip_id = true, --装备ID
  270 + equip_wear_action = true, --装备操作类型:装备:0,卸载:1
  271 + equip_wear_part = true, --装备部位,记录部位ID
  272 + equip_wear_result = "json", --装备操作后结果,记录属性变化,json格式记录,{“aa”:1234,"bb":4567}
  273 + equip_wear_change = "json", --装备操作变化值,记录属性变化,记录正负值,json格式记录,{“aa”:1234,"bb":-45}
  274 + equip_wear_mode = true, --用以区分自动装备还是手动装备,自动记录为0,手动记录为1
  275 + equip_wear_seqid = "ucode", --自动穿戴时记录的系列ID,用以关联一次性装备时候产生的多条记录
  276 + },
  277 + equip_upgrade = { --装备升级
  278 + equip_upgrade_part = true, -- 升级部位,记录部位ID
  279 + equip_id = true, -- 升级后的装备ID
  280 + equip_upgrade_amount = true, -- 升级获取的装备数量
  281 + equip_upgrade_usedid = true, -- 升级消耗的装备ID
  282 + equip_upgrade_cost = true, -- 升级操作消耗装备数量
  283 + equip_upgrade_current = true, -- 升级操作消耗货币数量
  284 + },
  285 + carriage_dismantle = { --物资拆解
  286 + item_id = true, -- 道具id
  287 + item_sequenceid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个礼包多个物品等情形
  288 + item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表
  289 + item_level = true, -- 道具等级
  290 + item_number = true, -- 道具变化数量的绝对值
  291 + carriage_dismantle_type = true, -- 拆解方式,时间到期:0,钥匙开启:1
  292 + carriage_dismantle_time = true, -- 拆解耗时,填写实际耗时
  293 + carriage_dismantle_cost = true, -- 拆解花费钥匙数量,未使用填写0
  294 + carriage_dismantle_rwd = "json", -- 拆解获得物资,json格式记录,{'itemid1':2,'itemid2':3,…………..}
  295 + },
  296 + carriage_logistics = { --后勤室
  297 + carriage_logistics_type = true, -- 后勤室制作类型ID,变异:0,通常:1,魔法:2
  298 + carriage_logistics_itemid = true, -- 后勤室升级物品或技能ID
  299 + carriage_logistics_itemlv = true, -- 升级后物品或技能等级
  300 + carriage_logistics_gear = true, -- 后勤室升级花费齿轮数量
  301 + carriage_logistics_coin = true, -- 后勤室升级花费美食币数量
  302 + },
  303 + carriage_decals = { --贴纸拆解
  304 + item_id = true, --道具id
  305 + item_sequenceid = "ucode", --道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个礼包多个物品等情形
  306 + item_type = true, --道具类型,具体见枚举表中道具类型枚举表
  307 + item_level = true, --道具等级
  308 + item_number = true, --道具变化数量的绝对值
  309 + carriage_decals_rwdid = true, --拆解获得物资ID
  310 + carriage_decals_rwdnum = true, --拆解获得物资数量
  311 + },
  312 + carriage_video = { --放映室
  313 + carriage_video_type = true, --放映室类型,剧情CG:0, 角色CG:1, 主线剧情:2, 角色剧情:3, 活动剧情:4, 图鉴:5
  314 + carriage_video_id = true, --放映室片段ID
  315 + carriage_video_coinid = true, --放映奖励货币类型,无奖励则填写0
  316 + carriage_video_coinnum = true, --放映奖励货币数量,无奖励则填写0
  317 + carriage_video_item = "json", --放映奖励其他物品数量,json格式记录,{'itemid1':10,'itemid2':5,…………..},无奖励则填写0
  318 + },
  319 + carriage_cook = { --调理室
  320 + item_id = true, -- 道具id
  321 + item_level = true, -- 道具等级
  322 + item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表
  323 + carriage_cook_amount = true, -- 制作总量
  324 + carriage_cook_cost = "json", -- 制作消耗道具,json格式记录,{'itemid1':10,'itemid2':5,…………..}
  325 + },
  326 + activity = { --活动或指南奖励
  327 + activity_id = true, -- 活动ID(或活动指定任务的ID)
  328 + activity_type = true, -- 活动类型,见活动类型枚举表
  329 + activity_reward = "json", -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  330 + },
  331 + task_reward = { --任务奖励
  332 + task_reward_id = true, --任务奖励ID
  333 + task_reward_type = true, --任务奖励类型,见 任务奖励类型枚举表
  334 + task_reward_detail = "json", --任务奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  335 + },
  336 + shop_purchase = { --商店购买行为
  337 + item_id = true, -- 道具id
  338 + item_sequenceid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个购买礼包多个物品等情形
  339 + item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表
  340 + item_level = true, -- 道具等级
  341 + item_cnt = true, -- 购买数量技术
  342 + currency_type = true, -- 购买道具消耗的货币类型,记录货币ID
  343 + shop_purchase_current = true, -- 购买道具消耗的货币数量
  344 + shop_id = true, -- 商店ID
  345 + },
  346 + --[[
  347 + 100 添加好友
  348 + 200 删除好友
  349 + 300 屏蔽/拉黑
  350 + 1000 其他
  351 + --]]
  352 + friend_opt = { --好友操作
  353 + friend_opt_type = true, -- 好友操作类型,见枚举表中 好友操作类型枚举表
  354 + friend_accountid = true, -- 好友账户id
  355 + friend_roleid = true, -- 好友账户下的角色id
  356 + friend_cnt = true, -- 操作后好友数量
  357 + },
  358 + communication = { --玩家发言
  359 + publish_type = true, --发言类型,全部:0,公告:1,世界:2,联盟:3,私聊:4
  360 + publish_status = true, --发送状态,发送成功:0,发送失败:1,被屏蔽:2,其他:3
  361 + publish_receive_roleid = true, --接收者角色ID
  362 + publish_text = true, --发言内容
  363 + },
  364 + restaurant_up = { --摊位升级
  365 + restaurant_up_type = true, --升级部件类型,店面:0, 接客:1, 满意度:2, 宣传:3, 广告:4, 周边:5
  366 + restaurant_up_gear = true, --消耗齿轮数量
  367 + restaurant_up_coin = true, --花费美食币数量
  368 + restaurant_up_effectbef = true, --升级前加成
  369 + restaurant_up_effect = true, --升级后加成
  370 + },
  371 + restaurant_sale = { --摊位售卖
  372 + item_id = true, -- 售卖物品ID
  373 + restaurant_sale_seat = true, -- 售卖物品所在位置
  374 + restaurant_sale_time = true, -- 售卖时长
  375 + restaurant_sale_type = true, -- 售卖方式,正常售卖:0, 加速:1,移除售卖:2
  376 + restaurant_sale_coin = true, -- 售卖获得美食币
  377 + restaurant_sale_gear = true, -- 售卖获得齿轮
  378 + },
  379 + restaurant_material = { --食材获取
  380 + item_id = true, -- 获取物品ID
  381 + restaurant_material_seqid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一次获取两件道具情况
  382 + restaurant_material_start = true, -- 申请获取时间
  383 + restaurant_material_time = true, -- 申请到领取耗时
  384 + restaurant_material_num = true, -- 获取物品数量
  385 + },
  386 + restaurant_order = { --订单任务
  387 + restaurant_order_id = true, -- 订单任务ID
  388 + restaurant_order_status = true, -- 订单任务状态,接受:0, 拒绝:1, 完成:2
  389 + restaurant_order_rwd = "json", -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
  390 + restaurant_order_lv = true, -- 订单品质等级,普通:0, 稀有:1, 顶级:2, 豪华:3
  391 + },
  392 + restaurant_collect = { --餐厅顾客图谱
  393 + restaurant_collect_id = true, -- 图谱收集ID
  394 + restaurant_collect_rwd = "json", -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
  395 + restaurant_collect_plan = true, -- 收集进度,即解锁顾客,数字表示
  396 + },
  397 + achievement = { --成就达成
  398 + achievement_id = true, -- 成就id
  399 + achievement_type = true, -- 成就类型,具体枚举表中成就类型枚举表
  400 + achievement_reward = "json", -- 达成成就奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
  401 + },
  402 + get_gift = { --礼包兑换
  403 + gift_id = true, -- 礼包ID
  404 + gift_key = true, -- 礼包key
  405 + gift_reward = "json", -- 礼包奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
  406 + gift_name = true, -- 礼包名称
  407 + gift_reason = true, -- 礼包发放原因,见发放原因枚举表
  408 + },
73 } 409 }
74 410
75 local function printError(info) 411 local function printError(info)
@@ -77,138 +413,119 @@ local function printError(info) @@ -77,138 +413,119 @@ local function printError(info)
77 print(debug.traceback()) 413 print(debug.traceback())
78 end 414 end
79 415
80 -local function checkType(logType, field, value, ctype)  
81 - local typecheckfunc = {  
82 - keyword = function()  
83 - --长度不超过256  
84 - if type(value) ~= "string" then  
85 - value = tostring(value)  
86 - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [keyword], value : %s", logType, field, value))  
87 - else  
88 - if #value > 256 then  
89 - printError(string.format("LOG ERROR: logType [%s] field [%s] [keyword] type to long. value : %s", logType, field, value))  
90 - end  
91 - end  
92 - return value  
93 - end,  
94 - text = function()  
95 - if type(value) ~= "string" then  
96 - value = tostring(value)  
97 - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [text], value : %s", logType, field, value))  
98 - end  
99 - return value  
100 - end,  
101 - integer = function()  
102 - if type(value) ~= "number" then  
103 - value = tonumber(value)  
104 - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], value : %s", logType, field, value))  
105 - end  
106 - if value then  
107 - if math.type(value) ~= "integer" then  
108 - local oldValue = value  
109 - value = math.floor(value)  
110 - if value ~= oldValue then  
111 - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], is float, value : %s", logType, field, value))  
112 - end  
113 - end  
114 - if -2147483648 > value or value > 2147483647 then  
115 - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], too big, value : %s", logType, field, value))  
116 - value = nil  
117 - end  
118 - end  
119 - return value  
120 - end,  
121 - short = function()  
122 - if type(value) ~= "number" then  
123 - value = tonumber(value)  
124 - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], value : %s", logType, field, value))  
125 - end  
126 - if value then  
127 - if math.type(value) ~= "integer" then  
128 - local oldValue = value  
129 - value = math.floor(value)  
130 - if value ~= oldValue then  
131 - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], is float, value : %s", logType, field, value))  
132 - end  
133 - end 416 +local function jsonEncode(tab)
  417 + local newTab = {}
  418 + for k , v in pairs(tab) do
  419 + newTab[tostring(k)] = v
  420 + end
  421 + return json.encode(newTab)
  422 +end
134 423
135 - if -32768 > value or value > 32768 then  
136 - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], too big, value : %s", logType, field, value))  
137 - value = nil  
138 - end  
139 - end  
140 - return value  
141 - end,  
142 - long = function()  
143 - if type(value) ~= "number" then  
144 - value = tonumber(value)  
145 - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], value : %s", logType, field, value))  
146 - end  
147 - if value then  
148 - if math.type(value) ~= "integer" then  
149 - local oldValue = value  
150 - value = math.floor(value)  
151 - if type(value) ~= "integer" then  
152 - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], too big, value : %s", logType, field, value))  
153 - value = nil  
154 - elseif value ~= oldValue then  
155 - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], is float, value : %s", logType, field, value))  
156 - end  
157 - end  
158 - end  
159 - return value  
160 - end,  
161 - float = function()  
162 - if type(value) ~= "number" then  
163 - value = tonumber(value)  
164 - printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [float], value : %s", logType, field, value))  
165 - end  
166 - return value  
167 - end,  
168 - } 424 +local function isIos(self)
  425 + local sid = self:getProperty("sid")
  426 + return sid == 2
  427 +end
169 428
170 - if typecheckfunc[ctype] then  
171 - return typecheckfunc[ctype]()  
172 - else  
173 - printError(string.format("LOG ERROR: logType [%s] field [%s] have a new type [%s] need add check.", logType, field, ctype))  
174 - return nil 429 +local appid, sdkId
  430 +local function getBaseLog(self)
  431 + local uid = self:getProperty("uid")
  432 + if not appid then
  433 + appid, sdkId = string.match(uid, "(.*)_(.*)")
  434 + if not appid then
  435 + sdkId = uid
  436 + appid = 0
  437 + end
175 end 438 end
  439 + local log = {
  440 + server_id = server_id,
  441 + timestamp = skynet.timex(),
  442 + app_id = appid,
  443 + plat_id = isIos(self) and 0 or 1,
  444 + sdk_uid = sdkId,
  445 + account_id = uid,
  446 + role_id = self:getProperty("id"),
  447 + role_name = self:getProperty("name"),
  448 + level = self:getProperty("level"),
  449 + vip = 0,
  450 + device_id = self:getProperty("device"),
  451 + device_model = self:getProperty("dmode"),
  452 + version = "v2.0.1",
  453 + client_version = self.clientVersion or "1.0.0",
  454 + sys_version = self.sysVersion or "unknow",
  455 + ip = self.ip or "0.0.0.0",
  456 + network = self.network or "unknow",
  457 + record_date = os.date("%Y%m%d"),
  458 + }
  459 + return log
176 end 460 end
177 461
  462 +
  463 +
178 local RoleLog = {} 464 local RoleLog = {}
179 function RoleLog.bind(Role) 465 function RoleLog.bind(Role)
180 function Role:log(logType, contents) 466 function Role:log(logType, contents)
181 contents = contents or {} 467 contents = contents or {}
182 - local _logType = LogType[logType]  
183 - if not _logType then  
184 - printError(string.format("LOG ERROR: new logType [%s] need Add Maping.", logType)) 468 + local schema = MethodType[logType]
  469 + if not schema then
  470 + printError(string.format("LOG ERROR: new logType [%s].", logType))
185 return 471 return
186 end 472 end
187 - local doc = {}  
188 - for field, ctype in pairs(commonRoleField) do  
189 - if contents[field] then  
190 - printError(string.format("LOG ERROR: logType [%s] had field [%s] overwrite default.", logType, field))  
191 - end  
192 - doc[field] = checkType("commonRoleField", field, self:getProperty(field), ctype)  
193 - end  
194 -  
195 - local mapping = Mapping[_logType]  
196 - if mapping["ucode"] and not contents["ucode"] then  
197 - contents["ucode"] = self:getActionUcode()  
198 - end 473 + local doc = getBaseLog(self)
199 474
  475 + doc["method"] = logType
200 for field, value in pairs(contents) do 476 for field, value in pairs(contents) do
201 - local ftype = mapping[field]  
202 - if ftype then  
203 - doc[field] = checkType(logType, field, value, ftype) 477 + if not schema[field] then
  478 + printError(string.format("LOG ERROR: logType [%s] have new field [%s], call.", logType, field))
204 else 479 else
205 - printError(string.format("LOG ERROR: logType [%s] have new field [%s] no type in mapping.", logType, field)) 480 + if schema[field] == 'json' then
  481 + value = jsonEncode(value)
  482 + end
  483 + doc[field] = value
  484 + end
  485 + end
  486 +
  487 + for field, tag in pairs(schema) do
  488 + if not contents[field] then
  489 + if tag == "ucode" then
  490 + contents[field] = self:getActionUcode()
  491 + else
  492 + printError(string.format("LOG ERROR: logType [%s] lose field [%s].", logType, field))
  493 + end
206 end 494 end
207 end 495 end
208 if not logd then return end 496 if not logd then return end
209 - pcall(skynet.send, logd, "lua", "log", logType, doc, _logType) 497 + pcall(skynet.send, logd, "lua", "log", doc)
  498 + end
  499 +
  500 + function Role:logItems(itemId, before, after, log)
  501 + if not log then
  502 + print("logItems no log ", debug.traceback())
  503 + end
  504 + local reason = log.desc
  505 + local subreason = log.int1 or 0
  506 + local other = log.int2 or 0
  507 +
  508 + local reasonType = ItemReason[reason]
  509 + if not reasonType then
  510 + printError(string.format("LOG ERROR: onItems no reasonType [%s].", reason))
  511 + end
  512 + local itemData = csvdb["itemCsv"][itemId]
  513 + if not itemData then return end
  514 + self:log("onItems", {
  515 + item_id = itemId, -- 道具id
  516 + item_type = itemData.type, -- 道具类型,具体见枚举表中道具类型枚举表
  517 + item_level = 0, -- 道具等级
  518 + item_number = math.abs(after - before), -- 道具变化数量的绝对值
  519 + action_type = after - before > 0 and 1 or 0, -- 变化类型(玩家获取:1,玩家消耗:0)
  520 + item_before = before, -- 道具变化前的数量
  521 + item_after = after, -- 道具变化后的数量
  522 + item_reason = reasonType, -- 道具流动一级原因,如抽卡、装备强化、副本掉落,可参考道具动作类型枚举表
  523 + item_subreason = subreason, -- 道具流动二级原因,抽卡:卡池ID,装备强化:装备ID,副本掉落:副本ID
  524 + item_other = other, -- 其他(可包含阶数,强化等级,随机属性)
  525 + })
210 end 526 end
211 527
  528 +
212 function Role:startActionUcode() 529 function Role:startActionUcode()
213 if not self._uniqueCount then 530 if not self._uniqueCount then
214 self._uniqueCount = 0 531 self._uniqueCount = 0
@@ -225,7 +542,8 @@ function RoleLog.bind(Role) @@ -225,7 +542,8 @@ function RoleLog.bind(Role)
225 542
226 function Role:getActionUcode() 543 function Role:getActionUcode()
227 return self._actionUcode 544 return self._actionUcode
228 - end 545 + end
  546 +
229 547
230 end 548 end
231 return RoleLog 549 return RoleLog
232 \ No newline at end of file 550 \ No newline at end of file
src/models/RolePlugin.lua
@@ -207,6 +207,7 @@ function RolePlugin.bind(Role) @@ -207,6 +207,7 @@ function RolePlugin.bind(Role)
207 207
208 function Role:addPlayExp(addExp, params) 208 function Role:addPlayExp(addExp, params)
209 local level = self:getProperty("level") 209 local level = self:getProperty("level")
  210 + local oldLevel = level
210 if not csvdb["player_expCsv"][level + 1] then 211 if not csvdb["player_expCsv"][level + 1] then
211 return 212 return
212 end 213 end
@@ -217,24 +218,24 @@ function RolePlugin.bind(Role) @@ -217,24 +218,24 @@ function RolePlugin.bind(Role)
217 if csvdb["player_expCsv"][level + 1] then -- 有下一级 218 if csvdb["player_expCsv"][level + 1] then -- 有下一级
218 newExp = newExp - csvdb["player_expCsv"][level].exp 219 newExp = newExp - csvdb["player_expCsv"][level].exp
219 level = level + 1 220 level = level + 1
  221 + self:checkTaskEnter("RoleLevelUp", {level = level})
220 else 222 else
221 newExp = csvdb["player_expCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除 223 newExp = csvdb["player_expCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除
222 end 224 end
223 end 225 end
224 -  
225 - if params.log then  
226 - local log = clone(params.log)  
227 - if log["cint1"] or log["cint2"] then  
228 - print("addPlayExp error log have cint1 or cint2 or cint3", debug.traceback()) 226 + if level > oldLevel then
  227 + if params.log then
  228 + local log = params.log
  229 + self:log("setLevel", {
  230 + level_before = oldLevel,
  231 + level_changemain = log.desc,
  232 + level_changedetail = log.sub or "",
  233 + level_reward = {},
  234 + })
  235 + else
  236 + print("addPlayExp no log ", debug.traceback())
229 end 237 end
230 -  
231 - log["cint1"] = addExp  
232 - log["cint2"] = newExp  
233 - log["cint3"] = level  
234 -  
235 - self:log("player_exp", log)  
236 - else  
237 - print("addPlayExp no log ", debug.traceback()) 238 +
238 end 239 end
239 240
240 self:updateProperties({level = level, exp = newExp}) 241 self:updateProperties({level = level, exp = newExp})
@@ -257,21 +258,7 @@ function RolePlugin.bind(Role) @@ -257,21 +258,7 @@ function RolePlugin.bind(Role)
257 items = items:incrv(params.itemId, params.count) 258 items = items:incrv(params.itemId, params.count)
258 end 259 end
259 260
260 - if params.log then  
261 - local log = clone(params.log)  
262 - if log["cint1"] or log["cint2"] then  
263 - print("addItem error log have cint1 or cint2 ", debug.traceback())  
264 - end  
265 - log["cint1"] = params.itemId  
266 - log["cint2"] = math.abs(params.count)  
267 - if params.count <= 0 then  
268 - self:log("out_item", log)  
269 - else  
270 - self:log("in_item", log)  
271 - end  
272 - else  
273 - print("addItem no log ", debug.traceback())  
274 - end 261 + self:logItems(params.itemId, origin, nums, params.log)
275 262
276 self:setProperty("items", items) 263 self:setProperty("items", items)
277 if not params.notNotify then 264 if not params.notNotify then
@@ -341,22 +328,12 @@ function RolePlugin.bind(Role) @@ -341,22 +328,12 @@ function RolePlugin.bind(Role)
341 self:incrProperty("diamond", count) 328 self:incrProperty("diamond", count)
342 end 329 end
343 330
344 - if params.log then  
345 - local log = clone(params.log)  
346 - if log["cint1"] or log["cint2"] or log["cint3"] then  
347 - print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback())  
348 - end  
349 - log["cint1"] = origin  
350 - log["cint2"] = count  
351 - self:log("in_diamond", log)  
352 - else  
353 - print("gainDiamond no log ", debug.traceback())  
354 - end  
355 - 331 + self:logItems(ItemId.Diamond, origin, count, params.log)
356 self:notifyUpdateProperty("diamond", self:getAllDiamond()) 332 self:notifyUpdateProperty("diamond", self:getAllDiamond())
357 return true 333 return true
358 end 334 end
359 335
  336 +
360 function Role:costDiamond(params) 337 function Role:costDiamond(params)
361 if not params or type(params) ~= "table" then return false end 338 if not params or type(params) ~= "table" then return false end
362 local count = tonum(params.count) 339 local count = tonum(params.count)
@@ -389,17 +366,8 @@ function RolePlugin.bind(Role) @@ -389,17 +366,8 @@ function RolePlugin.bind(Role)
389 self:incrProperty(costFirst[2], -last) 366 self:incrProperty(costFirst[2], -last)
390 end 367 end
391 368
392 - if params.log then  
393 - local log = clone(params.log)  
394 - if log["cint1"] or log["cint2"] or log["cint3"] then  
395 - print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback())  
396 - end  
397 - log["cint1"] = origin  
398 - log["cint2"] = count  
399 - self:log("out_diamond", log)  
400 - else  
401 - print("costDiamond no log ", debug.traceback())  
402 - end 369 +
  370 + self:logItems(ItemId.Diamond, origin, count, params.log)
403 371
404 self:notifyUpdateProperty("diamond", self:getAllDiamond()) 372 self:notifyUpdateProperty("diamond", self:getAllDiamond())
405 return true 373 return true
@@ -435,17 +403,9 @@ function RolePlugin.bind(Role) @@ -435,17 +403,9 @@ function RolePlugin.bind(Role)
435 local bin = MsgPack.pack(heroResponse) 403 local bin = MsgPack.pack(heroResponse)
436 SendPacket(actionCodes.Hero_loadInfos, bin) 404 SendPacket(actionCodes.Hero_loadInfos, bin)
437 end 405 end
438 - if params.log then  
439 - local log = clone(params.log)  
440 - if log["cint1"] or log["cint2"] or log["cint3"] then  
441 - print("addHero error log have cint1 or cint2 or cint3 ", debug.traceback())  
442 - end  
443 - log["cint1"] = heroId  
444 - log["cint2"] = heroType  
445 - self:log("in_hero", log)  
446 - else  
447 - print("addHero no log ", debug.traceback())  
448 - end 406 +
  407 + self:logItems(heroType + ItemStartId.Hero, 0, 1, params.log)
  408 +
449 return true, newHero 409 return true, newHero
450 end 410 end
451 411
@@ -458,33 +418,6 @@ function RolePlugin.bind(Role) @@ -458,33 +418,6 @@ function RolePlugin.bind(Role)
458 end 418 end
459 end 419 end
460 420
461 - function Role:delHero(heroId, params)  
462 - params = params or {}  
463 - local roleId = self:getProperty('id')  
464 - local hero = self.heros[heroId]  
465 - local heroType = hero:getProperty("type")  
466 - if not hero then return end  
467 -  
468 - self.heros[heroId] = nil  
469 - redisproxy:pipelining(function (red)  
470 - red:del(string.format(R_HERO, roleId, heroId))  
471 - red:srem(string.format(R_HEROS, roleId), heroId)  
472 - end)  
473 -  
474 - if params.log then  
475 - local log = clone(params.log)  
476 - if log["cint1"] or log["cint2"] or log["cint3"] then  
477 - print("delHero error log have cint1 or cint2 or cint3 ", debug.traceback())  
478 - end  
479 - log["cint1"] = heroId  
480 - log["cint2"] = heroType  
481 - self:log("out_hero", log)  
482 - else  
483 - print("delHero no log ", debug.traceback())  
484 - end  
485 -  
486 - SendPacket(actionCodes.Hero_loadInfos, MsgPack.pack({{id = heroId, bDel = true}}))  
487 - end  
488 421
489 function Role:loadHeros() 422 function Role:loadHeros()
490 local roleId = self:getProperty("id") 423 local roleId = self:getProperty("id")
@@ -563,7 +496,8 @@ function RolePlugin.bind(Role) @@ -563,7 +496,8 @@ function RolePlugin.bind(Role)
563 if not equipCsv then return end 496 if not equipCsv then return end
564 local equips = self:getProperty("equips") 497 local equips = self:getProperty("equips")
565 local curTypeEquips = equips[equipType] or {} 498 local curTypeEquips = equips[equipType] or {}
566 - local curCount = (curTypeEquips[equipLv] or 0) + count 499 + local oldCount = curTypeEquips[equipLv] or 0
  500 + local curCount = oldCount + count
567 501
568 -- 是否足够上层判断 502 -- 是否足够上层判断
569 if curCount < 0 then 503 if curCount < 0 then
@@ -581,22 +515,7 @@ function RolePlugin.bind(Role) @@ -581,22 +515,7 @@ function RolePlugin.bind(Role)
581 515
582 self:setProperty("equips", equips) 516 self:setProperty("equips", equips)
583 517
584 - if pms.log then  
585 - local log = clone(pms.log)  
586 - if log["cint1"] or log["cint2"] or log["cint3"] then  
587 - print("addEquip error log have cint1 or cint2 or cint3 ", debug.traceback())  
588 - end  
589 - log["cint1"] = equipType  
590 - log["cint2"] = equipLv  
591 - log["cint3"] = math.abs(count)  
592 - if count < 0 then  
593 - self:log("out_equip", log)  
594 - else  
595 - self:log("in_equip", log)  
596 - end  
597 - else  
598 - print("addEquip no log ", debug.traceback())  
599 - end 518 + self:logItems(equipCsv.id, oldCount, curCount, pms.log)
600 519
601 if not pms.notNotify then 520 if not pms.notNotify then
602 self:changeUpdates({{type = "equips", field = {equipType, equipLv}, value = curCount, isOnlyToC = true}}) -- 通知客户端 521 self:changeUpdates({{type = "equips", field = {equipType, equipLv}, value = curCount, isOnlyToC = true}}) -- 通知客户端
@@ -656,20 +575,7 @@ function RolePlugin.bind(Role) @@ -656,20 +575,7 @@ function RolePlugin.bind(Role)
656 end 575 end
657 self:checkTaskEnter("AddRune", {id = params.id, type = params.type, rarity = data.rarity}, params.notNotify) 576 self:checkTaskEnter("AddRune", {id = params.id, type = params.type, rarity = data.rarity}, params.notNotify)
658 577
659 - if params.log then  
660 - local log = clone(params.log)  
661 - if log["cint1"] or log["cint2"] or log["cint3"] then  
662 - print("addRune error log have cint1 or cint2 or cint3 ", debug.traceback())  
663 - end  
664 -  
665 - log["cint1"] = runeUid  
666 - log["cint2"] = params.type  
667 - log["cint3"] = params.id  
668 -  
669 - self:log("in_rune", log)  
670 - else  
671 - print("addRune no log ", debug.traceback())  
672 - end 578 + self:logItems(params.id, 0, 1, params.log)
673 579
674 return 0, newRune 580 return 0, newRune
675 else 581 else
@@ -685,20 +591,7 @@ function RolePlugin.bind(Role) @@ -685,20 +591,7 @@ function RolePlugin.bind(Role)
685 local rune = self.runeBag[runeId] 591 local rune = self.runeBag[runeId]
686 if rune and rune:getProperty("refer") == 0 then 592 if rune and rune:getProperty("refer") == 0 then
687 593
688 - if params.log then  
689 - local log = clone(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:log("out_rune", log)  
699 - else  
700 - print("delRunes no log ", debug.traceback())  
701 - end 594 + self:logItems(rune:getProperty("id"), 1, 0, params.log)
702 595
703 self.runeBag[runeId] = nil 596 self.runeBag[runeId] = nil
704 table.insert(bDel, runeId) 597 table.insert(bDel, runeId)
@@ -944,19 +837,7 @@ function RolePlugin.bind(Role) @@ -944,19 +837,7 @@ function RolePlugin.bind(Role)
944 837
945 count = count or 1 838 count = count or 1
946 839
947 - if params.log then  
948 - local log = clone(params.log)  
949 - if log["cint1"] or log["cint2"] or log["cint3"] then  
950 - print("funcOpen error log have cint1 or cint2 or cint3 ", debug.traceback())  
951 - end  
952 -  
953 - log["cint1"] = func  
954 - log["cint2"] = count  
955 -  
956 - self:log("func_open", log)  
957 - else  
958 - print("funcOpen no log ", debug.traceback())  
959 - end 840 + self:logItems(func, 0, count, params.log)
960 841
961 if csvdb["itemCsv"][func] and csvdb["itemCsv"][func].type == ItemType.FuncOpen then 842 if csvdb["itemCsv"][func] and csvdb["itemCsv"][func].type == ItemType.FuncOpen then
962 local unlockData = csvdb["unlockCsv"][func] 843 local unlockData = csvdb["unlockCsv"][func]
@@ -1467,15 +1348,6 @@ function RolePlugin.bind(Role) @@ -1467,15 +1348,6 @@ function RolePlugin.bind(Role)
1467 return RANK_ADV[idx] 1348 return RANK_ADV[idx]
1468 end 1349 end
1469 1350
1470 - -- 是否需要进行引导  
1471 - function Role:checkOverGuide(guideId)  
1472 - local funcGuide = self:getProperty("funcGuide")  
1473 - if funcGuide:getv(guideId, 0) > 0 then  
1474 - return true  
1475 - end  
1476 - return false  
1477 - end  
1478 -  
1479 -- 消除指定tag 红点 1351 -- 消除指定tag 红点
1480 function Role:clearRedPTag(tag) 1352 function Role:clearRedPTag(tag)
1481 local redp = self:getProperty("redp") 1353 local redp = self:getProperty("redp")
@@ -1510,8 +1382,8 @@ function RolePlugin.bind(Role) @@ -1510,8 +1382,8 @@ function RolePlugin.bind(Role)
1510 SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ result = "handled" })) 1382 SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ result = "handled" }))
1511 return 1383 return
1512 end 1384 end
1513 -  
1514 - local rechargeData = csvdb["shop_rechargeCsv"][orderObject:getProperty("rechargeId")] 1385 + local rechargeId = orderObject:getProperty("rechargeId")
  1386 + local rechargeData = csvdb["shop_rechargeCsv"][rechargeId]
1515 if rechargeData.rmb ~= tonumber(params.amount) then 1387 if rechargeData.rmb ~= tonumber(params.amount) then
1516 skynet.error(string.format("fake order: %s, roleId: %d, order: %s, rmb %s, get %s", 1388 skynet.error(string.format("fake order: %s, roleId: %d, order: %s, rmb %s, get %s",
1517 params.transactionId, roleId, partnerOrderStr, rechargeData.rmb, params.amount 1389 params.transactionId, roleId, partnerOrderStr, rechargeData.rmb, params.amount
@@ -1519,16 +1391,34 @@ function RolePlugin.bind(Role) @@ -1519,16 +1391,34 @@ function RolePlugin.bind(Role)
1519 return 1391 return
1520 end 1392 end
1521 1393
1522 - local reward = self:recharge({  
1523 - id = orderObject:getProperty("rechargeId"),  
1524 - transactionId = params.transactionId,  
1525 - pay_time = params.pay_time,  
1526 - order = partnerOrderStr 1394 + local order_type = self:getProperty("rmbC") > 0 and 0 or 1
  1395 + local status, reward = self:recharge({
  1396 + id = rechargeId
1527 }) 1397 })
1528 orderObject:setProperty("finishTime", skynet.time()) 1398 orderObject:setProperty("finishTime", skynet.time())
1529 orderObject:setProperty("status", "finish") 1399 orderObject:setProperty("status", "finish")
1530 1400
1531 redisproxy:srem(string.format("role:%d:orders", roleId), partnerOrderStr) 1401 redisproxy:srem(string.format("role:%d:orders", roleId), partnerOrderStr)
  1402 +
  1403 + if not status then
  1404 + status = 200
  1405 + else
  1406 + status = 1000 + status
  1407 + end
  1408 + self:log("setOrder", {
  1409 + order_status = status, -- "订单状态:100 - 开始下单(玩家还未开始付费行为记录)200 - 支付完成并发货(SDK通知可以发货时记录),300 - 订单被取消,1000 - 其他"
  1410 + item_id = rechargeId, -- 道具id
  1411 + item_type = rechargeData.type, -- 购买的道具类型,具体见"onItems"方法中道具类型枚举表
  1412 + item_name = rechargeData.title, -- 购买的道具名
  1413 + item_number = 1, -- 购买的道具数量
  1414 + item_level = 1, -- 购买的道具等级
  1415 + order_cost = rechargeData.rmb * 100, -- 此次消费的现金金额(单位:分),如 51800即未518元,对应客户端SDK传入的'total_fee'
  1416 + order_currency = "CNY", -- 货币类型,默认为"CNY"(人民币),遵循ISO 4217规范
  1417 + order_type = order_type, -- 订单类型,首充记录为1,否则为0
  1418 + order_id = params.transactionId, -- 本条记录的订单号,对应客户端SDK返回的'bs_trade_no'
  1419 + })
  1420 + if status ~= 200 then return end
  1421 +
1532 SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ order = partnerOrderStr, 1422 SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ order = partnerOrderStr,
1533 result = "success", reward = reward})) 1423 result = "success", reward = reward}))
1534 1424
@@ -1541,11 +1431,11 @@ function RolePlugin.bind(Role) @@ -1541,11 +1431,11 @@ function RolePlugin.bind(Role)
1541 local rechargeData = csvdb["shop_rechargeCsv"][id] 1431 local rechargeData = csvdb["shop_rechargeCsv"][id]
1542 if not rechargeData then 1432 if not rechargeData then
1543 skynet.error("recharge id not exist", id) 1433 skynet.error("recharge id not exist", id)
1544 - return 1434 + return 1
1545 end 1435 end
1546 1436
1547 if not self.storeData:checkRechargeRecord(rechargeData.limit, id) then 1437 if not self.storeData:checkRechargeRecord(rechargeData.limit, id) then
1548 - return 1 1438 + return 2
1549 end 1439 end
1550 1440
1551 local diamondCount = 0 1441 local diamondCount = 0
@@ -1560,13 +1450,13 @@ function RolePlugin.bind(Role) @@ -1560,13 +1450,13 @@ function RolePlugin.bind(Role)
1560 end 1450 end
1561 self:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}}) 1451 self:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}})
1562 elseif rechargeData.shop == 2 then --通行证商店 1452 elseif rechargeData.shop == 2 then --通行证商店
1563 - reward, _ = self:award(rechargeData.itemFirst, {log = {desc = "recharge", int1 = id}}) 1453 + reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}})
1564 self.storeData:onBuyCard(rechargeData.type, rechargeData.time) 1454 self.storeData:onBuyCard(rechargeData.type, rechargeData.time)
1565 elseif rechargeData.shop == 3 then -- 礼包商店 1455 elseif rechargeData.shop == 3 then -- 礼包商店
1566 - reward, _ = self:award(rechargeData.itemFirst, {log = {desc = "recharge", int1 = id}}) 1456 + reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}})
1567 else 1457 else
1568 skynet.error("invalid recharge shop type " .. id) 1458 skynet.error("invalid recharge shop type " .. id)
1569 - return 1459 + return 3
1570 end 1460 end
1571 1461
1572 if diamondCount > 0 then 1462 if diamondCount > 0 then
@@ -1576,10 +1466,8 @@ function RolePlugin.bind(Role) @@ -1576,10 +1466,8 @@ function RolePlugin.bind(Role)
1576 -- 累充 1466 -- 累充
1577 local rmb = rechargeData.rmb 1467 local rmb = rechargeData.rmb
1578 self:updateProperty({field = "rmbC", delta = rmb}) 1468 self:updateProperty({field = "rmbC", delta = rmb})
1579 -  
1580 - self:log("role_action", {desc = "recharge", int1 = id, int2 = rmb, key1 = params.transactionId, key2 = params.order, long1 = params.pay_time})  
1581 1469
1582 - return reward 1470 + return nil, reward
1583 end 1471 end
1584 1472
1585 --直接给玩家发送邮件,立即推送小红点 1473 --直接给玩家发送邮件,立即推送小红点
@@ -1600,6 +1488,50 @@ function RolePlugin.bind(Role) @@ -1600,6 +1488,50 @@ function RolePlugin.bind(Role)
1600 self.sendMailFlag = true 1488 self.sendMailFlag = true
1601 end 1489 end
1602 1490
  1491 + -- 是否需要进行引导
  1492 + function Role:checkOverGuide(guideId,slave)
  1493 + local funcGuide = self:getProperty("funcGuide")
  1494 + if funcGuide:getv(guideId * 1000 + (slave or 0), 0) > 0 then
  1495 + return true
  1496 + end
  1497 + return false
  1498 + end
  1499 +
  1500 + -- 保存引导步骤
  1501 + function Role:saveGuide(master,slave,force)
  1502 + local newerGuide = self:getProperty("newerGuide")
  1503 + local guide = newerGuide:toArray(true,"=")
  1504 + local sMaster, sSlave = guide[1], guide[2]
  1505 +
  1506 + if not force and master < sMaster then return end
  1507 + if not force and master <= sMaster and slave < sSlave then return end
  1508 +
  1509 + local funcGuide = self:getProperty("funcGuide")
  1510 + funcGuide = funcGuide:setv(master * 1000 + slave, 1)
  1511 + if funcGuide:getv(master * 1000,0) == 0 then
  1512 + funcGuide = funcGuide:setv(master * 1000, 1)
  1513 + end
  1514 + self:updateProperty({field = "funcGuide", value = funcGuide})
  1515 + self:log("onGuidePoint", {guild_type = 0, guild_id = master, guild_point = slave, guild_pass = 0})
  1516 +
  1517 + newerGuide = string.format("%d=%d",master,slave)
  1518 + self:updateProperty({field = "newerGuide", value = newerGuide})
  1519 + end
  1520 +
  1521 + -- 引导大步骤结束
  1522 + function Role:finishGuide(master)
  1523 + local newerGuide = self:getProperty("newerGuide")
  1524 + local guide = newerGuide:toArray(true,"=")
  1525 + if guide[1] > master then return end
  1526 +
  1527 + local guideCsv = csvdb["guide_mainCsv"]
  1528 + local lastStep = guideCsv[master][#guideCsv[master]]
  1529 + if guideCsv[master + 1] then
  1530 + self:updateProperty({field = "newerGuide", value = string.format("%d=%d",master + 1,1)})
  1531 + else
  1532 + self:updateProperty({field = "newerGuide", value = "9999=1"})
  1533 + end
  1534 + end
1603 end 1535 end
1604 1536
1605 return RolePlugin 1537 return RolePlugin
1606 \ No newline at end of file 1538 \ No newline at end of file
src/models/RolePvp.lua
@@ -500,7 +500,7 @@ function Role:setCrossServerPvpBet(idx) @@ -500,7 +500,7 @@ function Role:setCrossServerPvpBet(idx)
500 local ok, result = pcall(skynet.call, pvpd, "lua", "setBet", idx, self:getProperty("id"), costNum) 500 local ok, result = pcall(skynet.call, pvpd, "lua", "setBet", idx, self:getProperty("id"), costNum)
501 if ok then 501 if ok then
502 if result then 502 if result then
503 - self:costItems(cost, {log = {desc = "crossPvpBet", short1 = day}}) 503 + self:costItems(cost, {log = {desc = "crossPvpBet", int1 = day}})
504 pvpBet[day] = {idx, cost[ItemId.Gold]} 504 pvpBet[day] = {idx, cost[ItemId.Gold]}
505 self:setProperty("pvpBet", pvpBet) 505 self:setProperty("pvpBet", pvpBet)
506 end 506 end
src/models/RoleTask.lua
@@ -76,6 +76,9 @@ local TaskType = { @@ -76,6 +76,9 @@ local TaskType = {
76 AddFriend = 802, -- 加入一个好友 - count 76 AddFriend = 802, -- 加入一个好友 - count
77 GetFriendP = 803, -- 获得友情点 - count 77 GetFriendP = 803, -- 获得友情点 - count
78 78
  79 + -- 角色相关
  80 + RoleLevelUp = 901, -- 角色升级 - curlevel
  81 +
79 --功能未实现 todo 82 --功能未实现 todo
80 AdvShop = 1002, -- 冒险商城 83 AdvShop = 1002, -- 冒险商城
81 UnionBoss = 1004, -- 工会boss 84 UnionBoss = 1004, -- 工会boss
@@ -209,13 +212,22 @@ local Activity = require(&quot;models.Activity&quot;) @@ -209,13 +212,22 @@ local Activity = require(&quot;models.Activity&quot;)
209 local ActivityListener = { 212 local ActivityListener = {
210 func = "checkActivityTask", 213 func = "checkActivityTask",
211 listen = { 214 listen = {
212 - [TaskType.DrawHero] = {{Activity.ActivityType.DrawHero, f("count")}}, 215 + [TaskType.DrawHero] = {{Activity.ActivityType.DrawHero, f("count"), f("pool")}},
213 [TaskType.FoodSell] = {{Activity.ActivityType.FoodSell, f("count")}}, 216 [TaskType.FoodSell] = {{Activity.ActivityType.FoodSell, f("count")}},
214 [TaskType.AdvDraw] = {{Activity.ActivityType.AdvDraw, f("count")}}, 217 [TaskType.AdvDraw] = {{Activity.ActivityType.AdvDraw, f("count")}},
215 [TaskType.OpenBox] = {{Activity.ActivityType.OpenBox, f("count")}}, 218 [TaskType.OpenBox] = {{Activity.ActivityType.OpenBox, f("count")}},
216 } 219 }
217 } 220 }
218 221
  222 +local StoreListener = {
  223 + func = "checkStoreTask",
  224 + listen = {
  225 + [TaskType.HangPass] = {{TriggerEventType.HangPass, f("id")}},
  226 + [TaskType.RoleLevelUp] = {{TriggerEventType.LevelUp, f("level")}},
  227 + [TaskType.TowerPass] = {{TriggerEventType.TowerPass, f("level")}},
  228 + }
  229 +}
  230 +
219 231
220 local TaskListeners = { 232 local TaskListeners = {
221 StoryListener, 233 StoryListener,
@@ -223,6 +235,7 @@ local TaskListeners = { @@ -223,6 +235,7 @@ local TaskListeners = {
223 AchievListener, 235 AchievListener,
224 SudokuListener, 236 SudokuListener,
225 ActivityListener, 237 ActivityListener,
  238 + StoreListener,
226 } 239 }
227 240
228 local RoleTask = {} 241 local RoleTask = {}
@@ -533,6 +546,10 @@ function RoleTask.bind(Role) @@ -533,6 +546,10 @@ function RoleTask.bind(Role)
533 self.activity:checkActivity(notNotify, activityType, ...) 546 self.activity:checkActivity(notNotify, activityType, ...)
534 end 547 end
535 548
  549 + function Role:checkStoreTask(notNotify, triggerType, param)
  550 + self.storeData:OnTriggerLimitTimePack(triggerType, param)
  551 + end
  552 +
536 end 553 end
537 554
538 return RoleTask 555 return RoleTask
539 \ No newline at end of file 556 \ No newline at end of file
src/models/RoleTimeReset.lua
@@ -13,6 +13,7 @@ ResetFunc[&quot;CrossDay&quot;] = function(self, notify, response, now) @@ -13,6 +13,7 @@ ResetFunc[&quot;CrossDay&quot;] = function(self, notify, response, now)
13 self.storeData:onCrossDay() 13 self.storeData:onCrossDay()
14 14
15 self:setProperty("dTask", {}) 15 self:setProperty("dTask", {})
  16 + self:incrProperty("lday", 1)
16 self:advRandomSupportEffect(not notify) 17 self:advRandomSupportEffect(not notify)
17 18
18 self:checkExpireItem(not notify) 19 self:checkExpireItem(not notify)
src/models/Rune.lua
@@ -27,15 +27,15 @@ function Rune:notifyUpdateProperty(field, newValue, oldValue) @@ -27,15 +27,15 @@ function Rune:notifyUpdateProperty(field, newValue, oldValue)
27 end 27 end
28 28
29 function Rune:log(contents) 29 function Rune:log(contents)
30 - contents = contents or {}  
31 - if contents["cint1"] or contents["cint2"] or contents["cint3"] then  
32 - print("heroLog error log have cint1 or cint2 or cint3 ", debug.traceback())  
33 - end  
34 - contents["cint1"] = self:getProperty("uid")  
35 - contents["cint2"] = self:getProperty("type")  
36 - contents["cint3"] = self:getProperty("id") 30 + -- contents = contents or {}
  31 + -- if contents["cint1"] or contents["cint2"] or contents["cint3"] then
  32 + -- print("heroLog error log have cint1 or cint2 or cint3 ", debug.traceback())
  33 + -- end
  34 + -- contents["cint1"] = self:getProperty("uid")
  35 + -- contents["cint2"] = self:getProperty("type")
  36 + -- contents["cint3"] = self:getProperty("id")
37 37
38 - self.owner:log("rune_action", contents) 38 + -- self.owner:log("rune_action", contents)
39 end 39 end
40 40
41 function Rune:notifyUpdateProperties(params) 41 function Rune:notifyUpdateProperties(params)
src/models/Store.lua
@@ -20,6 +20,7 @@ Store.schema = { @@ -20,6 +20,7 @@ Store.schema = {
20 privCardEx = {"number", 0}, -- 特权卡过期时间戳 20 privCardEx = {"number", 0}, -- 特权卡过期时间戳
21 getMailT1 = {"number",0}, -- 上次发送月卡福利邮件的时间 21 getMailT1 = {"number",0}, -- 上次发送月卡福利邮件的时间
22 getMailT2 = {"number",0}, -- 上次发送超级月卡福利邮件的时间 22 getMailT2 = {"number",0}, -- 上次发送超级月卡福利邮件的时间
  23 + packTrigger = {"table", {}} -- 礼包触发记录 {关卡难度1={id, 通关关卡数,升级数,爬塔层数}, ...}
23 } 24 }
24 25
25 function Store:updateProperty(params) 26 function Store:updateProperty(params)
@@ -60,7 +61,7 @@ end @@ -60,7 +61,7 @@ end
60 -- 发送月卡邮件 61 -- 发送月卡邮件
61 function Store:sendMonthCardEmail() 62 function Store:sendMonthCardEmail()
62 local timeNow = skynet.timex() 63 local timeNow = skynet.timex()
63 - local tabs = {{ex="monthCardEx", t="getMailT1", mail=MailId.MonthCard, alert=MailId.MonthCardEx}, 64 + local tabs = {{ex="monthCardEx", t="getMailT1", mail=MailId.MonthCard, alert=MailId.MonthCardEx},
64 {ex="smonthCardEx", t="getMailT2", mail=MailId.SuperMonthCard, alert=MailId.SuperMonthCardEx}} 65 {ex="smonthCardEx", t="getMailT2", mail=MailId.SuperMonthCard, alert=MailId.SuperMonthCardEx}}
65 for _, v in ipairs(tabs) do 66 for _, v in ipairs(tabs) do
66 local ex = self:getProperty(v.ex) 67 local ex = self:getProperty(v.ex)
@@ -216,7 +217,7 @@ function Store:onBattleCardReset() @@ -216,7 +217,7 @@ function Store:onBattleCardReset()
216 if config then 217 if config then
217 local freeFlag = string.char(string.getbit(battleCardFreeRecord, id)) 218 local freeFlag = string.char(string.getbit(battleCardFreeRecord, id))
218 local limitFlag = string.char(string.getbit(battleCardLimitRecord, id)) 219 local limitFlag = string.char(string.getbit(battleCardLimitRecord, id))
219 - 220 +
220 if battlePoint < config.point then 221 if battlePoint < config.point then
221 break 222 break
222 end 223 end
@@ -227,7 +228,7 @@ function Store:onBattleCardReset() @@ -227,7 +228,7 @@ function Store:onBattleCardReset()
227 concatGift(config.giftLimit) 228 concatGift(config.giftLimit)
228 end 229 end
229 end 230 end
230 - end 231 + end
231 self.owner:sendMail(MailId.BattleCardAward, nil, gift) 232 self.owner:sendMail(MailId.BattleCardAward, nil, gift)
232 -- 计算剩余奖励 233 -- 计算剩余奖励
233 self:updateProperty({field = "battleCard", value=0}) 234 self:updateProperty({field = "battleCard", value=0})
@@ -266,6 +267,69 @@ function Store:resetStoreReored(resetId) @@ -266,6 +267,69 @@ function Store:resetStoreReored(resetId)
266 self:updateProperty({field = "buyR", value = buyRecord}) 267 self:updateProperty({field = "buyR", value = buyRecord})
267 end 268 end
268 269
  270 +--触发限时礼包
  271 +function Store:OnTriggerLimitTimePack(eventType, param)
  272 + local limitPack = self:getProperty("limitTPack")
  273 + local payRecord = self:getProperty("payR")
  274 + local timeNow = skynet.timex()
  275 + local find = false
  276 + -- 有未过期的限时礼包不再推送
  277 + for k, v in pairs(limitPack) do
  278 + if v > timeNow and not payRecord[k] then
  279 + find = true
  280 + break
  281 + end
  282 + end
  283 + if find == true then
  284 + return
  285 + end
  286 + limitPack = {}
  287 + local hangPass = self.owner:getProperty("hangPass")
  288 + local triggerRecord = self:getProperty("packTrigger")
  289 + local result = {}
  290 + local maxDiff = 0
  291 + -- 取满足限时礼包关卡要求的对应数据
  292 + for diff, maxCarbonId in pairs(hangPass) do
  293 + for id, cfg in pairs(csvdb["shop_packCsv"]) do
  294 + local range = cfg.showRange:toArray(true, "=")
  295 + local beginRange = range[1] or 0
  296 + local endRange = range[2] or 0
  297 + if maxCarbonId > beginRange and maxCarbonId <= endRange and cfg.type == eventType then
  298 + result[diff] = cfg
  299 + maxDiff = math.max(maxDiff, diff)
  300 + break
  301 + end
  302 + end
  303 + end
  304 + local shopGoodsId = 0
  305 + for diff, cfg in pairs(result) do
  306 + if diff == maxDiff then
  307 + local record = triggerRecord[diff] or {}
  308 + if (record[0] or 0) ~= cfg.id and next(record) then
  309 + record = {}
  310 + end
  311 + record[0] = cfg.id
  312 + record[eventType] = (record[eventType] or 0) + 1
  313 + if record[eventType] > 0 and record[eventType] % 10 == 0 then
  314 + local pool = cfg.packId:toArray(true, "=")
  315 + local idx = math.random(1, #pool)
  316 + shopGoodsId = pool[idx]
  317 + end
  318 + triggerRecord[diff] = record
  319 + end
  320 + end
  321 + if shopGoodsId ~= 0 then
  322 + local rechargeCfg = csvdb["shop_rechargeCsv"][shopGoodsId]
  323 + if rechargeCfg then
  324 + limitPack[rechargeCfg.id] = timeNow + rechargeCfg.time
  325 + self:updateProperty({field = "limitTPack", value = limitPack})
  326 + end
  327 + end
  328 + if next(result) then
  329 + self:updateProperty({field = "packTrigger", value = triggerRecord})
  330 + end
  331 +end
  332 +
269 function Store:data() 333 function Store:data()
270 return { 334 return {
271 buyR = self:getProperty("buyR"), 335 buyR = self:getProperty("buyR"),
@@ -279,6 +343,7 @@ function Store:data() @@ -279,6 +343,7 @@ function Store:data()
279 battleLR = self:getProperty("battleLR"), 343 battleLR = self:getProperty("battleLR"),
280 limitTPack = self:getProperty("limitTPack"), 344 limitTPack = self:getProperty("limitTPack"),
281 privCardEx = self:getProperty("privCardEx"), 345 privCardEx = self:getProperty("privCardEx"),
  346 + packTrigger = self:getProperty("packTrigger")
282 } 347 }
283 end 348 end
284 349
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", "online", {count = count}, "online")
132 end 132 end
133 end 133 end
134 134
src/services/globald.lua
@@ -60,25 +60,25 @@ local function mailQuene() @@ -60,25 +60,25 @@ local function mailQuene()
60 if email.mid then 60 if email.mid then
61 redisproxy:hmset(string_format("globalEmail:%s", gid), 61 redisproxy:hmset(string_format("globalEmail:%s", gid),
62 "id", gid, 62 "id", gid,
63 - "createtime", email.endTime, 63 + "createtime", email.startTime,
64 "title", email.title, 64 "title", email.title,
65 "stitle", email.stitle, 65 "stitle", email.stitle,
66 "content", email.content, 66 "content", email.content,
67 "attachments", email.attachments, 67 "attachments", email.attachments,
68 "endtime", email.endTime, 68 "endtime", email.endTime,
69 "mid", email.mid, 69 "mid", email.mid,
70 - "timestamp", email.startTime 70 + "timestamp", now
71 ) 71 )
72 else 72 else
73 redisproxy:hmset(string_format("globalEmail:%s", gid), 73 redisproxy:hmset(string_format("globalEmail:%s", gid),
74 "id", gid, 74 "id", gid,
75 - "createtime", email.endTime, 75 + "createtime", email.startTime,
76 "title", email.title, 76 "title", email.title,
77 "stitle", email.stitle, 77 "stitle", email.stitle,
78 "content", email.content, 78 "content", email.content,
79 "attachments", email.attachments, 79 "attachments", email.attachments,
80 "endtime", email.endTime, 80 "endtime", email.endTime,
81 - "timestamp", email.startTime 81 + "timestamp", now
82 ) 82 )
83 end 83 end
84 end 84 end
src/services/logd.lua
@@ -55,44 +55,17 @@ skynet.register_protocol { @@ -55,44 +55,17 @@ skynet.register_protocol {
55 end 55 end
56 } 56 }
57 57
58 -  
59 -  
60 --- 日志 index 不包含 日期的 index_suffix  
61 -local IndexNoDate = {  
62 - online = true,  
63 -}  
64 --- 不走 role log 的日志都要自行注意 mapping 设置【重要】  
65 --- index_suffix index 后缀 默认为 common  
66 -function CMD.log(logType, doc, index_suffix)  
67 - index_suffix = index_suffix or "common"  
68 - if index_suffix == "common" then  
69 - doc["@type"] = logType  
70 - else  
71 - if logType ~= index_suffix then -- 定制后缀 不一定有type 不相等时才有type  
72 - doc["@type"] = logType  
73 - end  
74 - end  
75 -  
76 - local now = skynet.timex()  
77 - doc["timestamp"] = now  
78 - doc["timestamp_f"] = os.date("%Y-%m-%d %H:%M:%S", now)  
79 - doc["server"] = serverId  
80 -  
81 - -- 自己加好 index  
82 - if IndexNoDate[index_suffix] then  
83 - doc["@index"] = string.format("gamelog-%s", index_suffix)  
84 - else  
85 - doc["@index"] = string.format("gamelog-%s-%s", os.date("%Y%m%d", now), index_suffix)  
86 - end 58 +function CMD.log(doc)
87 if not socketdriver.send(log_fd, json.encode(doc) .. "\n") then 59 if not socketdriver.send(log_fd, json.encode(doc) .. "\n") then
88 if not connecting then 60 if not connecting then
89 CMD.open() -- 连一下试试 61 CMD.open() -- 连一下试试
  62 + socketdriver.send(log_fd, json.encode(doc) .. "\n")
90 end 63 end
91 end 64 end
92 end 65 end
93 66
94 function CMD.open() 67 function CMD.open()
95 - log_fd = socketdriver.connect("127.0.0.1", 5170) 68 + log_fd = socketdriver.connect("127.0.0.1", 13001)
96 connecting = true 69 connecting = true
97 end 70 end
98 71
src/utils/StringUtil.lua
@@ -13,7 +13,7 @@ local strh = require &quot;strh&quot; @@ -13,7 +13,7 @@ local strh = require &quot;strh&quot;
13 function string.setv(str, k, v, delimiter) 13 function string.setv(str, k, v, delimiter)
14 delimiter = delimiter or " " 14 delimiter = delimiter or " "
15 -- 若存在则替换,若无则append 15 -- 若存在则替换,若无则append
16 - return strh.modify(str, {[tonumber(k)]=tonumber(v)}, false, delimiter) 16 + return strh.modify(str, {[tonumber(k)]=math.floor(tonumber(v))}, false, delimiter)
17 end 17 end
18 18
19 function string.msetv(str, vs, delimiter) 19 function string.msetv(str, vs, delimiter)
@@ -24,7 +24,7 @@ end @@ -24,7 +24,7 @@ end
24 24
25 function string.incrv(str, k, delta, delimiter) 25 function string.incrv(str, k, delta, delimiter)
26 delimiter = delimiter or " " 26 delimiter = delimiter or " "
27 - return strh.modify(str, {[tonumber(k)]=tonumber(delta)}, true, delimiter) 27 + return strh.modify(str, {[tonumber(k)]=math.floor(tonumber(delta))}, true, delimiter)
28 end 28 end
29 29
30 function string.mincrv(str, ds, delimiter) 30 function string.mincrv(str, ds, delimiter)
@@ -331,4 +331,20 @@ function string.setbit(str, pos, yes) @@ -331,4 +331,20 @@ function string.setbit(str, pos, yes)
331 else 331 else
332 return str:sub(1, pos-1) .. yes .. str:sub(pos+1, -1) 332 return str:sub(1, pos-1) .. yes .. str:sub(pos+1, -1)
333 end 333 end
  334 +end
  335 +
  336 +--[[
  337 +from: 1=2 3=4
  338 +to: {["1"]="2" or 2,["3"]="4" or 4}
  339 +]]
  340 +function string.toMap(str, tonum, sep)
  341 + local str_vec = string.split(str, " ")
  342 + local tab = {}
  343 + for _, v in pairs(str_vec) do
  344 + local vec = string.split(v, sep)
  345 + if #vec == 2 then
  346 + tab[vec[1]] = tonum and tonumber(vec[2]) or vec[2]
  347 + end
  348 + end
  349 + return tab
334 end 350 end
335 \ No newline at end of file 351 \ No newline at end of file