Commit 073ba26524bc597bb388d96d07cf142bd36205b0
Merge branch 'develop' into tr/publish
* develop: 两个记录bug 新设备 遗失的log 充值返利邮件新增 调整压测 error 探索指令bug, 充值返利活动 挂机打完困难20101才设定完成引导22 挂机编队完成的时候服务器主动保存下一步引导,防止极端意外 探索指令调试完成
Showing
16 changed files
with
318 additions
and
46 deletions
Show diff stats
robot/robot.lua
@@ -34,6 +34,9 @@ local ignoreListener = { | @@ -34,6 +34,9 @@ local ignoreListener = { | ||
34 | ["Role.changeUpdate"] = true, | 34 | ["Role.changeUpdate"] = true, |
35 | ["Role.loadRunes"] = true, | 35 | ["Role.loadRunes"] = true, |
36 | ["Hero.loadInfos"] = true, | 36 | ["Hero.loadInfos"] = true, |
37 | + ["Store.updateproperty"] = true, | ||
38 | + ["Sys.maintainNotice"] = true, | ||
39 | + ["Hero.drawHeroExtraRewardNtf"] = true, | ||
37 | ["Sys.innerErrorMsg"] = function(data) | 40 | ["Sys.innerErrorMsg"] = function(data) |
38 | local msg = MsgPack.unpack(data) | 41 | local msg = MsgPack.unpack(data) |
39 | log("innerErrorMsg: " .. msg.id) | 42 | log("innerErrorMsg: " .. msg.id) |
@@ -123,11 +126,6 @@ local function startUnit(unit) | @@ -123,11 +126,6 @@ local function startUnit(unit) | ||
123 | unitTest.new(client):startTest() | 126 | unitTest.new(client):startTest() |
124 | end | 127 | end |
125 | 128 | ||
126 | -local function handle_timeout10000() | ||
127 | - rpcServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "get", pm1 = 1, pm2 = 500})) | ||
128 | - rpcServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "get", pm1 = 2, pm2 = 500})) | ||
129 | - skynet.timeout(10000, handle_timeout6000) | ||
130 | -end | ||
131 | 129 | ||
132 | -- 登录成功开始任务 | 130 | -- 登录成功开始任务 |
133 | function CMD.task() | 131 | function CMD.task() |
@@ -155,6 +153,9 @@ end | @@ -155,6 +153,9 @@ end | ||
155 | 153 | ||
156 | -- 退出 | 154 | -- 退出 |
157 | function CMD.exit() | 155 | function CMD.exit() |
156 | + sendServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "gmmsg", pm1 = "123"})) | ||
157 | + skynet.sleep(50) | ||
158 | + skynet.ret(skynet.pack()) | ||
158 | skynet.exit() | 159 | skynet.exit() |
159 | end | 160 | end |
160 | 161 |
robot/start.lua
@@ -19,9 +19,9 @@ function MSG.open( ... ) | @@ -19,9 +19,9 @@ function MSG.open( ... ) | ||
19 | end | 19 | end |
20 | 20 | ||
21 | function MSG.close(fd) | 21 | function MSG.close(fd) |
22 | - if fd2serv[fd] then | ||
23 | - skynet.send(fd2serv[fd].agent, "lua", "exit") | ||
24 | - | 22 | + if fd2serv[fd] and not fd2serv[fd].closing then |
23 | + fd2serv[fd].closing = true | ||
24 | + skynet.call(fd2serv[fd].agent, "lua", "exit") | ||
25 | log(string_format("logout %s", fd2serv[fd].id)) | 25 | log(string_format("logout %s", fd2serv[fd].id)) |
26 | 26 | ||
27 | id2fd[fd2serv[fd].id] = nil | 27 | id2fd[fd2serv[fd].id] = nil |
@@ -94,8 +94,8 @@ local function add_robot() | @@ -94,8 +94,8 @@ local function add_robot() | ||
94 | 94 | ||
95 | -- 定时下线 | 95 | -- 定时下线 |
96 | skynet.timeout(math.randomInt(config.online_time[1], config.online_time[2]) * 100, function() | 96 | skynet.timeout(math.randomInt(config.online_time[1], config.online_time[2]) * 100, function() |
97 | - socketdriver.close(fd) | ||
98 | MSG.close(fd) | 97 | MSG.close(fd) |
98 | + socketdriver.close(fd) | ||
99 | end) | 99 | end) |
100 | end | 100 | end |
101 | 101 |
robot/unitTest/hero.lua
@@ -26,7 +26,7 @@ end | @@ -26,7 +26,7 @@ end | ||
26 | 26 | ||
27 | function _M:drawHero() | 27 | function _M:drawHero() |
28 | sendServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "get", pm1 = 3, pm2 = 400})) | 28 | sendServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "get", pm1 = 3, pm2 = 400})) |
29 | - requestServer(actionCodes.Hero_drawHeroRpc, MsgPack.pack({pool = 1, type = 1})) | 29 | + requestServer(actionCodes.Hero_drawHeroRpc, MsgPack.pack({pool = 2, type = 1})) |
30 | end | 30 | end |
31 | 31 | ||
32 | function _M:drawHero10() | 32 | function _M:drawHero10() |
src/GlobalVar.lua
@@ -293,8 +293,6 @@ MailId = { | @@ -293,8 +293,6 @@ MailId = { | ||
293 | SuperMonthCardEx = 204, | 293 | SuperMonthCardEx = 204, |
294 | BattleCardAward = 210, | 294 | BattleCardAward = 210, |
295 | 295 | ||
296 | - PaySignAward = 222, | ||
297 | - | ||
298 | ActSellFood = 231, | 296 | ActSellFood = 231, |
299 | ActDrawCard = 232, | 297 | ActDrawCard = 232, |
300 | ActAdvDraw = 233, | 298 | ActAdvDraw = 233, |
@@ -303,6 +301,9 @@ MailId = { | @@ -303,6 +301,9 @@ MailId = { | ||
303 | ActDrawCardReward = 222, | 301 | ActDrawCardReward = 222, |
304 | ActAdvDrawReward = 223, | 302 | ActAdvDrawReward = 223, |
305 | ActOpenBoxReward = 224, | 303 | ActOpenBoxReward = 224, |
304 | + | ||
305 | + PaySignAward = 241, | ||
306 | + PayBackAward = 242, | ||
306 | } | 307 | } |
307 | 308 | ||
308 | TriggerEventType = { | 309 | TriggerEventType = { |
src/actions/GmAction.lua
@@ -27,6 +27,7 @@ function _M.ignoreout(role, pms) | @@ -27,6 +27,7 @@ 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:mylog("gm_action", {desc = "ignoreout", key1 = pms.sender}) | ||
30 | return "指令生效" | 31 | return "指令生效" |
31 | end | 32 | end |
32 | 33 | ||
@@ -46,11 +47,17 @@ function _M.ban(role, pms) | @@ -46,11 +47,17 @@ function _M.ban(role, pms) | ||
46 | end) | 47 | end) |
47 | end | 48 | end |
48 | end | 49 | end |
50 | + | ||
51 | + role:mylog("gm_action", {desc = "ban", int1 = time, int2 = ctype, key1 = pms.sender}) | ||
52 | + | ||
49 | return isBan and "解封杀成功" or "封杀成功" | 53 | return isBan and "解封杀成功" or "封杀成功" |
50 | end | 54 | end |
51 | 55 | ||
52 | function _M.unban(role, pms) | 56 | function _M.unban(role, pms) |
53 | role:setBan(0, 0) | 57 | role:setBan(0, 0) |
58 | + | ||
59 | + role:mylog("gm_action", {desc = "unban", key1 = pms.sender}) | ||
60 | + | ||
54 | return "解封杀成功" | 61 | return "解封杀成功" |
55 | end | 62 | end |
56 | 63 | ||
@@ -63,6 +70,8 @@ function _M.gmmsg(role, pms) | @@ -63,6 +70,8 @@ function _M.gmmsg(role, pms) | ||
63 | skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd) | 70 | skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd) |
64 | end) | 71 | end) |
65 | end | 72 | end |
73 | + role:mylog("gm_action", {desc = "gmmsg", text1 = pms.pm1, key1 = pms.sender}) | ||
74 | + | ||
66 | return "指令成功" | 75 | return "指令成功" |
67 | end | 76 | end |
68 | 77 | ||
@@ -73,6 +82,8 @@ function _M.silent(role, pms) | @@ -73,6 +82,8 @@ function _M.silent(role, pms) | ||
73 | return "解禁言成功" | 82 | return "解禁言成功" |
74 | end | 83 | end |
75 | role:updateProperty({field = "silent", value = specTime({hour = 0}, skynet.timex()) + pm1 * 86400}) | 84 | role:updateProperty({field = "silent", value = specTime({hour = 0}, skynet.timex()) + pm1 * 86400}) |
85 | + | ||
86 | + role:mylog("gm_action", {desc = "silent", int1 = pms.pm1, key1 = pms.sender}) | ||
76 | return "禁言成功" | 87 | return "禁言成功" |
77 | end | 88 | end |
78 | 89 | ||
@@ -90,6 +101,8 @@ function _M.hero(role, pms) | @@ -90,6 +101,8 @@ function _M.hero(role, pms) | ||
90 | if not role:addHero({type = heroType, log = {desc = "gm"}}) then | 101 | if not role:addHero({type = heroType, log = {desc = "gm"}}) then |
91 | return "失败" | 102 | return "失败" |
92 | end | 103 | end |
104 | + | ||
105 | + role:mylog("gm_action", {desc = "hero", int1 = heroType, key1 = pms.sender}) | ||
93 | return "成功" | 106 | return "成功" |
94 | end | 107 | end |
95 | 108 | ||
@@ -122,6 +135,8 @@ function _M.herol(role, pms) | @@ -122,6 +135,8 @@ function _M.herol(role, pms) | ||
122 | hero:updateProperty({field = "level", delta = addLevel}) | 135 | hero:updateProperty({field = "level", delta = addLevel}) |
123 | role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")}) | 136 | role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")}) |
124 | 137 | ||
138 | + role:mylog("gm_action", {desc = "herol", int1 = heroType, int2 = addLevel, key1 = pms.sender}) | ||
139 | + | ||
125 | return "成功" | 140 | return "成功" |
126 | end | 141 | end |
127 | 142 | ||
@@ -133,6 +148,8 @@ function _M.herola(role, pms) | @@ -133,6 +148,8 @@ function _M.herola(role, pms) | ||
133 | _M.herol(role, {pm1 = hero:getProperty("type"), pm2 = addLevel}) | 148 | _M.herol(role, {pm1 = hero:getProperty("type"), pm2 = addLevel}) |
134 | end | 149 | end |
135 | 150 | ||
151 | + role:mylog("gm_action", {desc = "herola", int1 = addLevel, key1 = pms.sender}) | ||
152 | + | ||
136 | return "成功" | 153 | return "成功" |
137 | end | 154 | end |
138 | 155 | ||
@@ -143,6 +160,7 @@ function _M.equip(role, pms) | @@ -143,6 +160,7 @@ function _M.equip(role, pms) | ||
143 | local level = tonum(pms.pm2) | 160 | local level = tonum(pms.pm2) |
144 | local count = tonum(pms.pm3) | 161 | local count = tonum(pms.pm3) |
145 | role:addEquip(typ, level, count, {log = {desc = "gm"}}) | 162 | role:addEquip(typ, level, count, {log = {desc = "gm"}}) |
163 | + role:mylog("gm_action", {desc = "equip", int1 = typ, int2 = level, long1 = count, key1 = pms.sender}) | ||
146 | return "成功" | 164 | return "成功" |
147 | end | 165 | end |
148 | 166 | ||
@@ -151,6 +169,7 @@ function _M.rune(role, pms) | @@ -151,6 +169,7 @@ function _M.rune(role, pms) | ||
151 | local typ = tonum(pms.pm1) | 169 | local typ = tonum(pms.pm1) |
152 | local id = tonum(pms.pm2) | 170 | local id = tonum(pms.pm2) |
153 | local result = role:addRune({type = typ,id = id, log = {desc = "gm"}}) | 171 | local result = role:addRune({type = typ,id = id, log = {desc = "gm"}}) |
172 | + role:mylog("gm_action", {desc = "rune", int1 = typ, int2 = id, key1 = pms.sender}) | ||
154 | 173 | ||
155 | return result | 174 | return result |
156 | end | 175 | end |
@@ -171,6 +190,8 @@ function _M.fb(role, pms) -- 直接通关 | @@ -171,6 +190,8 @@ function _M.fb(role, pms) -- 直接通关 | ||
171 | role:hangFinish(carbonId) | 190 | role:hangFinish(carbonId) |
172 | addPre(carbonId) | 191 | addPre(carbonId) |
173 | 192 | ||
193 | + role:mylog("gm_action", {desc = "fb", int1 = carbonId, key1 = pms.sender}) | ||
194 | + | ||
174 | role:checkTaskEnter("HangPass", {id = carbonId}) | 195 | role:checkTaskEnter("HangPass", {id = carbonId}) |
175 | return "成功" | 196 | return "成功" |
176 | end | 197 | end |
@@ -191,6 +212,8 @@ function _M.fbc(role, pms) -- 直接通关 | @@ -191,6 +212,8 @@ function _M.fbc(role, pms) -- 直接通关 | ||
191 | end | 212 | end |
192 | role:updateProperty({field = "hangPass", value = {}}) | 213 | role:updateProperty({field = "hangPass", value = {}}) |
193 | addPre(carbonId) | 214 | addPre(carbonId) |
215 | + | ||
216 | + role:mylog("gm_action", {desc = "fbc", int1 = carbonId, key1 = pms.sender}) | ||
194 | 217 | ||
195 | return "成功" | 218 | return "成功" |
196 | end | 219 | end |
@@ -224,6 +247,8 @@ function _M.exp(role, pms) | @@ -224,6 +247,8 @@ function _M.exp(role, pms) | ||
224 | exp = math.floor(math.max(exp, 0)) | 247 | exp = math.floor(math.max(exp, 0)) |
225 | role:addPlayExp(exp, {log = {desc = "gm"}}) | 248 | role:addPlayExp(exp, {log = {desc = "gm"}}) |
226 | 249 | ||
250 | + role:mylog("gm_action", {desc = "exp", int1 = exp, key1 = pms.sender}) | ||
251 | + | ||
227 | return "成功" | 252 | return "成功" |
228 | end | 253 | end |
229 | 254 | ||
@@ -280,6 +305,7 @@ function _M.get(role, pms) | @@ -280,6 +305,7 @@ function _M.get(role, pms) | ||
280 | end | 305 | end |
281 | local count = tonum(pms.pm2, 1) | 306 | local count = tonum(pms.pm2, 1) |
282 | role:award({[itemId] = count}, {log = {desc = "gm"}}) | 307 | role:award({[itemId] = count}, {log = {desc = "gm"}}) |
308 | + role:mylog("gm_action", {desc = "get", int1 = itemId, int2 = count, key1 = pms.sender}) | ||
283 | end | 309 | end |
284 | return "成功" | 310 | return "成功" |
285 | end | 311 | end |
@@ -303,6 +329,9 @@ function _M.advc(role, pms) | @@ -303,6 +329,9 @@ function _M.advc(role, pms) | ||
303 | advAFWear = {}, | 329 | advAFWear = {}, |
304 | }, notNotify) | 330 | }, notNotify) |
305 | role.advData = nil | 331 | role.advData = nil |
332 | + | ||
333 | + role:mylog("gm_action", {desc = "advc", key1 = pms.sender}) | ||
334 | + | ||
306 | return "成功" | 335 | return "成功" |
307 | end | 336 | end |
308 | 337 | ||
@@ -311,6 +340,8 @@ function _M.advf(role, pms) | @@ -311,6 +340,8 @@ function _M.advf(role, pms) | ||
311 | role:updateProperty({field = "advC", value = 0}) | 340 | role:updateProperty({field = "advC", value = 0}) |
312 | role.dailyData:updateProperty({field = "advElC", value = 0}) | 341 | role.dailyData:updateProperty({field = "advElC", value = 0}) |
313 | 342 | ||
343 | + role:mylog("gm_action", {desc = "advf", key1 = pms.sender}) | ||
344 | + | ||
314 | return "成功" | 345 | return "成功" |
315 | end | 346 | end |
316 | 347 | ||
@@ -330,6 +361,7 @@ function _M.adv(role, pms) | @@ -330,6 +361,7 @@ function _M.adv(role, pms) | ||
330 | advPass[chapterId] = layer | 361 | advPass[chapterId] = layer |
331 | role:updateProperty({field = "advPass", value = advPass}) | 362 | role:updateProperty({field = "advPass", value = advPass}) |
332 | end | 363 | end |
364 | + role:mylog("gm_action", {desc = "adv", int1 = chapterId, int2 = layer, key1 = pms.sender}) | ||
333 | 365 | ||
334 | return "成功" | 366 | return "成功" |
335 | end | 367 | end |
@@ -356,6 +388,7 @@ function _M.advt(role, pms) | @@ -356,6 +388,7 @@ function _M.advt(role, pms) | ||
356 | isEnter = true, | 388 | isEnter = true, |
357 | debugMapId = mapId, | 389 | debugMapId = mapId, |
358 | }) | 390 | }) |
391 | + role:mylog("gm_action", {desc = "advt", int1 = chapterId, int2 = layer, key1 = pms.sender}) | ||
359 | return "成功" | 392 | return "成功" |
360 | end | 393 | end |
361 | 394 | ||
@@ -364,6 +397,8 @@ function _M.advl(role, pms) | @@ -364,6 +397,8 @@ function _M.advl(role, pms) | ||
364 | local exp = tonum(pms.pm1) | 397 | local exp = tonum(pms.pm1) |
365 | role:addAdvLvExp(math.max(0, exp)) | 398 | role:addAdvLvExp(math.max(0, exp)) |
366 | 399 | ||
400 | + role:mylog("gm_action", {desc = "advl", int1 = exp, key1 = pms.sender}) | ||
401 | + | ||
367 | return "成功" | 402 | return "成功" |
368 | end | 403 | end |
369 | 404 | ||
@@ -377,6 +412,7 @@ function _M.advcl(role, pms) | @@ -377,6 +412,7 @@ function _M.advcl(role, pms) | ||
377 | end | 412 | end |
378 | advData.battle.player:addExp(exp) | 413 | advData.battle.player:addExp(exp) |
379 | advData:saveDB() | 414 | advData:saveDB() |
415 | + role:mylog("gm_action", {desc = "advcl", int1 = exp, key1 = pms.sender}) | ||
380 | 416 | ||
381 | return "成功" | 417 | return "成功" |
382 | end | 418 | end |
@@ -386,6 +422,7 @@ function _M.idlec(role, pms) | @@ -386,6 +422,7 @@ function _M.idlec(role, pms) | ||
386 | role:updateProperty({field = "hangTeam", value = {}}) | 422 | role:updateProperty({field = "hangTeam", value = {}}) |
387 | role:updateProperty({field = "hangInfo", value = {}}) | 423 | role:updateProperty({field = "hangInfo", value = {}}) |
388 | role:updateProperty({field = "hangBag", value = {}}) | 424 | role:updateProperty({field = "hangBag", value = {}}) |
425 | + role:mylog("gm_action", {desc = "idlec", key1 = pms.sender}) | ||
389 | 426 | ||
390 | role.advData = nil | 427 | role.advData = nil |
391 | return "成功" | 428 | return "成功" |
@@ -410,6 +447,8 @@ function _M.advit(role, pms) | @@ -410,6 +447,8 @@ function _M.advit(role, pms) | ||
410 | local itemId = tonum(pms.pm1) | 447 | local itemId = tonum(pms.pm1) |
411 | local count = tonum(pms.pm2) | 448 | local count = tonum(pms.pm2) |
412 | reward[itemId] = count | 449 | reward[itemId] = count |
450 | + | ||
451 | + role:mylog("gm_action", {desc = "advit", int1 = itemId, int2 = count, key1 = pms.sender}) | ||
413 | end | 452 | end |
414 | 453 | ||
415 | 454 | ||
@@ -425,6 +464,8 @@ function _M.tower(role, pms) | @@ -425,6 +464,8 @@ function _M.tower(role, pms) | ||
425 | if not csvdb["tower_battleCsv"][level] then return "不存在" end | 464 | if not csvdb["tower_battleCsv"][level] then return "不存在" end |
426 | role:updateProperty({field = "towerInfo", value = {c = globalCsv.tower_count_limit, l = level}}) | 465 | role:updateProperty({field = "towerInfo", value = {c = globalCsv.tower_count_limit, l = level}}) |
427 | 466 | ||
467 | + role:mylog("gm_action", {desc = "tower", int1 = level, key1 = pms.sender}) | ||
468 | + | ||
428 | return "成功" | 469 | return "成功" |
429 | end | 470 | end |
430 | 471 | ||
@@ -443,6 +484,8 @@ function _M.email(role, pms) | @@ -443,6 +484,8 @@ function _M.email(role, pms) | ||
443 | rewardPms = id ~= 0 and reward or nil, | 484 | rewardPms = id ~= 0 and reward or nil, |
444 | }) | 485 | }) |
445 | 486 | ||
487 | + role:mylog("gm_action", {desc = "email", int1 = id, key1 = pms.sender}) | ||
488 | + | ||
446 | return "成功" | 489 | return "成功" |
447 | end | 490 | end |
448 | 491 | ||
@@ -461,6 +504,8 @@ function _M.guide(role, pms) | @@ -461,6 +504,8 @@ function _M.guide(role, pms) | ||
461 | end | 504 | end |
462 | end | 505 | end |
463 | role:updateProperty({field = "funcGuide", value = str}) | 506 | role:updateProperty({field = "funcGuide", value = str}) |
507 | + role:mylog("gm_action", {desc = "sguide", key1 = pms.sender}) | ||
508 | + | ||
464 | elseif cmd == "RESET" then | 509 | elseif cmd == "RESET" then |
465 | local id = tonum(pms.pm2, 0) | 510 | local id = tonum(pms.pm2, 0) |
466 | if id == 0 then | 511 | if id == 0 then |
@@ -473,6 +518,8 @@ function _M.guide(role, pms) | @@ -473,6 +518,8 @@ function _M.guide(role, pms) | ||
473 | elseif id == 2 then | 518 | elseif id == 2 then |
474 | role:updateProperty({field = "funcGuide", value = ""}) | 519 | role:updateProperty({field = "funcGuide", value = ""}) |
475 | end | 520 | end |
521 | + role:mylog("gm_action", {desc = "cguide", int1 = id, key1 = pms.sender}) | ||
522 | + | ||
476 | end | 523 | end |
477 | 524 | ||
478 | return "成功" | 525 | return "成功" |
@@ -487,7 +534,7 @@ function _M.test(role, pms) | @@ -487,7 +534,7 @@ function _M.test(role, pms) | ||
487 | local id = tonum(pms.pm1, 0) | 534 | local id = tonum(pms.pm1, 0) |
488 | --local hero = require ("actions.HeroAction") | 535 | --local hero = require ("actions.HeroAction") |
489 | --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) | 536 | --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) |
490 | - print(role:getNextCarbonId(id)) | 537 | + print(role:getPaybackReward(0, 10000)) |
491 | return "成功" | 538 | return "成功" |
492 | end | 539 | end |
493 | 540 |
src/actions/HangAction.lua
@@ -166,7 +166,7 @@ function _M.startRpc( agent, data ) | @@ -166,7 +166,7 @@ function _M.startRpc( agent, data ) | ||
166 | elseif carbonId == 10220 then | 166 | elseif carbonId == 10220 then |
167 | role:saveGuide(22,1) | 167 | role:saveGuide(22,1) |
168 | end | 168 | end |
169 | - | 169 | + role:mylog("hang_action", {desc = "startHang", int1 = carbonId}) |
170 | SendPacket(actionCodes.Hang_startRpc, '') | 170 | SendPacket(actionCodes.Hang_startRpc, '') |
171 | return true | 171 | return true |
172 | end | 172 | end |
@@ -261,7 +261,7 @@ function _M.endBattleRpc(agent, data) | @@ -261,7 +261,7 @@ function _M.endBattleRpc(agent, data) | ||
261 | role:saveGuide(9, 2) | 261 | role:saveGuide(9, 2) |
262 | elseif carbonId == 10103 then | 262 | elseif carbonId == 10103 then |
263 | role:finishGuide(9) | 263 | role:finishGuide(9) |
264 | - elseif carbonId == 10220 then | 264 | + elseif carbonId == 20101 then |
265 | role:finishGuide(22) | 265 | role:finishGuide(22) |
266 | end | 266 | end |
267 | for _, guideData in pairs(csvdb["guide_unlockCsv"]) do | 267 | for _, guideData in pairs(csvdb["guide_unlockCsv"]) do |
@@ -278,7 +278,6 @@ function _M.endBattleRpc(agent, data) | @@ -278,7 +278,6 @@ function _M.endBattleRpc(agent, data) | ||
278 | local cfg = csvdb["idle_battleCsv"][nextCarbonId] | 278 | local cfg = csvdb["idle_battleCsv"][nextCarbonId] |
279 | if cfg then | 279 | if cfg then |
280 | hangInfo.bossTime = skynet.timex() + cfg.idle_time | 280 | hangInfo.bossTime = skynet.timex() + cfg.idle_time |
281 | - print(hangInfo.bossTime) | ||
282 | end | 281 | end |
283 | end | 282 | end |
284 | role:updateProperty({field = "hangInfo", value = hangInfo}) | 283 | role:updateProperty({field = "hangInfo", value = hangInfo}) |
@@ -290,6 +289,9 @@ function _M.endBattleRpc(agent, data) | @@ -290,6 +289,9 @@ function _M.endBattleRpc(agent, data) | ||
290 | reward = reward, | 289 | reward = reward, |
291 | }) | 290 | }) |
292 | 291 | ||
292 | + local team = role:getProperty("pvpTC") | ||
293 | + role:mylog("hang_action", {desc = "hangBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = carbonId, int2 = role:getProperty("hangTBV"), cint1 = role:getHerosCamp(team.heros)}) | ||
294 | + | ||
293 | SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({ | 295 | SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({ |
294 | starNum = msg.starNum, | 296 | starNum = msg.starNum, |
295 | reward = reward, | 297 | reward = reward, |
@@ -332,6 +334,7 @@ function _M.roleFormatRpc(agent , data) | @@ -332,6 +334,7 @@ function _M.roleFormatRpc(agent , data) | ||
332 | hangTeam.leader = msg.leader | 334 | hangTeam.leader = msg.leader |
333 | hangTeam.supports = supports | 335 | hangTeam.supports = supports |
334 | role:saveHangTeam(hangTeam) | 336 | role:saveHangTeam(hangTeam) |
337 | + role:saveGuide(5,8) | ||
335 | SendPacket(actionCodes.Hang_roleFormatRpc, '') | 338 | SendPacket(actionCodes.Hang_roleFormatRpc, '') |
336 | return true | 339 | return true |
337 | end | 340 | end |
@@ -564,6 +567,8 @@ function _M.endBonusBattleRpc(agent, data) | @@ -564,6 +567,8 @@ function _M.endBonusBattleRpc(agent, data) | ||
564 | info = msg.info, | 567 | info = msg.info, |
565 | reward = reward, | 568 | reward = reward, |
566 | }) | 569 | }) |
570 | + role:mylog("hang_action", {desc = "bonusBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id}) | ||
571 | + | ||
567 | SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({ | 572 | SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({ |
568 | starNum = starNum, | 573 | starNum = starNum, |
569 | reward = reward, | 574 | reward = reward, |
@@ -586,6 +591,7 @@ function _M.hangGiftRpc(agent, data) | @@ -586,6 +591,7 @@ function _M.hangGiftRpc(agent, data) | ||
586 | local reward, change = role:award(carbonData.item_clear_special, {log = {desc = "hangGift", int1 = id}}) | 591 | local reward, change = role:award(carbonData.item_clear_special, {log = {desc = "hangGift", int1 = id}}) |
587 | 592 | ||
588 | role:changeUpdates({{type = "hangGift", field = id, value = 1}}) | 593 | role:changeUpdates({{type = "hangGift", field = id, value = 1}}) |
594 | + role:mylog("hang_action", {desc = "hangGift", int1 = id}) | ||
589 | 595 | ||
590 | SendPacket(actionCodes.Hang_hangGiftRpc, MsgPack.pack({reward = reward, change = change})) | 596 | SendPacket(actionCodes.Hang_hangGiftRpc, MsgPack.pack({reward = reward, change = change})) |
591 | return true | 597 | return true |
src/actions/RoleAction.lua
@@ -292,7 +292,10 @@ function _M.loginRpc( agent, data ) | @@ -292,7 +292,10 @@ function _M.loginRpc( agent, data ) | ||
292 | 292 | ||
293 | local hangPass = role:getProperty("hangPass") | 293 | local hangPass = role:getProperty("hangPass") |
294 | role:log("onLogin") | 294 | role:log("onLogin") |
295 | - | 295 | + role:mylog("login", {key1 = agent.ip:toArray(false, ":")[1], int1 = hangPass[1] or 0}) |
296 | + if msg.newdevice then | ||
297 | + role:mylog("newdevice", {key1 = agent.ip:toArray(false, ":")[1]}) | ||
298 | + end | ||
296 | return true | 299 | return true |
297 | end | 300 | end |
298 | 301 | ||
@@ -359,7 +362,10 @@ function _M.createRpc(agent, data) | @@ -359,7 +362,10 @@ function _M.createRpc(agent, data) | ||
359 | newRole:log("onCreateAccount") | 362 | newRole:log("onCreateAccount") |
360 | end | 363 | end |
361 | newRole:log("onCreateRole") | 364 | newRole:log("onCreateRole") |
362 | - | 365 | + newRole:mylog("create", {key1 = agent.ip:toArray(false, ":")[1]}) |
366 | + if msg.newdevice then | ||
367 | + newRole:mylog("newdevice", {key1 = agent.ip:toArray(false, ":")[1]}) | ||
368 | + end | ||
363 | 369 | ||
364 | SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response)) | 370 | SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response)) |
365 | return true | 371 | return true |
@@ -552,7 +558,7 @@ function _M.openTimeBoxRpc(agent, data) | @@ -552,7 +558,7 @@ function _M.openTimeBoxRpc(agent, data) | ||
552 | if boxL[slot].time > skynet.timex() then -- 没开完 | 558 | if boxL[slot].time > skynet.timex() then -- 没开完 |
553 | if not quick then return end | 559 | if not quick then return end |
554 | local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") | 560 | local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") |
555 | - local costKey = math.ceil((boxL[slot].time - skynet.timex()) / (cost_pre[1] * 60)) * cost_pre[2] | 561 | + 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 | 562 | if not role:checkItemEnough({[ItemId.BoxKey] = costKey}) then return end |
557 | role:costItems({[ItemId.BoxKey] = costKey}, {log = {desc = "openTimeBox"}}) | 563 | role:costItems({[ItemId.BoxKey] = costKey}, {log = {desc = "openTimeBox"}}) |
558 | end | 564 | end |
@@ -687,8 +693,8 @@ function _M.storyBookRewardRpc(agent, data) | @@ -687,8 +693,8 @@ function _M.storyBookRewardRpc(agent, data) | ||
687 | role:log("carriage_video", { | 693 | role:log("carriage_video", { |
688 | carriage_video_type = storyBookData.type, --放映室类型,剧情CG:0, 角色CG:1, 主线剧情:2, 角色剧情:3, 活动剧情:4, 图鉴:5 | 694 | carriage_video_type = storyBookData.type, --放映室类型,剧情CG:0, 角色CG:1, 主线剧情:2, 角色剧情:3, 活动剧情:4, 图鉴:5 |
689 | carriage_video_id = storyId, --放映室片段ID | 695 | carriage_video_id = storyId, --放映室片段ID |
690 | - carriage_video_coinid = reward[ItemId.Gold] and ItemId.Gold or 0, --放映奖励货币类型,无奖励则填写0 | ||
691 | - carriage_video_coinnum = reward[ItemId.Gold] or 0, --放映奖励货币数量,无奖励则填写0 | 696 | + carriage_video_coinid = reward[ItemId.Diamond] and ItemId.Diamond or 0, --放映奖励货币类型,无奖励则填写0 |
697 | + carriage_video_coinnum = reward[ItemId.Diamond] or 0, --放映奖励货币数量,无奖励则填写0 | ||
692 | carriage_video_item = reward, --放映奖励其他物品数量,json格式记录,{'itemid1':10,'itemid2':5,…………..},无奖励则填写0 | 698 | carriage_video_item = reward, --放映奖励其他物品数量,json格式记录,{'itemid1':10,'itemid2':5,…………..},无奖励则填写0 |
693 | }) | 699 | }) |
694 | 700 | ||
@@ -977,7 +983,7 @@ function _M.chatRpc(agent, data) | @@ -977,7 +983,7 @@ function _M.chatRpc(agent, data) | ||
977 | role:log("communication", { | 983 | role:log("communication", { |
978 | publish_type = cmd, --发言类型,1,世界 2私聊 | 984 | publish_type = cmd, --发言类型,1,世界 2私聊 |
979 | publish_status = 0, --发送状态,发送成功:0,发送失败:1,被屏蔽:2,其他:3 | 985 | publish_status = 0, --发送状态,发送成功:0,发送失败:1,被屏蔽:2,其他:3 |
980 | - publish_receive_roleid = msg.roleId, --接收者角色ID | 986 | + publish_receive_roleid = msg.roleId or 0, --接收者角色ID |
981 | publish_text = content, --发言内容 | 987 | publish_text = content, --发言内容 |
982 | }) | 988 | }) |
983 | SendPacket(actionCodes.Role_chatRpc, MsgPack.pack({result = result, waitTime = waitTime})) | 989 | SendPacket(actionCodes.Role_chatRpc, MsgPack.pack({result = result, waitTime = waitTime})) |
@@ -1007,7 +1013,7 @@ function _M.changeSettingRpc(agent, data) | @@ -1007,7 +1013,7 @@ function _M.changeSettingRpc(agent, data) | ||
1007 | local setting = role:getProperty("setting") | 1013 | local setting = role:getProperty("setting") |
1008 | setting[id] = status | 1014 | setting[id] = status |
1009 | role:updateProperty({field = "setting", value = setting}) | 1015 | role:updateProperty({field = "setting", value = setting}) |
1010 | - | 1016 | + role:mylog("role_action", {desc = "changeSetting", int1 = id, int2 = status}) |
1011 | SendPacket(actionCodes.Role_changeSettingRpc, '') | 1017 | SendPacket(actionCodes.Role_changeSettingRpc, '') |
1012 | return true | 1018 | return true |
1013 | end | 1019 | end |
@@ -1045,6 +1051,7 @@ function _M.drawCodeRpc(agent, data) | @@ -1045,6 +1051,7 @@ function _M.drawCodeRpc(agent, data) | ||
1045 | gift_name = "", -- 礼包名称 | 1051 | gift_name = "", -- 礼包名称 |
1046 | gift_reason = 0, -- 礼包发放原因,见发放原因枚举表 | 1052 | gift_reason = 0, -- 礼包发放原因,见发放原因枚举表 |
1047 | }) | 1053 | }) |
1054 | + role:mylog("role_action", {desc = "drawCode", int1 = giftId, key1 = code}) | ||
1048 | SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({ | 1055 | SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({ |
1049 | result = ret, | 1056 | result = ret, |
1050 | reward = reward, | 1057 | reward = reward, |
@@ -1119,6 +1126,7 @@ function _M.guideRpc(agent, data) | @@ -1119,6 +1126,7 @@ function _M.guideRpc(agent, data) | ||
1119 | if msg.funcType then | 1126 | if msg.funcType then |
1120 | funcGuide = funcGuide:setv(msg.funcType, 1) | 1127 | funcGuide = funcGuide:setv(msg.funcType, 1) |
1121 | role:log("onGuidePoint", {guild_type = 2, guild_id = msg.funcType, guild_point = 0, guild_pass = 0}) | 1128 | role:log("onGuidePoint", {guild_type = 2, guild_id = msg.funcType, guild_point = 0, guild_pass = 0}) |
1129 | + role:mylog("guide", {desc = "guide_weak", int1 = msg.funcType}) | ||
1122 | end | 1130 | end |
1123 | role:updateProperty({field = "funcGuide", value = funcGuide}) | 1131 | role:updateProperty({field = "funcGuide", value = funcGuide}) |
1124 | elseif cmdType == 3 then | 1132 | elseif cmdType == 3 then |
@@ -1128,6 +1136,7 @@ function _M.guideRpc(agent, data) | @@ -1128,6 +1136,7 @@ function _M.guideRpc(agent, data) | ||
1128 | funcGuide = funcGuide:setv(msg.funcType, 1) | 1136 | funcGuide = funcGuide:setv(msg.funcType, 1) |
1129 | role:updateProperty({field = "funcGuide", value = funcGuide}) | 1137 | role:updateProperty({field = "funcGuide", value = funcGuide}) |
1130 | role:log("onGuidePoint", {guild_type = 1, guild_id = msg.funcType, guild_point = 0, guild_pass = 0}) | 1138 | role:log("onGuidePoint", {guild_type = 1, guild_id = msg.funcType, guild_point = 0, guild_pass = 0}) |
1139 | + role:mylog("guide", {desc = "guide_sys", int1 = msg.funcType}) | ||
1131 | end | 1140 | end |
1132 | elseif cmdType == 4 then | 1141 | elseif cmdType == 4 then |
1133 | -- 弹出一个tips(进入功能界面也许要自动弹说明,value要区分1、2) | 1142 | -- 弹出一个tips(进入功能界面也许要自动弹说明,value要区分1、2) |
@@ -1135,6 +1144,7 @@ function _M.guideRpc(agent, data) | @@ -1135,6 +1144,7 @@ function _M.guideRpc(agent, data) | ||
1135 | local value = msg.value or 1 | 1144 | local value = msg.value or 1 |
1136 | for _, funcIdx in pairs(msg.funcType:toArray(true,"=")) do | 1145 | for _, funcIdx in pairs(msg.funcType:toArray(true,"=")) do |
1137 | role:log("onGuidePoint", {guild_type = 3, guild_id = funcIdx, guild_point = 0, guild_pass = 0}) | 1146 | role:log("onGuidePoint", {guild_type = 3, guild_id = funcIdx, guild_point = 0, guild_pass = 0}) |
1147 | + role:mylog("guide", {desc = "guide_tips", int1 = funcIdx}) | ||
1138 | funcGuide = funcGuide:setv(funcIdx, value) | 1148 | funcGuide = funcGuide:setv(funcIdx, value) |
1139 | end | 1149 | end |
1140 | role:updateProperty({field = "funcGuide", value = funcGuide}) | 1150 | role:updateProperty({field = "funcGuide", value = funcGuide}) |
@@ -1211,20 +1221,18 @@ function _M.useSelectItemRpc(agent, data) | @@ -1211,20 +1221,18 @@ function _M.useSelectItemRpc(agent, data) | ||
1211 | local role = agent.role | 1221 | local role = agent.role |
1212 | local msg = MsgPack.unpack(data) | 1222 | local msg = MsgPack.unpack(data) |
1213 | local itemId = msg.itemId | 1223 | local itemId = msg.itemId |
1214 | - local index = msg.index | 1224 | + local subId = msg.subId |
1215 | local count = msg.count | 1225 | local count = msg.count |
1216 | if math.illegalNum(count, 1, role:getItemCount(itemId)) then return end | 1226 | if math.illegalNum(count, 1, role:getItemCount(itemId)) then return end |
1217 | local itemData = csvdb["itemCsv"][itemId] | 1227 | local itemData = csvdb["itemCsv"][itemId] |
1218 | if itemData.type ~= ItemType.SelectItemBox then return end | 1228 | if itemData.type ~= ItemType.SelectItemBox then return end |
1219 | local itemMap = itemData.use_effect:toNumMap() | 1229 | local itemMap = itemData.use_effect:toNumMap() |
1220 | - local i = 1 | ||
1221 | local reward, change = {} | 1230 | local reward, change = {} |
1222 | for k, v in pairs(itemMap) do | 1231 | for k, v in pairs(itemMap) do |
1223 | - if i == index then | 1232 | + if k == subId then |
1224 | reward[k] = v * count | 1233 | reward[k] = v * count |
1225 | break | 1234 | break |
1226 | end | 1235 | end |
1227 | - i = i + 1 | ||
1228 | end | 1236 | end |
1229 | 1237 | ||
1230 | if next(reward) then | 1238 | if next(reward) then |
@@ -1232,6 +1240,7 @@ function _M.useSelectItemRpc(agent, data) | @@ -1232,6 +1240,7 @@ function _M.useSelectItemRpc(agent, data) | ||
1232 | role:costItems({[itemId] = count}, {log = {desc = "openItem"}}) | 1240 | role:costItems({[itemId] = count}, {log = {desc = "openItem"}}) |
1233 | end | 1241 | end |
1234 | SendPacket(actionCodes.Role_useSelectItemRpc, MsgPack.pack(role:packReward(reward, change))) | 1242 | SendPacket(actionCodes.Role_useSelectItemRpc, MsgPack.pack(role:packReward(reward, change))) |
1243 | + return true | ||
1235 | end | 1244 | end |
1236 | 1245 | ||
1237 | return _M | 1246 | return _M |
1238 | \ No newline at end of file | 1247 | \ No newline at end of file |
src/actions/StoreAction.lua
@@ -387,13 +387,13 @@ function _M.getExploreCommandRewardRpc(agent, data) | @@ -387,13 +387,13 @@ function _M.getExploreCommandRewardRpc(agent, data) | ||
387 | local subId = msg.subId -- 领取的阶段id | 387 | local subId = msg.subId -- 领取的阶段id |
388 | 388 | ||
389 | local tab_name = "reward_levelpass" .. id .. "Csv" | 389 | local tab_name = "reward_levelpass" .. id .. "Csv" |
390 | - local config = csvdb[tab_name][id] | 390 | + local config = csvdb[tab_name][subId] |
391 | if not config then return end | 391 | if not config then return end |
392 | 392 | ||
393 | - local bpInfo = role.storeData:getProperty("bpInfo") or {} | 393 | + local bpInfo = role.storeData:getProperty("bpInfo") or {} |
394 | local info = bpInfo[id] or {} | 394 | local info = bpInfo[id] or {} |
395 | local flag = info["flag"] or 0 | 395 | local flag = info["flag"] or 0 |
396 | - if flag == 0 then return 1 end | 396 | + --if flag == 0 then return 1 end |
397 | 397 | ||
398 | local freeRecord = info["fr"] or "" | 398 | local freeRecord = info["fr"] or "" |
399 | local buyRecord = info["br"] or "" | 399 | local buyRecord = info["br"] or "" |
@@ -418,7 +418,7 @@ function _M.getExploreCommandRewardRpc(agent, data) | @@ -418,7 +418,7 @@ function _M.getExploreCommandRewardRpc(agent, data) | ||
418 | if freeFlag == "0" then | 418 | if freeFlag == "0" then |
419 | gift = config.giftFree | 419 | gift = config.giftFree |
420 | 420 | ||
421 | - freeRecord = string.setbit(freeRecord, id) | 421 | + freeRecord = string.setbit(freeRecord, subId) |
422 | info["fr"] = freeRecord | 422 | info["fr"] = freeRecord |
423 | end | 423 | end |
424 | 424 | ||
@@ -428,11 +428,12 @@ function _M.getExploreCommandRewardRpc(agent, data) | @@ -428,11 +428,12 @@ function _M.getExploreCommandRewardRpc(agent, data) | ||
428 | end | 428 | end |
429 | gift = gift .. config.giftLimit | 429 | gift = gift .. config.giftLimit |
430 | 430 | ||
431 | - buyRecord = string.setbit(buyRecord, id) | 431 | + buyRecord = string.setbit(buyRecord, subId) |
432 | info["br"] = buyRecord | 432 | info["br"] = buyRecord |
433 | end | 433 | end |
434 | 434 | ||
435 | - role.storeData:updateProperty({field = "bpInfo", value = info}) | 435 | + bpInfo[id] = info |
436 | + role.storeData:updateProperty({field = "bpInfo", value = bpInfo}) | ||
436 | 437 | ||
437 | local reward, _ = role:award(gift, {log = {desc = "exploreCommand", int1 = id, int2 = subId}}) | 438 | local reward, _ = role:award(gift, {log = {desc = "exploreCommand", int1 = id, int2 = subId}}) |
438 | 439 |
src/models/Activity.lua
@@ -9,6 +9,7 @@ Activity.ActivityType = { | @@ -9,6 +9,7 @@ Activity.ActivityType = { | ||
9 | AdvDraw = 5, --拾荒抽周 资助 | 9 | AdvDraw = 5, --拾荒抽周 资助 |
10 | OpenBox = 6, --拆解周 时钟箱 | 10 | OpenBox = 6, --拆解周 时钟箱 |
11 | PaySignIn = 7, --付费签到 | 11 | PaySignIn = 7, --付费签到 |
12 | + PayBack = 9, --返利 | ||
12 | 13 | ||
13 | SsrUpPoolChange = 10, -- 特定英雄活动,切卡池 | 14 | SsrUpPoolChange = 10, -- 特定英雄活动,切卡池 |
14 | } | 15 | } |
@@ -38,6 +39,7 @@ Activity.schema = { | @@ -38,6 +39,7 @@ Activity.schema = { | ||
38 | act5 = {"table", {}}, -- {0 = 拆解数量, 1=1, 2=1} 拆解周活动 1表示领取过该档位的奖励 | 39 | act5 = {"table", {}}, -- {0 = 拆解数量, 1=1, 2=1} 拆解周活动 1表示领取过该档位的奖励 |
39 | act6 = {"table", {}}, -- {0 = 拾荒消耗远古金币数量, 1=1, 2=1} 拾荒周活动 1表示领取过该档位的奖励 | 40 | act6 = {"table", {}}, -- {0 = 拾荒消耗远古金币数量, 1=1, 2=1} 拾荒周活动 1表示领取过该档位的奖励 |
40 | act7 = {"table", {}}, -- {1 = 1, 2 = 1} == 付费签到活动 | 41 | act7 = {"table", {}}, -- {1 = 1, 2 = 1} == 付费签到活动 |
42 | + act9 = {"number", 0}, -- 充值返利 | ||
41 | } | 43 | } |
42 | 44 | ||
43 | function Activity:data() | 45 | function Activity:data() |
@@ -50,6 +52,7 @@ function Activity:data() | @@ -50,6 +52,7 @@ function Activity:data() | ||
50 | act5 = self:getProperty("act5"), | 52 | act5 = self:getProperty("act5"), |
51 | act6 = self:getProperty("act6"), | 53 | act6 = self:getProperty("act6"), |
52 | act7 = self:getProperty("act7"), | 54 | act7 = self:getProperty("act7"), |
55 | + act9 = self:getProperty("act9"), | ||
53 | } | 56 | } |
54 | end | 57 | end |
55 | 58 | ||
@@ -324,6 +327,24 @@ activityFunc[Activity.ActivityType.PaySignIn] = { | @@ -324,6 +327,24 @@ activityFunc[Activity.ActivityType.PaySignIn] = { | ||
324 | -- end, | 327 | -- end, |
325 | } | 328 | } |
326 | 329 | ||
330 | +-- 充值反馈 | ||
331 | +activityFunc[Activity.ActivityType.PayBack] = { | ||
332 | + ["check"] = function(self, actType, notify, twd) -- 检查 | ||
333 | + local oldVal = self:getActData(actType) or 0 | ||
334 | + local newVal = oldVal + twd | ||
335 | + local gift = self.owner:getPaybackReward(oldVal, newVal) | ||
336 | + if gift ~= "" then | ||
337 | + self.owner:sendMail(MailId.PayBackAward, nil, gift, {newVal}) | ||
338 | + end | ||
339 | + self:updateActData(actType, newVal, not notify) | ||
340 | + end, | ||
341 | + ["init"] = function(self, actType, isCrossDay, notify) | ||
342 | + self:updateActData(actType, {}, not notify) | ||
343 | + end, | ||
344 | + -- ["close"] = function(self, actType, notify) | ||
345 | + -- end, | ||
346 | +} | ||
347 | + | ||
327 | function Activity:initActivity(actType, isCrossDay, notify) | 348 | function Activity:initActivity(actType, isCrossDay, notify) |
328 | if activityFunc[actType] and activityFunc[actType]['close'] then | 349 | if activityFunc[actType] and activityFunc[actType]['close'] then |
329 | activityFunc[actType]["init"](self, actType, isCrossDay, notify) | 350 | activityFunc[actType]["init"](self, actType, isCrossDay, notify) |
src/models/Email.lua
@@ -49,7 +49,7 @@ function Email:data() | @@ -49,7 +49,7 @@ function Email:data() | ||
49 | if emailData then | 49 | if emailData then |
50 | -- 如果内容是直接插入到数据库 | 50 | -- 如果内容是直接插入到数据库 |
51 | if content == "" and emailData.body ~= "" then | 51 | if content == "" and emailData.body ~= "" then |
52 | - content = io.readfile("src/" .. emailData.body) | 52 | + content = io.readfile("src/" .. emailData.body) or "" |
53 | content = content:format(table.unpack(contentPms)) | 53 | content = content:format(table.unpack(contentPms)) |
54 | end | 54 | end |
55 | 55 |
src/models/Role.lua
@@ -149,6 +149,7 @@ Role.schema = { | @@ -149,6 +149,7 @@ Role.schema = { | ||
149 | battlePoint = {"number", 0}, -- 赛季卡使用的活跃点 | 149 | battlePoint = {"number", 0}, -- 赛季卡使用的活跃点 |
150 | 150 | ||
151 | rmbC = {"number", 0}, -- 人民币重置额 | 151 | rmbC = {"number", 0}, -- 人民币重置额 |
152 | + twdC = {"number", 0}, -- 台币总充值金额 | ||
152 | 153 | ||
153 | emailSync = {"number", 0}, -- 已经同步到的邮件Id | 154 | emailSync = {"number", 0}, -- 已经同步到的邮件Id |
154 | 155 | ||
@@ -373,6 +374,7 @@ function Role:data() | @@ -373,6 +374,7 @@ function Role:data() | ||
373 | battlePoint = self:getProperty("battlePoint"), | 374 | battlePoint = self:getProperty("battlePoint"), |
374 | 375 | ||
375 | rmbC = self:getProperty("rmbC"), | 376 | rmbC = self:getProperty("rmbC"), |
377 | + twdC = self:getProperty("twdC"), | ||
376 | repayHero = self:getProperty("repayHero"), | 378 | repayHero = self:getProperty("repayHero"), |
377 | newerDraw = self:getProperty("newerDraw"), | 379 | newerDraw = self:getProperty("newerDraw"), |
378 | floorHero = self:getProperty("floorHero"), | 380 | floorHero = self:getProperty("floorHero"), |
src/models/RolePlugin.lua
@@ -238,7 +238,7 @@ function RolePlugin.bind(Role) | @@ -238,7 +238,7 @@ function RolePlugin.bind(Role) | ||
238 | end | 238 | end |
239 | 239 | ||
240 | if params.log then | 240 | if params.log then |
241 | - local log = params.log | 241 | + local log = clone(params.log) |
242 | if log["cint1"] or log["cint2"] then | 242 | if log["cint1"] or log["cint2"] then |
243 | print("addPlayExp error log have cint1 or cint2 or cint3", debug.traceback()) | 243 | print("addPlayExp error log have cint1 or cint2 or cint3", debug.traceback()) |
244 | end | 244 | end |
@@ -275,7 +275,7 @@ function RolePlugin.bind(Role) | @@ -275,7 +275,7 @@ function RolePlugin.bind(Role) | ||
275 | 275 | ||
276 | self:logItems(params.itemId, origin, nums, params.log) | 276 | self:logItems(params.itemId, origin, nums, params.log) |
277 | if params.log then | 277 | if params.log then |
278 | - local log = params.log | 278 | + local log = clone(params.log) |
279 | if log["cint1"] or log["cint2"] then | 279 | if log["cint1"] or log["cint2"] then |
280 | print("addItem error log have cint1 or cint2 ", debug.traceback()) | 280 | print("addItem error log have cint1 or cint2 ", debug.traceback()) |
281 | end | 281 | end |
@@ -299,7 +299,7 @@ function RolePlugin.bind(Role) | @@ -299,7 +299,7 @@ function RolePlugin.bind(Role) | ||
299 | function Role:checkItemEnough(itemCountT) | 299 | function Role:checkItemEnough(itemCountT) |
300 | local less = {} | 300 | local less = {} |
301 | if not next(itemCountT) then | 301 | if not next(itemCountT) then |
302 | - return false, less | 302 | + return true, less |
303 | end | 303 | end |
304 | for itemId, count in pairs(itemCountT) do | 304 | for itemId, count in pairs(itemCountT) do |
305 | if count <= 0 then | 305 | if count <= 0 then |
@@ -360,7 +360,7 @@ function RolePlugin.bind(Role) | @@ -360,7 +360,7 @@ function RolePlugin.bind(Role) | ||
360 | 360 | ||
361 | self:logItems(ItemId.Diamond, origin, count, params.log) | 361 | self:logItems(ItemId.Diamond, origin, count, params.log) |
362 | if params.log then | 362 | if params.log then |
363 | - local log = params.log | 363 | + local log = clone(params.log) |
364 | if log["cint1"] or log["cint2"] or log["cint3"] then | 364 | if log["cint1"] or log["cint2"] or log["cint3"] then |
365 | print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback()) | 365 | print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback()) |
366 | end | 366 | end |
@@ -410,7 +410,7 @@ function RolePlugin.bind(Role) | @@ -410,7 +410,7 @@ function RolePlugin.bind(Role) | ||
410 | 410 | ||
411 | self:logItems(ItemId.Diamond, origin, count, params.log) | 411 | self:logItems(ItemId.Diamond, origin, count, params.log) |
412 | if params.log then | 412 | if params.log then |
413 | - local log = params.log | 413 | + local log = clone(params.log) |
414 | if log["cint1"] or log["cint2"] or log["cint3"] then | 414 | if log["cint1"] or log["cint2"] or log["cint3"] then |
415 | print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback()) | 415 | print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback()) |
416 | end | 416 | end |
@@ -459,7 +459,7 @@ function RolePlugin.bind(Role) | @@ -459,7 +459,7 @@ function RolePlugin.bind(Role) | ||
459 | self:logItems(heroType + ItemStartId.Hero, 0, 1, params.log) | 459 | self:logItems(heroType + ItemStartId.Hero, 0, 1, params.log) |
460 | 460 | ||
461 | if params.log then | 461 | if params.log then |
462 | - local log = params.log | 462 | + local log = clone(params.log) |
463 | if log["cint1"] or log["cint2"] or log["cint3"] then | 463 | if log["cint1"] or log["cint2"] or log["cint3"] then |
464 | print("addHero error log have cint1 or cint2 or cint3 ", debug.traceback()) | 464 | print("addHero error log have cint1 or cint2 or cint3 ", debug.traceback()) |
465 | end | 465 | end |
@@ -580,7 +580,7 @@ function RolePlugin.bind(Role) | @@ -580,7 +580,7 @@ function RolePlugin.bind(Role) | ||
580 | 580 | ||
581 | self:logItems(equipCsv.id, oldCount, curCount, pms.log) | 581 | self:logItems(equipCsv.id, oldCount, curCount, pms.log) |
582 | if pms.log then | 582 | if pms.log then |
583 | - local log = pms.log | 583 | + local log = clone(pms.log) |
584 | if log["cint1"] or log["cint2"] or log["cint3"] then | 584 | if log["cint1"] or log["cint2"] or log["cint3"] then |
585 | print("addEquip error log have cint1 or cint2 or cint3 ", debug.traceback()) | 585 | print("addEquip error log have cint1 or cint2 or cint3 ", debug.traceback()) |
586 | end | 586 | end |
@@ -656,7 +656,7 @@ function RolePlugin.bind(Role) | @@ -656,7 +656,7 @@ function RolePlugin.bind(Role) | ||
656 | 656 | ||
657 | self:logItems(params.id, 0, 1, params.log) | 657 | self:logItems(params.id, 0, 1, params.log) |
658 | if params.log then | 658 | if params.log then |
659 | - local log = params.log | 659 | + local log = clone(params.log) |
660 | if log["cint1"] or log["cint2"] or log["cint3"] then | 660 | if log["cint1"] or log["cint2"] or log["cint3"] then |
661 | print("addRune error log have cint1 or cint2 or cint3 ", debug.traceback()) | 661 | print("addRune error log have cint1 or cint2 or cint3 ", debug.traceback()) |
662 | end | 662 | end |
@@ -686,7 +686,7 @@ function RolePlugin.bind(Role) | @@ -686,7 +686,7 @@ function RolePlugin.bind(Role) | ||
686 | 686 | ||
687 | self:logItems(rune:getProperty("id"), 1, 0, params.log) | 687 | self:logItems(rune:getProperty("id"), 1, 0, params.log) |
688 | if params.log then | 688 | if params.log then |
689 | - local log = params.log | 689 | + local log = clone(params.log) |
690 | if log["cint1"] or log["cint2"] or log["cint3"] then | 690 | if log["cint1"] or log["cint2"] or log["cint3"] then |
691 | print("delRunes error log have cint1 or cint2 or cint3 ", debug.traceback()) | 691 | print("delRunes error log have cint1 or cint2 or cint3 ", debug.traceback()) |
692 | end | 692 | end |
@@ -946,7 +946,7 @@ function RolePlugin.bind(Role) | @@ -946,7 +946,7 @@ function RolePlugin.bind(Role) | ||
946 | 946 | ||
947 | self:logItems(func, 0, count, params.log) | 947 | self:logItems(func, 0, count, params.log) |
948 | if params.log then | 948 | if params.log then |
949 | - local log = params.log | 949 | + local log = clone(params.log) |
950 | if log["cint1"] or log["cint2"] or log["cint3"] then | 950 | if log["cint1"] or log["cint2"] or log["cint3"] then |
951 | print("funcOpen error log have cint1 or cint2 or cint3 ", debug.traceback()) | 951 | print("funcOpen error log have cint1 or cint2 or cint3 ", debug.traceback()) |
952 | end | 952 | end |
@@ -1586,10 +1586,13 @@ function RolePlugin.bind(Role) | @@ -1586,10 +1586,13 @@ function RolePlugin.bind(Role) | ||
1586 | reward[ItemId.Diamond] = (reward[ItemId.Diamond] or 0) + diamondCount | 1586 | reward[ItemId.Diamond] = (reward[ItemId.Diamond] or 0) + diamondCount |
1587 | end | 1587 | end |
1588 | 1588 | ||
1589 | + self:checkTaskEnter("Pay", {rmb = rechargeData.rmb, twd = rechargeData.twd}) | ||
1590 | + | ||
1589 | -- 累充 | 1591 | -- 累充 |
1590 | local rmb = rechargeData.rmb | 1592 | local rmb = rechargeData.rmb |
1591 | self:updateProperty({field = "rmbC", delta = rmb}) | 1593 | self:updateProperty({field = "rmbC", delta = rmb}) |
1592 | - | 1594 | + self:updateProperty({field = "twdC", delta = rechargeData.twd}) |
1595 | + | ||
1593 | self:mylog("role_action", {desc = "recharge", int1 = id, int2 = rmb, key1 = params.transactionId, key2 = params.order, long1 = params.pay_time}) | 1596 | self:mylog("role_action", {desc = "recharge", int1 = id, int2 = rmb, key1 = params.transactionId, key2 = params.order, long1 = params.pay_time}) |
1594 | 1597 | ||
1595 | return nil, reward | 1598 | return nil, reward |
@@ -1695,6 +1698,37 @@ function RolePlugin.bind(Role) | @@ -1695,6 +1698,37 @@ function RolePlugin.bind(Role) | ||
1695 | return nextId | 1698 | return nextId |
1696 | end | 1699 | end |
1697 | 1700 | ||
1701 | + -- 根据累计充值金额计算奖励档位 | ||
1702 | + function Role:getPaybackReward(oldVal, newVal) | ||
1703 | + local maxVal, diff, extraReward = 0, 0, "" | ||
1704 | + local gift = "" | ||
1705 | + for k, v in pairs(csvdb["rebateCsv"]) do | ||
1706 | + if k > maxVal then | ||
1707 | + maxVal = k | ||
1708 | + end | ||
1709 | + if v.isLoop > diff then | ||
1710 | + diff = v.isLoop | ||
1711 | + extraReward = v.reward | ||
1712 | + end | ||
1713 | + if oldVal < k and newVal > k then | ||
1714 | + gift = gift .. v.reward .. " " | ||
1715 | + end | ||
1716 | + end | ||
1717 | + if newVal > maxVal then | ||
1718 | + local cnt = 0 | ||
1719 | + if oldVal < maxVal then | ||
1720 | + cnt = math.floor((newVal - maxVal) / diff) | ||
1721 | + else | ||
1722 | + cnt = math.floor((newVal - maxVal) / diff) - math.floor((oldVal - maxVal) / diff) | ||
1723 | + end | ||
1724 | + for i = 1, cnt do | ||
1725 | + gift = gift .. extraReward .. " " | ||
1726 | + end | ||
1727 | + end | ||
1728 | + | ||
1729 | + return gift | ||
1730 | + end | ||
1731 | + | ||
1698 | end | 1732 | end |
1699 | 1733 | ||
1700 | return RolePlugin | 1734 | return RolePlugin |
1701 | \ No newline at end of file | 1735 | \ No newline at end of file |
src/models/RoleTask.lua
@@ -89,6 +89,7 @@ local TaskType = { | @@ -89,6 +89,7 @@ local TaskType = { | ||
89 | WeBlog = 1010, -- 关注微博 | 89 | WeBlog = 1010, -- 关注微博 |
90 | SignIn = 1011, -- 签到 | 90 | SignIn = 1011, -- 签到 |
91 | ShopAll = 1013, -- 在任意商店购买 | 91 | ShopAll = 1013, -- 在任意商店购买 |
92 | + Pay = 1014, -- 充值 | ||
92 | } | 93 | } |
93 | 94 | ||
94 | local function f(field, func) | 95 | local function f(field, func) |
@@ -216,6 +217,7 @@ local ActivityListener = { | @@ -216,6 +217,7 @@ local ActivityListener = { | ||
216 | [TaskType.FoodSell] = {{Activity.ActivityType.FoodSell, f("count")}}, | 217 | [TaskType.FoodSell] = {{Activity.ActivityType.FoodSell, f("count")}}, |
217 | [TaskType.AdvDraw] = {{Activity.ActivityType.AdvDraw, f("count")}}, | 218 | [TaskType.AdvDraw] = {{Activity.ActivityType.AdvDraw, f("count")}}, |
218 | [TaskType.OpenBox] = {{Activity.ActivityType.OpenBox, f("count")}}, | 219 | [TaskType.OpenBox] = {{Activity.ActivityType.OpenBox, f("count")}}, |
220 | + [TaskType.Pay] = {{Activity.ActivityType.PayBack, f("twd")}}, | ||
219 | } | 221 | } |
220 | } | 222 | } |
221 | 223 |
@@ -0,0 +1,145 @@ | @@ -0,0 +1,145 @@ | ||
1 | + | ||
2 | +local skynet = require "skynet" | ||
3 | +local socketdriver = require "skynet.socketdriver" | ||
4 | +local serverId = tonumber(skynet.getenv("servId")) | ||
5 | + | ||
6 | +require "shared.init" | ||
7 | +require "skynet.manager" | ||
8 | + | ||
9 | +local table_insert = table.insert | ||
10 | +local pairs = pairs | ||
11 | +local ipairs = ipairs | ||
12 | +local string_format = string.format | ||
13 | + | ||
14 | +local logHandle = { | ||
15 | + log = { | ||
16 | + host = "127.0.0.1", | ||
17 | + port = 13003, | ||
18 | + handle = function(doc, address, msg) | ||
19 | + -- 注入字段 | ||
20 | + local now = skynet.timex() | ||
21 | + doc["time"] = now | ||
22 | + doc["timestamp"] = now | ||
23 | + doc["instance_id"] = serverId | ||
24 | + doc["game_name"] = "wasteland" | ||
25 | + doc["env"] = "cb" | ||
26 | + doc["app_name"] = "gs" | ||
27 | + doc["app_id"] = "game.wasteland.gs" | ||
28 | + --FATAL、ERROR、WARN、INFO、DEBUG | ||
29 | + doc["level"] = "ERROR" | ||
30 | + doc["log"] = msg | ||
31 | + doc["address"] = string_format(":%08x", address) | ||
32 | + end | ||
33 | + }, | ||
34 | +} | ||
35 | + | ||
36 | +local connect_relation = {} | ||
37 | +local function getConInfo(fd) | ||
38 | + return logHandle[connect_relation[fd] or ""] | ||
39 | +end | ||
40 | + | ||
41 | + | ||
42 | + | ||
43 | +local socket_message = {} | ||
44 | +-- read skynet_socket.h for these macro | ||
45 | +-- SKYNET_SOCKET_TYPE_DATA = 1 | ||
46 | +socket_message[1] = function(id, size, data) | ||
47 | + skynet.error(string.format("LOG SOCKET: data: ", skynet.tostring(data, size))) | ||
48 | + socketdriver.drop(data, size) | ||
49 | +end | ||
50 | + | ||
51 | +-- SKYNET_SOCKET_TYPE_CONNECT = 2 | ||
52 | +socket_message[2] = function(id, _ , addr) | ||
53 | + local cur = getConInfo(id) | ||
54 | + skynet.error("LOG SOCKET: connect: ", addr) | ||
55 | + cur.connected = true | ||
56 | + cur.connecting = false | ||
57 | +end | ||
58 | + | ||
59 | +-- SKYNET_SOCKET_TYPE_CLOSE = 3 | ||
60 | +socket_message[3] = function(id) | ||
61 | + skynet.error("LOG SOCKET: closed") | ||
62 | + local cur = getConInfo(id) | ||
63 | + if not cur then return end | ||
64 | + cur.connected = false | ||
65 | + cur.connecting = false | ||
66 | + connect_relation[id] = nil | ||
67 | +end | ||
68 | + | ||
69 | +-- SKYNET_SOCKET_TYPE_ERROR = 5 | ||
70 | +socket_message[5] = function(id, _, err) | ||
71 | + skynet.error("LOG SOCKET: error: ", err) | ||
72 | + local cur = getConInfo(id) | ||
73 | + if not cur then return end | ||
74 | + cur.connected = false | ||
75 | + cur.connecting = false | ||
76 | + connect_relation[id] = nil | ||
77 | +end | ||
78 | + | ||
79 | + | ||
80 | + | ||
81 | +local function open() | ||
82 | + for logTo, data in pairs(logHandle) do | ||
83 | + if not data.connecting and not data.connected then | ||
84 | + data.connecting = true | ||
85 | + data.fd = socketdriver.connect(data.host, data.port) | ||
86 | + connect_relation[data.fd] = logTo | ||
87 | + end | ||
88 | + end | ||
89 | +end | ||
90 | + | ||
91 | +local function log(address, msg, logTo) | ||
92 | + logTo = logTo or "log" | ||
93 | + -- print(string.format(":%08x(%.2f): %s", address, skynet.time(), msg)) | ||
94 | + local cur = logHandle[logTo] | ||
95 | + if not cur then | ||
96 | + print("error log to ", logTo) | ||
97 | + end | ||
98 | + local doc = {} | ||
99 | + if cur.handle then | ||
100 | + cur.handle(doc, address, msg) | ||
101 | + end | ||
102 | + if cur.connected and cur.fd then | ||
103 | + socketdriver.send(cur.fd, json.encode(doc) .. "\n") | ||
104 | + else | ||
105 | + -- 断线会丢失一部分日志 | ||
106 | + if not cur.connecting then | ||
107 | + open() -- 连一下 | ||
108 | + end | ||
109 | + end | ||
110 | +end | ||
111 | + | ||
112 | + | ||
113 | +skynet.register_protocol { | ||
114 | + name = "socket", | ||
115 | + id = skynet.PTYPE_SOCKET, -- PTYPE_SOCKET = 6 | ||
116 | + unpack = socketdriver.unpack, | ||
117 | + dispatch = function (_, _, t, ...) | ||
118 | + if socket_message[t] then | ||
119 | + socket_message[t](...) | ||
120 | + end | ||
121 | + end | ||
122 | +} | ||
123 | + | ||
124 | +-- register protocol text before skynet.start would be better. | ||
125 | +skynet.register_protocol { | ||
126 | + name = "text", | ||
127 | + id = skynet.PTYPE_TEXT, | ||
128 | + unpack = skynet.tostring, | ||
129 | + dispatch = function(_, address, msg) | ||
130 | + log(address, msg) | ||
131 | + end | ||
132 | +} | ||
133 | + | ||
134 | +skynet.register_protocol { | ||
135 | + name = "SYSTEM", | ||
136 | + id = skynet.PTYPE_SYSTEM, | ||
137 | + unpack = function(...) return ... end, | ||
138 | + dispatch = function() | ||
139 | + -- reopen signal | ||
140 | + print("SIGHUP") | ||
141 | + end | ||
142 | +} | ||
143 | + | ||
144 | +open() | ||
145 | +skynet.start(function()end) |
src/services/redisd.lua
@@ -24,5 +24,8 @@ skynet.start(function() | @@ -24,5 +24,8 @@ skynet.start(function() | ||
24 | skynet.ret(skynet.pack(db[string.lower(cmd)](db, ...))) | 24 | skynet.ret(skynet.pack(db[string.lower(cmd)](db, ...))) |
25 | end | 25 | end |
26 | end) | 26 | end) |
27 | + skynet.info_func(function() | ||
28 | + skynet.ret(skynet.pack(skynet.call(skynet.self(), "debug", "STAT"))) | ||
29 | + end) | ||
27 | skynet.register ".redis" | 30 | skynet.register ".redis" |
28 | end) | 31 | end) |
29 | \ No newline at end of file | 32 | \ No newline at end of file |