d763fb14
zhouhaihai
签到 九宫格
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
local ipairs = ipairs
local table = table
local math = math
local string = string
local redisproxy = redisproxy
local MsgPack = MsgPack
local string_format = string.format
local tonumber = tonumber
local table_insert = table.insert
local table_unpack = table.unpack
local table_find = table.find
local table_nums = table.nums
local math_random = math.randomInt
local _M = {}
function _M.sudokuRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local id = msg.id
local sudoku = role:getProperty("sudoku")
local phase = sudoku[-1] or 1
local curData = (csvdb["guide_sudokuCsv"][phase] or {})[id]
if phase == -1 or not curData then return 1 end
sudoku.task = sudoku.task or {}
sudoku.task[phase] = sudoku.task[phase] or {}
if (sudoku.task[phase][id] or 0) < curData.con1 then return 2 end
sudoku.task[phase][id] = -1
|
7bb30dca
zhouhaihai
修改发奖
|
35
|
local task, tchange = role:award(curData.reward, {log = {desc = "sudoku", int1 = id, int2 = phase}}) -- 任务奖励
|
d763fb14
zhouhaihai
签到 九宫格
|
36
|
|
7bb30dca
zhouhaihai
修改发奖
|
37
|
local reward, rchange = {}
|
d763fb14
zhouhaihai
签到 九宫格
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
local rId = {}
for pid, pdata in pairs(csvdb["guide_sudoku_rewardCsv"][phase] or {}) do
local pos = pdata.pos:toArray(true, "=")
local ok, is = true, false
for _, one in pairs(pos) do
if one == id then
is = true
end
if sudoku.task[phase][one] ~= -1 then
ok = false
break
end
end
if ok and is then
for itemId, count in pairs(pdata.reward:toNumMap()) do
reward[itemId] = (reward[itemId] or 0) + count
end
table.insert(rId, pid)
end
end
if not next(reward) then
reward = nil
else
|
7bb30dca
zhouhaihai
修改发奖
|
63
|
reward, rchange = role:award(reward, {log = {desc = "sudokuR", int1 = id, int2 = phase}})
|
d763fb14
zhouhaihai
签到 九宫格
|
64
65
66
67
|
end
role:updateProperty({field = "sudoku", value = sudoku})
|
c59e058b
zhouhaihai
新一批日志记录
|
68
69
70
|
role:log("activity", {
activity_id = id, -- 活动ID(或活动指定任务的ID)
activity_type = 0, -- 活动类型,见活动类型枚举表
|
56c7a1c5
liuzujun
修改报错,下载cv奖励记录字段
|
71
|
activity_reward = reward or {}, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
|
c59e058b
zhouhaihai
新一批日志记录
|
72
|
})
|
f22a33af
zhouhaihai
自己的日志
|
73
|
role:mylog("act_action", {desc = "sudoku", int1 = id, int2 = phase})
|
d763fb14
zhouhaihai
签到 九宫格
|
74
|
|
7bb30dca
zhouhaihai
修改发奖
|
75
|
SendPacket(actionCodes.Activity_sudokuRpc, MsgPack.pack({task = role:packReward(task, tchange), reward = role:packReward(reward, rchange), rId = rId}))
|
d763fb14
zhouhaihai
签到 九宫格
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
return true
end
function _M.sudokuRewardRpc(agent, data)
local role = agent.role
local sudoku = role:getProperty("sudoku")
local phase = sudoku[-1] or 1
local curData = csvdb["guide_sudokuCsv"][phase]
if not curData then return end
if not globalCsv.guide_sudoku_reward[phase] then return end
local curTask = (sudoku.task or {})[phase] or {}
for id, _ in pairs(curData) do
if curTask[id] ~= -1 then
return
end
end
|
7bb30dca
zhouhaihai
修改发奖
|
98
|
local reward, change = role:award(globalCsv.guide_sudoku_reward[phase], {log = {desc = "sudokuRP", int1 = phase}})
|
d763fb14
zhouhaihai
签到 九宫格
|
99
100
101
102
103
104
105
106
107
|
sudoku[-1] = phase + 1
sudoku.task[phase] = nil
if not csvdb["guide_sudokuCsv"][sudoku[-1]] then
sudoku[-1] = -1
sudoku.task = nil
end
role:updateProperty({field = "sudoku", value = sudoku})
|
c59e058b
zhouhaihai
新一批日志记录
|
108
109
110
|
role:log("activity", {
activity_id = 10000 + phase, -- 活动ID(或活动指定任务的ID)
activity_type = 0, -- 活动类型,见活动类型枚举表
|
887c1843
zhouhaihai
日志新一批
|
111
|
activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
|
c59e058b
zhouhaihai
新一批日志记录
|
112
113
|
})
|
7bb30dca
zhouhaihai
修改发奖
|
114
|
SendPacket(actionCodes.Activity_sudokuRewardRpc, MsgPack.pack(role:packReward(reward, change)))
|
d763fb14
zhouhaihai
签到 九宫格
|
115
116
117
118
119
120
121
|
return true
end
function _M.signRpc(agent, data)
local role = agent.role
|
2d07aef9
liuzujun
签到改成4点刷新
|
122
|
local serverT = skynet.timex() - RESET_TIME * 3600
|
d763fb14
zhouhaihai
签到 九宫格
|
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
local tm = os.date("*t", serverT)
local curDay = tm.day
local yearMonth = tm.year * 100 + tm.month
local monthData = csvdb["daily_signInCsv"][yearMonth]
if not monthData or not monthData[curDay] then
return 1
end
local signs = role:getProperty("sign")
if signs[curDay] == yearMonth then -- 未重置的还可以签到正常(本月已经签到)
return 2
end
signs[curDay] = yearMonth
|
3df6d602
liuzujun
添加玩家签到天数字段
|
138
139
|
-- 记录玩家签到天数
role.activity:incrProperty("signInDay", 1)
|
d763fb14
zhouhaihai
签到 九宫格
|
140
|
|
e2e205be
zhangqijia
feat: 玩家等级奖励
|
141
142
143
144
145
146
147
148
|
-- 达到一定等级,签到会有额外奖励
local reward = role:getBnousDaily()
local change
local award = monthData[curDay].item:toNumMap() or {}
for k, v in pairs(award) do
reward[k] = (reward[k] or 0) + v
end
reward, change = role:award(reward, {log = {desc = "sign", int1 = yearMonth, int2 = curDay}})
|
d763fb14
zhouhaihai
签到 九宫格
|
149
|
role:changeUpdates({{type = "sign", field = curDay, value = yearMonth}})
|
e7806e6f
zhouhaihai
签到成就
|
150
|
role:checkTaskEnter("SignIn")
|
d763fb14
zhouhaihai
签到 九宫格
|
151
|
|
dfc732c5
chenyueqi
每日登陆签到,领奖时邮件自动发送
|
152
153
154
|
if monthData[curDay].daily_sign_email ~= "" then
local emails = monthData[curDay].daily_sign_email:toArray(true,"=")
for _, emailId in pairs(emails) do
|
70fb62d1
liuzujun
服务器数据打点
|
155
156
|
--redisproxy:insertEmail({roleId = role:getProperty("id"), emailId = emailId})
role:sendMail(emailId)
|
dfc732c5
chenyueqi
每日登陆签到,领奖时邮件自动发送
|
157
158
159
|
end
end
|
7bb30dca
zhouhaihai
修改发奖
|
160
|
SendPacket(actionCodes.Activity_signRpc, MsgPack.pack(role:packReward(reward, change)))
|
d763fb14
zhouhaihai
签到 九宫格
|
161
162
163
164
|
return true
end
|
ea40710f
zhouhaihai
活动
|
165
166
|
function _M.actSignRpc(agent, data)
local role = agent.role
|
be4e8031
zhouhaihai
活动 拾荒
|
167
|
if not role.activity:isOpen("Sign") then return 1 end
|
ea40710f
zhouhaihai
活动
|
168
169
|
local curData = role.activity:getActData("Sign")
|
7bb30dca
zhouhaihai
修改发奖
|
170
|
local reward, change = {}
|
be4e8031
zhouhaihai
活动 拾荒
|
171
|
for day, csvData in ipairs(csvdb["new_signInCsv"]) do
|
ea40710f
zhouhaihai
活动
|
172
173
174
175
176
177
178
179
180
181
182
183
184
|
if day <= (curData[0] or 0) then
if not curData[day] then
curData[day] = -1
-- 奖励
for itemId, count in pairs(csvData.reward:toNumMap()) do
reward[itemId] = (reward[itemId] or 0) + count
end
end
else
break
end
end
if next(reward) then
|
be4e8031
zhouhaihai
活动 拾荒
|
185
|
role.activity:updateActData("Sign", curData)
|
7bb30dca
zhouhaihai
修改发奖
|
186
|
reward, change = role:award(reward, {log = {desc = "actSign"}})
|
ea40710f
zhouhaihai
活动
|
187
|
end
|
c59e058b
zhouhaihai
新一批日志记录
|
188
189
190
191
|
role:log("activity", {
activity_id = curData[0], -- 活动ID(或活动指定任务的ID)
activity_type = role.activity.ActivityType.Sign, -- 活动类型,见活动类型枚举表
|
887c1843
zhouhaihai
日志新一批
|
192
|
activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
|
c59e058b
zhouhaihai
新一批日志记录
|
193
194
|
})
|
7bb30dca
zhouhaihai
修改发奖
|
195
|
SendPacket(actionCodes.Activity_actSignRpc, MsgPack.pack(role:packReward(reward, change)))
|
ea40710f
zhouhaihai
活动
|
196
197
198
|
return true
end
|
d763fb14
zhouhaihai
签到 九宫格
|
199
|
|
51d9d20b
liuzujun
付费签到,应用市场反馈
|
200
201
202
|
function _M.actPaySignRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
|
460afa6e
liuzujun
付费签到改为主动领取,战斗关卡不一...
|
203
|
local dayIndex = msg.day
|
51d9d20b
liuzujun
付费签到,应用市场反馈
|
204
205
|
local actGoodsFlag = role.storeData:getProperty("actGoodsFlag")
local index = GetActGoodsIndex("paySignIn")
|
460afa6e
liuzujun
付费签到改为主动领取,战斗关卡不一...
|
206
207
|
local ts = actGoodsFlag[index] or 0
if ts == 0 then return 1 end
|
51d9d20b
liuzujun
付费签到,应用市场反馈
|
208
|
|
460afa6e
liuzujun
付费签到改为主动领取,战斗关卡不一...
|
209
210
|
local open, actId = role.activity:isOpen("PaySignIn")
if not open then return 2 end
|
51d9d20b
liuzujun
付费签到,应用市场反馈
|
211
|
|
ede282c0
liuzujun
付费签到规则改为按登录天数计算进度...
|
212
|
--local diffDay = diffFromTs(ts) + 1
|
51d9d20b
liuzujun
付费签到,应用市场反馈
|
213
214
|
local curData = role.activity:getActData("PaySignIn")
|
b1644d3b
liuzujun
付费签到天数bug
|
215
|
if not curData then return 3 end
|
51d9d20b
liuzujun
付费签到,应用市场反馈
|
216
217
|
local reward, change = {}
for day, csvData in ipairs(csvdb["pay_signInCsv"]) do
|
ede282c0
liuzujun
付费签到规则改为按登录天数计算进度...
|
218
|
if day <= (curData[0] or 0) and day == dayIndex then
|
51d9d20b
liuzujun
付费签到,应用市场反馈
|
219
220
221
222
223
224
225
|
if not curData[day] then
curData[day] = 1
-- 奖励
for itemId, count in pairs(csvData.reward:toNumMap()) do
reward[itemId] = (reward[itemId] or 0) + count
end
end
|
460afa6e
liuzujun
付费签到改为主动领取,战斗关卡不一...
|
226
227
|
--else
-- break
|
51d9d20b
liuzujun
付费签到,应用市场反馈
|
228
229
230
231
232
233
234
235
|
end
end
if next(reward) then
role.activity:updateActData("PaySignIn", curData)
reward, change = role:award(reward, {log = {desc = "actPaySign"}})
end
role:log("activity", {
|
460afa6e
liuzujun
付费签到改为主动领取,战斗关卡不一...
|
236
|
activity_id = actId, -- 活动ID(或活动指定任务的ID)
|
51d9d20b
liuzujun
付费签到,应用市场反馈
|
237
238
239
240
241
242
243
|
activity_type = role.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表
activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
})
SendPacket(actionCodes.Activity_actPaySignRpc, MsgPack.pack(role:packReward(reward, change)))
return true
end
|
d763fb14
zhouhaihai
签到 九宫格
|
244
|
|
4bd3095f
liuzujun
英雄帖任务bug
|
245
|
function _M.actCalendaTaskRpc(agent, data)
|
190e1415
liuzujun
英雄帖活动初始化
|
246
247
248
|
local role = agent.role
local msg = MsgPack.unpack(data)
local taskId = msg.id
|
4bd3095f
liuzujun
英雄帖任务bug
|
249
|
local calTask = role:getProperty("calTask") or {}
|
190e1415
liuzujun
英雄帖活动初始化
|
250
251
252
253
254
255
256
257
|
local record = calTask["r"] or {}
local flag = record[taskId] or 0
if flag == 1 then return 1 end
local open, actId = role.activity:isOpen("CalendaTask")
local actData = csvdb["activity_ctrlCsv"][actId]
if not open then return 2 end
if not actData then return 3 end
|
4bd3095f
liuzujun
英雄帖任务bug
|
258
259
260
261
262
|
local taskList = csvdb["activity_taskCsv"][actData.condition]
if not taskList then return 4 end
local taskCfg = taskList[taskId]
if not taskCfg then return 5 end
if taskCfg.key ~= actData.condition then return 6 end
|
190e1415
liuzujun
英雄帖活动初始化
|
263
|
|
4bd3095f
liuzujun
英雄帖任务bug
|
264
|
if (calTask[taskId] or 0) < taskCfg.condition1 then return 7 end
|
190e1415
liuzujun
英雄帖活动初始化
|
265
266
267
268
|
record[taskId] = 1
calTask["r"] = record
|
4bd3095f
liuzujun
英雄帖任务bug
|
269
|
role:updateProperty({field = "calTask", value = calTask})
|
190e1415
liuzujun
英雄帖活动初始化
|
270
|
|
4bd3095f
liuzujun
英雄帖任务bug
|
271
|
local reward, change = role:award(taskCfg.reward, {log = {desc = "calendaTask"}})
|
190e1415
liuzujun
英雄帖活动初始化
|
272
273
274
275
276
277
278
|
role:log("activity", {
activity_id = taskId, -- 活动ID(或活动指定任务的ID)
activity_type = role.activity.ActivityType.CalendaTask, -- 活动类型,见活动类型枚举表
activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
})
|
f76d63e1
liuzujun
联动任务活动
|
279
280
|
role:checkTaskEnter("FinishSpeTask", {taskId = taskId, actId = actId})
|
190e1415
liuzujun
英雄帖活动初始化
|
281
|
SendPacket(actionCodes.Activity_actCalendaTaskRpc, MsgPack.pack(role:packReward(reward, change)))
|
f76d63e1
liuzujun
联动任务活动
|
282
|
|
4bd3095f
liuzujun
英雄帖任务bug
|
283
|
return true
|
190e1415
liuzujun
英雄帖活动初始化
|
284
285
|
end
|
dfa9ae5e
liuzujun
战令任务活动
|
286
|
function _M.actBattleCommandTaskRpc(agent, data)
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
287
288
289
|
local role = agent.role
local msg = MsgPack.unpack(data)
local taskId = msg.id
|
dfa9ae5e
liuzujun
战令任务活动
|
290
|
local calTask = role:getProperty("bcTask") or {}
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
291
292
293
|
local record = calTask["r"] or {}
local flag = record[taskId] or 0
if flag == 1 then return 1 end
|
dfa9ae5e
liuzujun
战令任务活动
|
294
|
local open, actId = role.activity:isOpen("BattleCommandTask")
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
295
296
297
298
299
300
301
302
303
304
305
306
|
local actData = csvdb["activity_ctrlCsv"][actId]
if not open then return 2 end
if not actData then return 3 end
local taskList = csvdb["activity_taskCsv"][actData.condition]
if not taskList then return 4 end
local taskCfg = taskList[taskId]
if not taskCfg then return 5 end
if taskCfg.key ~= actData.condition then return 6 end
if (calTask[taskId] or 0) < taskCfg.condition1 then return 7 end
|
dfa9ae5e
liuzujun
战令任务活动
|
307
308
309
310
311
312
|
local open, actId = role.activity:isOpen("BattleCommand")
local actData = csvdb["activity_ctrlCsv"][actId]
if not open then return 2 end
if not actData then return 3 end
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
313
314
315
|
record[taskId] = 1
calTask["r"] = record
|
dfa9ae5e
liuzujun
战令任务活动
|
316
|
role:updateProperty({field = "bcTask", value = calTask})
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
317
|
|
37502372
zhangqijia
feat: 付费战令每日任务获得额...
|
318
319
320
321
322
323
324
325
326
327
328
329
|
local rechargeRecord = role.storeData:getProperty("payR") or {}
local recordFlag = false
for _, id in ipairs(taskCfg.battlepass_id:toArray(true, "=")) do
if rechargeRecord[id] then
local cfg = csvdb["shop_rechargeCsv"][id]
if cfg and cfg.shop == 2 and cfg.type == CardType.ActBattleCommandCard then
recordFlag = true
break
end
end
end
|
dcf40771
zhangqijia
fix: 战令奖励领取的bug
|
330
|
local taskReward
|
37502372
zhangqijia
feat: 付费战令每日任务获得额...
|
331
|
if recordFlag then
|
dcf40771
zhangqijia
fix: 战令奖励领取的bug
|
332
333
|
-- recordFlag = true时,taskCfg.reward 只会有经验奖励
taskReward = {}
|
37502372
zhangqijia
feat: 付费战令每日任务获得额...
|
334
335
336
337
|
for k, v in pairs(taskCfg.reward:toNumMap()) do
taskReward[k] = (taskReward[k] or 0) + v + taskCfg.battlepass_reward
break
end
|
dcf40771
zhangqijia
fix: 战令奖励领取的bug
|
338
339
|
else
taskReward = taskCfg.reward
|
37502372
zhangqijia
feat: 付费战令每日任务获得额...
|
340
341
342
|
end
local reward, change = role:award(taskReward, {log = {desc = "battleCommandTask"}})
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
343
344
345
|
role:log("activity", {
activity_id = taskId, -- 活动ID(或活动指定任务的ID)
|
dfa9ae5e
liuzujun
战令任务活动
|
346
|
activity_type = role.activity.ActivityType.BattleCommandTask, -- 活动类型,见活动类型枚举表
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
347
348
|
activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
})
|
70fb62d1
liuzujun
服务器数据打点
|
349
|
role:mylog("act_action", {desc="bcTask", int1=taskId, int2=taskCfg.resetType})
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
350
351
352
|
role:checkTaskEnter("FinishSpeTask", {taskId = taskId, actId = actId})
|
dfa9ae5e
liuzujun
战令任务活动
|
353
|
SendPacket(actionCodes.Activity_actBattleCommandTaskRpc, MsgPack.pack(role:packReward(reward, change)))
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
354
355
356
357
|
return true
end
|
78e5b90e
liuzujun
完成需求:新玩家任务
|
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
|
function _M.actNewUserTaskRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local taskId = msg.id
local calTask = role:getProperty("nbTask") or {}
local record = calTask["r"] or {}
local flag = record[taskId] or 0
if flag == 1 then return 1 end
local open, actId = role.activity:isOpen("NewUserTask")
local actData = csvdb["activity_ctrlCsv"][actId]
if not open then return 2 end
if not actData then return 3 end
local taskList = csvdb["activity_taskCsv"][actData.condition]
if not taskList then return 4 end
local taskCfg = taskList[taskId]
if not taskCfg then return 5 end
if taskCfg.key ~= actData.condition then return 6 end
if (calTask[taskId] or 0) < taskCfg.condition1 then return 7 end
record[taskId] = 1
calTask["r"] = record
role:updateProperty({field = "nbTask", value = calTask})
local reward, change = role:award(taskCfg.reward, {log = {desc = "newUserTask"}})
role:log("activity", {
activity_id = taskId, -- 活动ID(或活动指定任务的ID)
activity_type = role.activity.ActivityType.NewUserTask, -- 活动类型,见活动类型枚举表
activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
})
role:checkTaskEnter("FinishSpeTask", {taskId = taskId, actId = actId})
SendPacket(actionCodes.Activity_actNewUserTaskRpc, MsgPack.pack(role:packReward(reward, change)))
return true
end
|
847f9a7b
liuzujun
兑换活动,邮件内容修改
|
399
400
401
402
403
|
function _M.exchangeRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
local id = msg.id
|
686d4fd6
liuzujun
兑换活动支持兑换多个, 新增卡池
|
404
405
|
local count = msg.count
if not role.activity:isOpenById(actid, "Exchange") then return 1 end
|
847f9a7b
liuzujun
兑换活动,邮件内容修改
|
406
407
408
409
410
411
412
413
|
local exchangeCfg = csvdb["activity_exchangeCsv"][actid]
if not exchangeCfg then return 2 end
if not exchangeCfg[id] then return 3 end
local curData = role.activity:getActData("Exchange") or {}
local exchangeData = curData[actid] or {}
local curCount = exchangeData[id] or 0
local actCfg = exchangeCfg[id]
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
414
|
local limitArr = actCfg.limit:toArray(true, "=")
|
686d4fd6
liuzujun
兑换活动支持兑换多个, 新增卡池
|
415
|
if curCount + count > limitArr[2] then return 4 end
|
847f9a7b
liuzujun
兑换活动,邮件内容修改
|
416
417
|
local costs = actCfg.goods:toNumMap()
|
686d4fd6
liuzujun
兑换活动支持兑换多个, 新增卡池
|
418
419
420
|
for k,v in pairs(costs) do
costs[k] = v * count
end
|
847f9a7b
liuzujun
兑换活动,邮件内容修改
|
421
422
423
|
if not role:checkItemEnough(costs) then return 5 end
role:costItems(costs, {log = {desc = "actExchange", int1 = actid, int2 = id}})
|
686d4fd6
liuzujun
兑换活动支持兑换多个, 新增卡池
|
424
|
curCount = curCount + count
|
847f9a7b
liuzujun
兑换活动,邮件内容修改
|
425
426
427
428
|
exchangeData[id] = curCount
curData[actid] = exchangeData
role.activity:updateActData("Exchange", curData)
|
0163328c
liuzujun
修改活动boss关卡三星条件
|
429
430
431
432
433
434
|
local award = actCfg.award:toNumMap()
for k,v in pairs(award) do
award[k] = v * count
end
local reward, change = role:award(award, {log = {desc = "actExchange", int1 = actid, int2 = id}})
|
847f9a7b
liuzujun
兑换活动,邮件内容修改
|
435
436
437
438
439
440
|
SendPacket(actionCodes.Activity_exchangeRpc, MsgPack.pack(role:packReward(reward, change)))
return true
end
|
b8b1c164
liuzujun
扭蛋活动,万能碎片bug
|
441
442
443
444
|
function _M.gachakonRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
445
446
447
448
|
local count = msg.count
if count > 10 then return end
|
686d4fd6
liuzujun
兑换活动支持兑换多个, 新增卡池
|
449
|
if not role.activity:isOpenById(actid, "Gachakon") then return 1 end
|
b8b1c164
liuzujun
扭蛋活动,万能碎片bug
|
450
|
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
451
452
453
454
|
local actCtrlData = csvdb["activity_ctrlCsv"][actid]
if not actCtrlData then return 2 end
local cost = actCtrlData.condition2:toNumMap()
|
b8b1c164
liuzujun
扭蛋活动,万能碎片bug
|
455
|
local actCfg = csvdb["activity_capsuleToysCsv"][actid]
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
456
457
|
if not actCfg then return 3 end
|
b8b1c164
liuzujun
扭蛋活动,万能碎片bug
|
458
|
local gachakonInfo = role.activity:getActData("Gachakon") or {}
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
459
460
|
local award = {}
local remain = 0
|
6a2b449c
liuzujun
扭蛋机奖励不合并显示, 新增多队挂...
|
461
|
local showAward = {}
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
462
|
for i = 1, count do
|
1be743f3
liuzujun
扭蛋机调试
|
463
464
|
local tmpCfg = clone(actCfg)
remain = 0
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
465
466
|
for id, cfg in pairs(tmpCfg) do
local num = gachakonInfo[id] or 0
|
1be743f3
liuzujun
扭蛋机调试
|
467
468
|
num = cfg.amount >= num and cfg.amount - num or 0
cfg.weight = cfg.weight * num
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
469
|
if cfg.weight > 0 then
|
1be743f3
liuzujun
扭蛋机调试
|
470
|
remain = remain + num
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
471
|
end
|
66fe093a
liuzujun
元旦关卡活动
|
472
|
--print("num ".. num, id, cfg.weight, cfg.amount)
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
473
|
end
|
1be743f3
liuzujun
扭蛋机调试
|
474
|
if remain == 0 then
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
475
476
477
|
break
end
local id = math.randWeight(tmpCfg, "weight")
|
1be743f3
liuzujun
扭蛋机调试
|
478
|
if not id then return 4 end
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
479
480
|
gachakonInfo[id] = (gachakonInfo[id] or 0) + 1
local curAward = tmpCfg[id].award:toNumMap()
|
6a2b449c
liuzujun
扭蛋机奖励不合并显示, 新增多队挂...
|
481
|
table.insert(showAward, curAward)
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
482
483
|
for k, v in pairs(curAward) do
award[k] = (award[k] or 0) + v
|
b8b1c164
liuzujun
扭蛋活动,万能碎片bug
|
484
|
end
|
b8b1c164
liuzujun
扭蛋活动,万能碎片bug
|
485
|
end
|
b8b1c164
liuzujun
扭蛋活动,万能碎片bug
|
486
|
|
1be743f3
liuzujun
扭蛋机调试
|
487
488
489
490
491
|
for k, v in pairs(cost) do
cost[k] = v * count
end
if not role:checkItemEnough(cost) then return 5 end
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
492
493
|
role:costItems(cost, {log = {desc = "actGachakon", int1 = actid, int2 = count}})
|
b8b1c164
liuzujun
扭蛋活动,万能碎片bug
|
494
|
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
495
|
local reward, change = role:award(award, {log = {desc = "actGachakon", int1 = actid, int2 = count}})
|
66fe093a
liuzujun
元旦关卡活动
|
496
497
|
--print("-----------", remain, count)
if remain <= 1 then
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
498
|
gachakonInfo = {}
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
499
|
end
|
b8b1c164
liuzujun
扭蛋活动,万能碎片bug
|
500
501
|
role.activity:updateActData("Gachakon", gachakonInfo)
|
6a2b449c
liuzujun
扭蛋机奖励不合并显示, 新增多队挂...
|
502
|
SendPacket(actionCodes.Activity_gachakonRpc, MsgPack.pack(showAward))
|
b8b1c164
liuzujun
扭蛋活动,万能碎片bug
|
503
504
505
|
return true
end
|
386cd4c1
zhangqijia
feat: 狩猎祭,增加重置扭蛋机协议
|
506
507
508
509
510
511
512
513
514
515
516
517
518
519
|
function _M.resetGachakonRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
if not role.activity:isOpenById(actid, "Gachakon") then return 1 end
if role.activity:isResetById(actid, "Gachakon") then return 2 end
role.activity:resetActDataById(actid)
SendPacket(actionCodes.Activity_resetGachakonRpc, MsgPack.pack({}))
return true
end
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
520
521
522
523
|
function _M.hangDropRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
|
686d4fd6
liuzujun
兑换活动支持兑换多个, 新增卡池
|
524
|
if not role.activity:isOpenById(actid, "HangDrop") then return 1 end
|
6662e7d2
liuzujun
掉落活动配置最大掉落周期数
|
525
526
|
local actCtrlData = csvdb["activity_ctrlCsv"][actid]
if not actCtrlData then return end
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
|
local actCfg = csvdb["activity_putCsv"][actid]
if not actCfg then return 2 end
local award, period = "", 0
for i = 1, #actCfg do
local cfg = actCfg[i]
if not cfg then
break
end
if cfg.condition ~= "" then
local arr = cfg.condition:toArray(true, "=")
local type = arr[1]
if type == 1 then
local actId = arr[2]
local carbonId = arr[3]
|
0163328c
liuzujun
修改活动boss关卡三星条件
|
543
|
if not role.activity:isOpenById(actId, "ChallengeLevel") then return 3 end
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
|
local clInfo = role.activity:getActData("ChallengeLevel") or {}
if not clInfo[carbonId] then
break
end
end
end
award = cfg.reward
period = cfg.period * 60
end
local actData = role.activity:getActData("HangDrop") or 0
local timeNow = skynet.timex()
if period == 0 or award == "" then
return 4
end
local num = math.floor((timeNow - actData)/ period)
|
6662e7d2
liuzujun
掉落活动配置最大掉落周期数
|
559
|
num = num > actCtrlData.condition and actCtrlData.condition or num
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
560
561
562
563
564
565
566
567
568
569
|
if num == 0 then
return 5
end
local reward, change = {}, nil
for id, value in pairs(award:toNumMap()) do
reward[id] = value * num
end
reward, change = role:award(reward, {log = {desc = "actHangDrop", int1 = actid, int2 = num}})
|
576c791c
liuzujun
玛尼英雄帖活动通过任务bug 元旦...
|
570
571
572
573
574
575
576
|
if num < 8 then
actData = actData + num * period
else
actData = timeNow
end
role.activity:updateActData("HangDrop", actData)
|
2bc706ab
liuzujun
兑换活动重置,累充功能
|
577
578
579
580
581
582
|
SendPacket(actionCodes.Activity_hangDropRpc, MsgPack.pack(role:packReward(reward, change)))
return true
end
|
66fe093a
liuzujun
元旦关卡活动
|
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
|
local function getStarCount(cfg, data)
local count = 0
for i = 0, #(cfg.sweep_condition:toTableArray(true)) do
if (1 << i & data) > 0 then
count = count + 1
end
end
return count
end
function _M.startBattleRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
local id = msg.id
local count = msg.count
|
686d4fd6
liuzujun
兑换活动支持兑换多个, 新增卡池
|
600
|
if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end
|
66fe093a
liuzujun
元旦关卡活动
|
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
|
local actCfg = csvdb["activity_battleCsv"][actid]
if not actCfg then return 2 end
local battleCfg = actCfg[id]
if not battleCfg then return 3 end
local actData = role.activity:getActData("ChallengeLevel") or {}
local preArr = battleCfg.prepose:toArray(true, "=")
for _, v in ipairs(preArr) do
local battleInfo = actData[v]
if not battleInfo then
return 4
end
local star = battleInfo["star"] or 0
if star <= 0 then
return 4
end
end
-- check cost
local changeFlag = false
local ticket = actData["ticket"]
|
8e892c71
liuzujun
挑战关卡活动打完再扣门票
|
624
|
local num = 0 -- cost num
|
66fe093a
liuzujun
元旦关卡活动
|
625
|
if battleCfg.type ~= "" then
|
576c791c
liuzujun
玛尼英雄帖活动通过任务bug 元旦...
|
626
|
role.activity:getBattleTicket(actid)
|
8e892c71
liuzujun
挑战关卡活动打完再扣门票
|
627
|
num = battleCfg.type:toArray(true, "=")[3]
|
66fe093a
liuzujun
元旦关卡活动
|
628
|
if count and count > 0 then
|
50da0e37
liuzujun
挑战关卡活动 普通关卡扫荡,购买挑战次数
|
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
|
if battleCfg.rank ~= 0 then
local bi = actData[id]
if not bi then return 8 end
local star = bi["star"] or 0
local maxP = bi["maxP"] or 0
-- 世界boss
if battleCfg.worldBoss_award ~= 0 then
if maxP < 1 then
return 9
end
else
if star < 1 then
return 9
end
end
|
66fe093a
liuzujun
元旦关卡活动
|
644
|
end
|
50da0e37
liuzujun
挑战关卡活动 普通关卡扫荡,购买挑战次数
|
645
|
num = num * count
|
74bb1229
liuzujun
神稀扣门票逻辑修改
|
646
647
|
else
num = 0
|
66fe093a
liuzujun
元旦关卡活动
|
648
649
650
651
|
end
if ticket < num then
return 6
end
|
66fe093a
liuzujun
元旦关卡活动
|
652
653
|
changeFlag = true
end
|
be697585
liuzujun
活动剧情解锁
|
654
655
|
-- 解锁活动剧情
role:checkStoryStatus(false, 5, id)
|
66fe093a
liuzujun
元旦关卡活动
|
656
657
658
659
660
661
|
if not count then
role.__actBattleCache = {
key = tostring(math.random()),
actid = actid,
id = id,
|
edf2ee12
zhouhaihai
防作弊
|
662
|
format = msg.format,
|
66fe093a
liuzujun
元旦关卡活动
|
663
664
665
666
667
668
|
}
SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack({key = role.__actBattleCache.key}))
else
if count <= 0 then
return
end
|
50da0e37
liuzujun
挑战关卡活动 普通关卡扫荡,购买挑战次数
|
669
|
|
66fe093a
liuzujun
元旦关卡活动
|
670
|
local bi = actData[id]
|
3e80ee56
liuzujun
世界boss行动点bug
|
671
|
local star = bi["star"] or 0
|
66fe093a
liuzujun
元旦关卡活动
|
672
|
local award = battleCfg.item_clear:toNumMap()
|
d4876585
liuzujun
神稀活动普通关卡扫荡不给三星奖励,...
|
673
674
675
676
677
678
679
680
681
|
if battleCfg.rank ~= 0 then
if getStarCount(battleCfg, star) == 3 then
local aw = battleCfg.perfect_reward:toNumMap()
for k, v in pairs(aw) do
award[k] = (award[k] or 0) + v
end
end
end
|
66fe093a
liuzujun
元旦关卡活动
|
682
683
684
685
|
for k, v in pairs(award) do
award[k] = v * count
end
local reward, change = role:award(award, {log = {desc = "actBattle", int1 = actid, int2 = count or 0}})
|
cd90db08
liuzujun
神稀购买门票协议顺序修改
|
686
|
|
50da0e37
liuzujun
挑战关卡活动 普通关卡扫荡,购买挑战次数
|
687
688
|
changeFlag = true
actData["ticket"] = ticket - num
|
66fe093a
liuzujun
元旦关卡活动
|
689
|
|
50da0e37
liuzujun
挑战关卡活动 普通关卡扫荡,购买挑战次数
|
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
|
if battleCfg.rank ~= 0 then
if battleCfg.worldBoss_award ~= 0 and (bi["maxP"] or 0) > 0 then
bi["bossP"] = (bi["bossP"] or 0) + bi["maxP"] * count
end
bi["sum"] = bi["sum"] + bi["top"] * count
actData[id] = bi
local rankVal = 0
if battleCfg.rank == 1 then
rankVal = bi["sum"]
elseif battleCfg.rank == 2 then
rankVal = bi["top"]
end
role:updateRankCommon(RANK_TYPE.ActBattleBoss, rankVal)
|
34d9f192
liuzujun
世界boss 胜利才扣门票,扫荡根...
|
705
|
end
|
cd90db08
liuzujun
神稀购买门票协议顺序修改
|
706
|
role.activity:updateActData("ChallengeLevel", actData)
|
34d9f192
liuzujun
世界boss 胜利才扣门票,扫荡根...
|
707
|
|
cd90db08
liuzujun
神稀购买门票协议顺序修改
|
708
709
710
|
SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack(role:packReward(reward, change)))
return true
|
66fe093a
liuzujun
元旦关卡活动
|
711
|
end
|
cd90db08
liuzujun
神稀购买门票协议顺序修改
|
712
713
714
|
--if changeFlag then
-- role.activity:updateActData("ChallengeLevel", actData)
--end
|
66fe093a
liuzujun
元旦关卡活动
|
715
716
717
718
719
720
721
722
723
724
725
726
727
|
return true
end
function _M.endBattleRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
local id = msg.id
local key = msg.key
local isWin = msg.isWin
local heros = msg.heros
local support = msg.support
|
1c1ea691
liuzujun
活动战斗结束不发送战斗奖励
|
728
729
730
731
|
if not role.activity:isOpenById(actid, "ChallengeLevel") then
SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({}))
return true
end
|
66fe093a
liuzujun
元旦关卡活动
|
732
733
734
735
736
737
738
|
if not role.__actBattleCache then return 2 end
if role.__actBattleCache.id ~= id or role.__actBattleCache.key ~= key and role.__actBattleCache.actid ~= actid then
SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({errorCode = 1}))
end
|
edf2ee12
zhouhaihai
防作弊
|
739
740
741
742
743
744
745
|
-- 防作弊
if not role:checkBattleCheat("act_battle", {
id = id,
isWin = isWin,
info = msg.info,
format = role.__actBattleCache.format
}) then
|
4083e99a
zhouhaihai
可能的报错点
|
746
|
SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({errorCode = 1}))
|
edf2ee12
zhouhaihai
防作弊
|
747
748
749
750
|
return true
end
role.__actBattleCache = nil
|
66fe093a
liuzujun
元旦关卡活动
|
751
752
753
754
755
756
757
758
|
local actCfg = csvdb["activity_battleCsv"][actid]
if not actCfg then return 3 end
local battleCfg = actCfg[id]
if not battleCfg then return 4 end
local actData = role.activity:getActData("ChallengeLevel") or {}
|
0163328c
liuzujun
修改活动boss关卡三星条件
|
759
760
761
762
763
764
765
766
|
-- 总输出
local dmg = 0
for k, v in pairs(msg.info.damage) do
if k % 100 == 2 then
dmg = dmg + v
end
end
|
66fe093a
liuzujun
元旦关卡活动
|
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
|
local reward, change = {}, nil
local battleInfo = actData[id] or {}
local curStar = 0
if isWin then
local herosInfo = msg.heros
local check = {}
-- 1 通关
check[1] = function(_)
return true
end
-- 2 阵亡人数 <= N
check[2] = function(_, cond)
return msg.info.dead and msg.info.dead <= cond
end
-- 3 全员存活
check[3] = function(_)
return msg.info.dead and msg.info.dead == 0
end
-- 4 指定种族 >= N
check[4] = function(_, cond)
local count = 0
for _, one in pairs(herosInfo) do
local heroData = csvdb["unitCsv"][one.type]
if heroData.camp == cond then
count = count + 1
end
end
return count >= cond
end
-- 5 指定职业 >= N
check[5] = function(_, cond)
local count = 0
for _, one in pairs(herosInfo) do
local heroData = csvdb["unitCsv"][one.type]
if heroData.job == cond then
count = count + 1
end
end
return count >= cond
end
-- 6 含有指定角色
check[6] = function(_, cond)
for _, one in pairs(herosInfo) do
if one.type == cond then
return true
end
end
return false
end
-- 7 通关耗时 <= X 秒 msg.info.atime
check[7] = function(_, cond)
return msg.info.atime and msg.info.atime <= cond
end
|
0163328c
liuzujun
修改活动boss关卡三星条件
|
822
823
824
825
|
-- 8 总输出值 msg.info.atime
check[8] = function(_, cond)
return dmg >= cond
end
|
66fe093a
liuzujun
元旦关卡活动
|
826
827
828
829
830
831
|
curStar = 0
local sweepConds = battleCfg.sweep_condition:toTableArray(true)
for i, cond in ipairs(sweepConds) do
if check[cond[1]] and check[cond[1]](table.unpack(cond)) then
curStar = curStar + (1 << (i - 1))
end
|
7b570ef2
liuzujun
新春活动任务
|
832
833
834
|
end
role:checkTaskEnter("ActBattlePass", {chapterId = id})
|
0163328c
liuzujun
修改活动boss关卡三星条件
|
835
836
837
838
839
|
else
curStar = 0
if battleCfg.rank ~= 0 then
curStar = 1
end
|
66fe093a
liuzujun
元旦关卡活动
|
840
841
842
843
844
845
|
end
local oldStarNum = getStarCount(battleCfg, battleInfo["star"] or 0)
local newStarNum = getStarCount(battleCfg, curStar)
if newStarNum > oldStarNum then
battleInfo["star"] = curStar
end
|
d85ecb3f
liuzujun
神稀祭消耗门票bug
|
846
847
|
if battleCfg.rank ~= 0 and isWin then
|
74bb1229
liuzujun
神稀扣门票逻辑修改
|
848
849
850
851
852
853
|
if battleCfg.type ~= "" then
-- 消耗门票
role.activity:getBattleTicket(actid)
local num = battleCfg.type:toArray(true, "=")[3]
actData["ticket"] = math.max(actData["ticket"] - num, 0)
end
|
8e892c71
liuzujun
挑战关卡活动打完再扣门票
|
854
|
|
66fe093a
liuzujun
元旦关卡活动
|
855
|
-- 更新排行榜 最高伤害
|
66fe093a
liuzujun
元旦关卡活动
|
856
857
858
859
860
861
862
863
864
865
866
867
|
battleInfo["top"] = math.max(battleInfo["top"] or 0, dmg)
battleInfo["sum"] = (battleInfo["sum"] or 0) + dmg
local rankVal = 0
if battleCfg.rank == 1 then
rankVal = battleInfo["sum"]
elseif battleCfg.rank == 2 then
rankVal = battleInfo["top"]
end
if rankVal > 0 then
role:updateRankCommon(RANK_TYPE.ActBattleBoss, rankVal)
end
end
|
66fe093a
liuzujun
元旦关卡活动
|
868
|
|
598bd73f
liuzujun
关卡挑战活动奖励错误bug
|
869
|
if (oldStarNum == 0 and newStarNum > 0) or battleCfg.rank ~= 0 then
|
66fe093a
liuzujun
元旦关卡活动
|
870
871
|
reward = battleCfg.item_clear:toNumMap()
end
|
0163328c
liuzujun
修改活动boss关卡三星条件
|
872
|
if (oldStarNum < 3 and newStarNum == 3) or (battleCfg.rank ~= 0 and newStarNum == 3) then
|
66fe093a
liuzujun
元旦关卡活动
|
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
|
local aw = battleCfg.perfect_reward:toNumMap()
for k, v in pairs(aw) do
reward[k] = (reward[k] or 0) + v
end
end
role:checkBattle("act_battle", {
cfg = battleCfg,
star = newStarNum,
isWin = isWin,
info = msg.info,
reward = reward,
heros = heros,
supports = support,
})
|
be697585
liuzujun
活动剧情解锁
|
889
890
891
892
893
|
-- 解锁活动剧情
if newStarNum >= 3 then
role:checkStoryStatus(false, 5, id)
end
|
6857a37f
liuzujun
世界Boss 增加行动点
|
894
895
|
if battleCfg.worldBoss_award ~= 0 and msg.point then
battleInfo["bossP"] = (battleInfo["bossP"] or 0) + msg.point
|
34d9f192
liuzujun
世界boss 胜利才扣门票,扫荡根...
|
896
|
battleInfo["maxP"] = math.max(msg.point, (battleInfo["maxP"] or 0))
|
6857a37f
liuzujun
世界Boss 增加行动点
|
897
|
end
|
ede282c0
liuzujun
付费签到规则改为按登录天数计算进度...
|
898
899
|
actData[id] = battleInfo
role.activity:updateActData("ChallengeLevel", actData)
|
6857a37f
liuzujun
世界Boss 增加行动点
|
900
|
|
66fe093a
liuzujun
元旦关卡活动
|
901
902
903
904
905
906
907
908
909
910
911
912
913
914
|
reward, change = role:award(reward, {log = {desc = "actBattle", int1 = actid, int2 = newStarNum}})
SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({
reward = reward,
change = change
}))
return true
end
function _M.battleRankRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
|
161c50cc
zhouhaihai
宝藏怪活动
|
915
916
917
918
919
920
|
local cfg = csvdb["activity_ctrlCsv"][actid]
if not cfg then return 1 end
if not role.activity:isOpen(cfg.showType) then return 2 end
local actTypeToRank = {
[role.activity.ActivityType.ChallengeLevel] = RANK_TYPE.ActBattleBoss,
[role.activity.ActivityType.Crisis] = RANK_TYPE.ActCrisis,
|
0769908c
zhangqijia
feat: 常规世界boss
|
921
|
[role.activity.ActivityType.RegularWorldBoos] = RANK_TYPE.RegularWorldBoos,
|
161c50cc
zhouhaihai
宝藏怪活动
|
922
923
924
|
}
if not actTypeToRank[cfg.showType] then return end
local rankInfo = role:getRankInfoCommon(actTypeToRank[cfg.showType])
|
66fe093a
liuzujun
元旦关卡活动
|
925
926
927
928
929
930
931
932
933
934
935
|
SendPacket(actionCodes.Activity_battleRankRpc, MsgPack.pack(rankInfo))
return true
end
function _M.battleMilestoneRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
local id = msg.id
local index = msg.index
|
686d4fd6
liuzujun
兑换活动支持兑换多个, 新增卡池
|
936
|
if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end
|
66fe093a
liuzujun
元旦关卡活动
|
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
|
local actCfg = csvdb["activity_mileageCsv"][actid]
if not actCfg then return 3 end
local mileCfg = actCfg[index]
if not mileCfg then return 4 end
local actData = role.activity:getActData("ChallengeLevel") or {}
local battleInfo = actData[id] or {}
local val = 0
if mileCfg.type == 1 then
val = battleInfo["sum"] or 0
elseif mileCfg.type == 2 then
val = battleInfo["top"] or 0
end
local record = battleInfo["r"] or ""
local flag = string.char(string.getbit(record, index))
if flag == "1" then return 5 end
if mileCfg.condition > val then return 6 end
battleInfo["r"] = string.setbit(record, index)
actData[id] = battleInfo
role.activity:updateActData("ChallengeLevel", actData)
local award = mileCfg.reward:toNumMap()
local reward, change = role:award(award, {log = {desc = "actMilestone", int1 = actid, int2 = index}})
SendPacket(actionCodes.Activity_battleMilestoneRpc, MsgPack.pack(role:packReward(reward, change)))
return true
end
|
161c50cc
zhouhaihai
宝藏怪活动
|
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
|
function _M.crisisMilestoneRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
local id = msg.id
if not role.activity:isOpenById(actid, "Crisis") then return 1 end
local actCfg = csvdb["activity_mileageCsv"][actid]
if not actCfg then return 3 end
local curCsv = actCfg[id]
if not curCsv then return 4 end
if role:getItemCount(ItemId.CrisisScore) < curCsv.condition then
return 5
end
local actData = role.activity:getActData("Crisis") or {}
actData.score = actData.score or {}
if actData.score[id] then
return 6
end
actData.score[id] = -1
role.activity:updateActData("Crisis", actData)
|
558c9044
zhouhaihai
物资危机
|
992
993
|
local reward, change = role:award(curCsv.reward, {log = {desc = "actMilecrisis", int1 = actid}})
|
161c50cc
zhouhaihai
宝藏怪活动
|
994
995
996
997
998
|
SendPacket(actionCodes.Activity_crisisMilestoneRpc, MsgPack.pack(role:packReward(reward, change)))
return true
end
|
be697585
liuzujun
活动剧情解锁
|
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
|
function _M.bossRewardRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
local id = msg.id
local index = msg.index
if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end
local actCfg = csvdb["activity_battleCsv"][actid]
if not actCfg then return 2 end
local battleCfg = actCfg[id]
if not battleCfg then return 3 end
|
eb5ffd1c
liuzujun
世界boss翻牌奖励 活动卡池保底...
|
1014
|
if battleCfg.worldBoss_award == 0 then return 4 end
|
be697585
liuzujun
活动剧情解锁
|
1015
|
|
eb5ffd1c
liuzujun
世界boss翻牌奖励 活动卡池保底...
|
1016
1017
1018
1019
1020
|
actCfg = csvdb["activity_wordboss_awardCsv"][battleCfg.worldBoss_award]
if not actCfg then return 5 end
local awardCfg = actCfg[index]
if not awardCfg then return 6 end
|
8b6745bf
liuzujun
世界boss行动点奖励领完后重置
|
1021
|
local totalAwardCnt = #actCfg
|
eb5ffd1c
liuzujun
世界boss翻牌奖励 活动卡池保底...
|
1022
1023
1024
1025
1026
1027
1028
1029
|
local preList = awardCfg.condition1:toArray(true, "=")
local actData = role.activity:getActData("ChallengeLevel") or {}
local battleInfo = actData[id] or {}
local bossPoint = battleInfo["bossP"] or 0
if bossPoint < 1 then return 7 end
local bossRecord = battleInfo["bossR"] or ""
|
ede282c0
liuzujun
付费签到规则改为按登录天数计算进度...
|
1030
1031
1032
1033
|
local r = string.char(string.getbit(bossRecord, index))
if r == "1" then
return 9
end
|
eb5ffd1c
liuzujun
世界boss翻牌奖励 活动卡池保底...
|
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
|
local ok = false
if #preList == 0 then
ok = true
else
for _, i in ipairs(preList) do
local flag = string.char(string.getbit(bossRecord, i))
if flag == "1" then
ok = true
break
end
end
end
if not ok then return 8 end
battleInfo["bossR"] = string.setbit(bossRecord, index)
|
8b6745bf
liuzujun
世界boss行动点奖励领完后重置
|
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
|
local allFinish = true
for i = 1, totalAwardCnt do
if string.char(string.getbit(battleInfo["bossR"], i)) == "0" then
allFinish = false
break
end
end
if allFinish then
battleInfo["bossR"] = ""
end
|
ede282c0
liuzujun
付费签到规则改为按登录天数计算进度...
|
1059
|
battleInfo["bossP"] = bossPoint - 1
|
eb5ffd1c
liuzujun
世界boss翻牌奖励 活动卡池保底...
|
1060
1061
1062
1063
1064
1065
|
actData[id] = battleInfo
role.activity:updateActData("ChallengeLevel", actData)
local award = awardCfg.reward:toNumMap()
local reward, change = role:award(award, {log = {desc = "worldBossReward", int1 = actid, int2 = index}})
SendPacket(actionCodes.Activity_bossRewardRpc, MsgPack.pack(role:packReward(reward, change)))
|
be697585
liuzujun
活动剧情解锁
|
1066
1067
1068
|
return true
end
|
ac885527
liuzujun
联动签到活动
|
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
|
function _M.commonSignRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
local index = msg.index
if not role.activity:isOpenById(actid, "CommonSignIn") then return 1 end
local actData = role.activity:getActData("CommonSignIn")
if (actData[0] or 0) < index then
return 2
end
if (actData[index] or 0) == 1 then
return 3
end
local actCfg = csvdb["activity_signInCsv"][actid]
if not actCfg then return 4 end
actCfg = actCfg[index]
if not actCfg then return 5 end
actData[index] = 1
role.activity:updateActData("CommonSignIn", actData)
local award = actCfg.reward:toNumMap()
local reward, change = role:award(award, {log = {desc = "commonSign", int1 = actid, int2 = index}})
SendPacket(actionCodes.Activity_commonSignRpc, MsgPack.pack(role:packReward(reward, change)))
return true
end
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1099
1100
1101
1102
1103
|
function _M.friendHelpRpc(agent, data)
local role = agent.role
local roleId = role:getProperty("id")
local msg = MsgPack.unpack(data)
local oper = tonumber(msg.oper) or -1
|
cab7184b
chenyueqi
活动能量bug
|
1104
1105
1106
|
local award = {}
local result
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1107
|
|
cab7184b
chenyueqi
活动能量bug
|
1108
|
local actid = 37
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1109
|
if not role.activity:isOpenById(actid, "FriendEnergy") then return 1 end
|
0ce1cab5
chenyueqi
好友赠送能量活动bug修复
|
1110
|
if oper < 1 or oper > 4 then return 2 end
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1111
1112
1113
1114
1115
1116
1117
|
local actCsv = csvdb["activity_ctrlCsv"][actid]
local getLimit = actCsv.condition
local gifts = actCsv.condition2:toTableArray(true)
local actData = role.activity:getActData("FriendEnergy") or {}
|
0886d05a
chenyueqi
修改联动好友赠送获得的红点记录和通知
|
1118
|
if oper == 1 then -- 赠送好友能量
|
cab7184b
chenyueqi
活动能量bug
|
1119
|
local giveAE = actData.giveAE or {}
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1120
1121
1122
1123
1124
|
local objId = msg.roleId
local gift = gifts[1]
local ids = {}
if not objId then
|
cab7184b
chenyueqi
活动能量bug
|
1125
1126
|
return 3
end
|
6136eaca
liuzujun
添加好友表
|
1127
|
if not role.friends[objId] then
|
cab7184b
chenyueqi
活动能量bug
|
1128
1129
1130
1131
|
result = 2
end
if giveAE[objId] then
result = 1
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1132
1133
|
end
|
cab7184b
chenyueqi
活动能量bug
|
1134
1135
1136
1137
1138
1139
1140
|
if not result then
giveAE[objId] = 1
award[gift[1]] = gift[2]
redisproxy:sadd(FRIEND_ENERGY:format(objId), roleId)
rpcRole(objId, "SendPacket", actionCodes.Role_notifyNewEvent, MsgPack.pack({events = {actFriendGive = roleId}}))
actData.giveAE = giveAE
end
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1141
1142
1143
|
elseif oper == 2 then -- 收取能量
local objId = msg.roleId
local gift = gifts[2]
|
cab7184b
chenyueqi
活动能量bug
|
1144
|
local getAE = actData.getAE or {}
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1145
1146
1147
|
local limit = actData.limit or 0
if limit >= getLimit then return 4 end
|
cab7184b
chenyueqi
活动能量bug
|
1148
1149
1150
1151
1152
1153
1154
1155
|
if not redisproxy:sismember(FRIEND_ENERGY:format(roleId), objId) then
result = 3
end
if getAE[objId] then
result = 2
end
if limit >= getLimit then
result = 1
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1156
1157
|
end
|
cab7184b
chenyueqi
活动能量bug
|
1158
1159
1160
1161
1162
1163
1164
1165
|
if not result then
limit = limit + 1
getAE[objId] = 1
award[gift[1]] = gift[2]
redisproxy:srem(FRIEND_ENERGY:format(roleId), objId)
actData.limit = limit
actData.getAE = getAE
end
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1166
|
elseif oper == 3 then -- 一键送领全部
|
cab7184b
chenyueqi
活动能量bug
|
1167
1168
|
local giveAE = actData.giveAE or {}
local getAE = actData.getAE or {}
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1169
1170
1171
|
local gift1 = gifts[1]
local gift2 = gifts[2]
local limit = actData.limit or 0
|
cab7184b
chenyueqi
活动能量bug
|
1172
|
local cmd1, cmd2 = 0, 0
|
cab7184b
chenyueqi
活动能量bug
|
1173
1174
1175
1176
1177
1178
1179
|
local members = {}
local temp = redisproxy:smembers(FRIEND_ENERGY:format(roleId))
for _, id in pairs(temp) do
members[tonumber(id)] = 1
end
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1180
|
redisproxy:pipelining(function(red)
|
6136eaca
liuzujun
添加好友表
|
1181
|
for friendId, _ in pairs(role.friends) do
|
cab7184b
chenyueqi
活动能量bug
|
1182
1183
|
if not giveAE[friendId] then
giveAE[friendId] = 1
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1184
1185
|
award[gift1[1]] = (award[gift1[1]] or 0) + gift1[2]
red:sadd(FRIEND_ENERGY:format(friendId), roleId)
|
eba94a09
chenyueqi
修改联动好友赠送活动的消息通知结构
|
1186
|
rpcRole(friendId, "SendPacket", actionCodes.Role_notifyNewEvent, MsgPack.pack({events = {actFriendGive = roleId}}))
|
cab7184b
chenyueqi
活动能量bug
|
1187
|
cmd1 = 2
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1188
1189
|
end
|
cab7184b
chenyueqi
活动能量bug
|
1190
1191
|
if members[friendId] and not getAE[friendId] and limit <= getLimit then
cmd2 = 1
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1192
|
limit = limit + 1
|
cab7184b
chenyueqi
活动能量bug
|
1193
|
getAE[friendId] = 1
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1194
1195
1196
1197
1198
1199
|
award[gift2[1]] = (award[gift2[1]] or 0) + gift2[2]
red:srem(FRIEND_ENERGY:format(roleId), friendId)
end
end
end)
|
cab7184b
chenyueqi
活动能量bug
|
1200
1201
1202
1203
1204
1205
1206
|
local sum = cmd1 + cmd2
if sum == 0 then
result = 3
elseif sum ~= 3 then
result = sum
end
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1207
|
actData.limit = limit
|
cab7184b
chenyueqi
活动能量bug
|
1208
1209
|
actData.giveAE = giveAE
actData.getAE = getAE
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
|
elseif oper == 4 then -- 抽大奖
local magic = actData.magic or 0
local rewards = actData.reward or {}
local rewardCsv = csvdb["activity_orderRewardsCsv"][actid]
local itemId1 = gifts[1][1]
local itemId2 = gifts[2][1]
local level = math.min(magic + 1,#rewardCsv)
local rewardData = rewardCsv[level]
local cost = {[itemId1] = rewardData.condition1, [itemId2] = rewardData.condition2}
if not role:checkItemEnough(cost) then return 7 end
role:costItems(cost, {log = {desc = "actFriendHelp", int1 = actid, int2 = level}})
|
0ce1cab5
chenyueqi
好友赠送能量活动bug修复
|
1225
|
if rewardData.reward ~= "" then
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1226
|
result = 1
|
0ce1cab5
chenyueqi
好友赠送能量活动bug修复
|
1227
|
award = rewardData.reward:toNumMap()
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1228
|
end
|
0ce1cab5
chenyueqi
好友赠送能量活动bug修复
|
1229
|
if rewardData.reward_random ~= "" then
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1230
1231
|
result = 1
local pool = {}
|
0ce1cab5
chenyueqi
好友赠送能量活动bug修复
|
1232
|
for _, temp in pairs(rewardData.reward_random:toArray()) do
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1233
1234
|
table.insert(pool, temp:toArray(true, "="))
end
|
0ce1cab5
chenyueqi
好友赠送能量活动bug修复
|
1235
|
local gift = pool[math.randWeight(pool, 3)]
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1236
1237
1238
1239
1240
|
award[gift[1]] = (award[gift[1]] or 0) + gift[2]
end
rewards[level] = 1
actData.reward = rewards
actData.magic = level
|
0886d05a
chenyueqi
修改联动好友赠送获得的红点记录和通知
|
1241
1242
|
else
return 5
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1243
1244
|
end
|
0886d05a
chenyueqi
修改联动好友赠送获得的红点记录和通知
|
1245
|
local ids = {}
|
0ce1cab5
chenyueqi
好友赠送能量活动bug修复
|
1246
|
local members = {}
|
0ce1cab5
chenyueqi
好友赠送能量活动bug修复
|
1247
1248
1249
1250
1251
|
local temp = redisproxy:smembers(FRIEND_ENERGY:format(roleId))
for _, id in pairs(temp) do
members[tonumber(id)] = 1
end
|
6136eaca
liuzujun
添加好友表
|
1252
|
for id, _ in pairs(role.friends) do
|
0ce1cab5
chenyueqi
好友赠送能量活动bug修复
|
1253
1254
|
if members[id] then
ids[id] = 1
|
0886d05a
chenyueqi
修改联动好友赠送获得的红点记录和通知
|
1255
|
end
|
0ce1cab5
chenyueqi
好友赠送能量活动bug修复
|
1256
1257
|
end
|
0886d05a
chenyueqi
修改联动好友赠送获得的红点记录和通知
|
1258
1259
|
actData.new = ids
|
cab7184b
chenyueqi
活动能量bug
|
1260
1261
|
local reward, change
if next(award) then
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
1262
|
reward, change = role:award(award, {log = {desc = "actFriendHelp", int1 = actid}})
|
cab7184b
chenyueqi
活动能量bug
|
1263
|
end
|
091912ed
chenyueqi
未测试版好友能量助力活动
|
1264
1265
1266
1267
1268
|
role.activity:updateActData("FriendEnergy", actData)
SendPacket(actionCodes.Activity_friendHelpRpc, MsgPack.pack({result = result, reward = reward}))
return true
end
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
1269
1270
1271
1272
1273
1274
1275
|
-- 战令活动奖励
function _M.battleCommandRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid -- 活动id
local index = msg.index -- 领取的阶段id
local pay = msg.pay -- 是否是超级奖励
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
|
if not role.activity:isOpenById(actid, "BattleCommand") then return 1 end
local actCtrlData = csvdb["activity_ctrlCsv"][actid]
if not actCtrlData then return end
local actData = role.activity:getActData("BattleCommand") or {}
if pay and not actData["unlock"] then return 2 end
local bpCfg = csvdb["activity_battlepass_rewardCsv"][actid]
if not bpCfg then return 3 end
|
fa8de8ea
liuzujun
将军令一键领取bug
|
1288
|
local unlock = actData["unlock"] or 0
|
6cac3be8
liuzujun
将军令批量领取奖励
|
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
|
local award = {}
if not index then -- 一键领取
for i = 1, #bpCfg do
local cfg = bpCfg[i]
if not cfg then return 4 end
if (actData["lvl"] or 0) < cfg["type"] then break end
local records = {{"freeR", "rewardNormal"}, {"payR", "rewardHigh"}}
for _, info in ipairs(records) do
local typeKey, rewardKey = info[1], info[2]
|
fa8de8ea
liuzujun
将军令一键领取bug
|
1300
1301
1302
|
if typeKey == "payR" and unlock == 0 then
break
end
|
6cac3be8
liuzujun
将军令批量领取奖励
|
1303
1304
1305
1306
|
local record = actData[typeKey] or ""
local flag = string.char(string.getbit(record, i))
if flag == "0" then
record = string.setbit(record, i)
|
7cbf1146
liuzujun
去除advmap monster类型
|
1307
1308
1309
1310
|
local awd = cfg[rewardKey]
for k, v in pairs(awd:toNumMap()) do
award[k] = (award[k] or 0) + v
end
|
6cac3be8
liuzujun
将军令批量领取奖励
|
1311
|
end
|
6cac3be8
liuzujun
将军令批量领取奖励
|
1312
|
actData[typeKey] = record
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
1313
|
|
6cac3be8
liuzujun
将军令批量领取奖励
|
1314
1315
|
end
end
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
1316
|
else
|
6cac3be8
liuzujun
将军令批量领取奖励
|
1317
1318
|
bpCfg = bpCfg[index]
if not bpCfg then return 4 end
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
1319
|
|
6cac3be8
liuzujun
将军令批量领取奖励
|
1320
|
if (actData["lvl"] or 0) < bpCfg["type"] then return 5 end
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
1321
|
|
6cac3be8
liuzujun
将军令批量领取奖励
|
1322
1323
1324
1325
1326
1327
|
local record = ""
if pay then
record = actData["payR"] or ""
else
record = actData["freeR"] or ""
end
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
1328
|
|
6cac3be8
liuzujun
将军令批量领取奖励
|
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
|
local flag = string.char(string.getbit(record, index))
if flag == "1" then
return 6
end
record = string.setbit(record, index)
local awd = ""
if pay then
actData["payR"] = record
|
30d52f8f
liuzujun
战令奖励错位
|
1339
|
awd = bpCfg["rewardHigh"]
|
6cac3be8
liuzujun
将军令批量领取奖励
|
1340
1341
|
else
actData["freeR"] = record
|
30d52f8f
liuzujun
战令奖励错位
|
1342
|
awd = bpCfg["rewardNormal"]
|
6cac3be8
liuzujun
将军令批量领取奖励
|
1343
1344
1345
1346
|
end
for k, v in pairs(awd:toNumMap()) do
award[k] = (award[k] or 0) + v
end
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
|
end
role.activity:updateActData("BattleCommand", actData)
local reward, change = role:award(award, {log = {desc = "actBattleCommand", int1 = actid, int2 = index}})
SendPacket(actionCodes.Activity_battleCommandRpc, MsgPack.pack(role:packReward(reward, change)))
return true
end
function _M.buyBattleCommandLvlRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid -- 活动id
|
98be031a
liuzujun
新年活动
|
1361
|
local count = msg.count
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
|
if not role.activity:isOpenById(actid, "BattleCommand") then return 1 end
local actCtrlData = csvdb["activity_ctrlCsv"][actid]
if not actCtrlData then return 2 end
local bpCfg = csvdb["activity_battlepass_rewardCsv"][actid]
if not bpCfg then return 3 end
local actData = role.activity:getActData("BattleCommand") or {}
local curLvl = actData["lvl"] or 0
|
98be031a
liuzujun
新年活动
|
1374
|
local nextLvl = curLvl + count
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
1375
1376
1377
1378
|
if curLvl >= bpCfg[#bpCfg]["type"] then return 4 end
local cost = 0
for i = 1, #bpCfg do
local cfg = bpCfg[i]
|
98be031a
liuzujun
新年活动
|
1379
1380
|
if cfg["type"] > curLvl and cfg["type"] <= nextLvl then
cost = cost + cfg["cost"]
|
7e5d9ac6
liuzujun
战令活动购买等级扣除钻石bug
|
1381
|
elseif cfg["type"] > nextLvl then
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
1382
1383
1384
1385
1386
|
break
end
end
if cost == 0 then return 5 end
|
8f49e40e
zhangqijia
refactor: 战令等级由虹光...
|
1387
1388
|
if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return 6 end
role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "actBuyBpLevel", int1 = curLvl}})
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
1389
1390
|
actData["lvl"] = nextLvl
role.activity:updateActData("BattleCommand", actData)
|
70fb62d1
liuzujun
服务器数据打点
|
1391
|
role:mylog("act_action", {desc="buyBcLvl", int1=count, int2=nextLvl})
|
b620581a
liuzujun
战令活动,战令相关的任务活动
|
1392
1393
1394
1395
1396
|
SendPacket(actionCodes.Activity_buyBattleCommandLvlRpc, MsgPack.pack({}))
return true
end
|
336fa4a6
chenyueqi
新的活动签到,新春三重奏之返还0消耗
|
1397
1398
1399
|
function _M.newSignRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
|
336fa4a6
chenyueqi
新的活动签到,新春三重奏之返还0消耗
|
1400
|
|
0ed985c5
chenyueqi
先加上,后面再调试
|
1401
1402
|
local open, actId = role.activity:isOpen("NewSign")
if not open then return 1 end
|
336fa4a6
chenyueqi
新的活动签到,新春三重奏之返还0消耗
|
1403
1404
|
local actData = role.activity:getActData("NewSign")
|
6897e0e3
chenyueqi
新春签到领奖方法里 漏掉了一个in...
|
1405
|
if actData[tostring(actData["0"] or 0)] then
|
336fa4a6
chenyueqi
新的活动签到,新春三重奏之返还0消耗
|
1406
1407
|
return 2
end
|
336fa4a6
chenyueqi
新的活动签到,新春三重奏之返还0消耗
|
1408
|
|
0ed985c5
chenyueqi
先加上,后面再调试
|
1409
|
local actCfg = csvdb["activity_signInCsv"][actId]
|
336fa4a6
chenyueqi
新的活动签到,新春三重奏之返还0消耗
|
1410
|
if not actCfg then return 4 end
|
336fa4a6
chenyueqi
新的活动签到,新春三重奏之返还0消耗
|
1411
|
|
119b51db
chenyueqi
新春签到 记录字段值的key改成s...
|
1412
|
local sumDay = actData["0"] or 0
|
0ed985c5
chenyueqi
先加上,后面再调试
|
1413
1414
|
local award = {}
for k, data in pairs(actCfg) do
|
119b51db
chenyueqi
新春签到 记录字段值的key改成s...
|
1415
|
if not actData[tostring(data.day)] and data.day <= sumDay then
|
0ed985c5
chenyueqi
先加上,后面再调试
|
1416
1417
1418
|
for id, value in pairs(data.reward:toNumMap()) do
award[id] = (award[id] or 0) + value
end
|
119b51db
chenyueqi
新春签到 记录字段值的key改成s...
|
1419
|
actData[tostring(data.day)] = 1
|
0ed985c5
chenyueqi
先加上,后面再调试
|
1420
1421
1422
1423
1424
1425
1426
1427
|
end
end
local reward, change
if next(award) then
role.activity:updateActData("NewSign", actData)
reward, change = role:award(award, {log = {desc = "newSign", int1 = actId, int2 = sumDay}})
end
|
336fa4a6
chenyueqi
新的活动签到,新春三重奏之返还0消耗
|
1428
|
|
336fa4a6
chenyueqi
新的活动签到,新春三重奏之返还0消耗
|
1429
1430
1431
1432
|
SendPacket(actionCodes.Activity_newSignRpc, MsgPack.pack(role:packReward(reward, change)))
return true
end
|
98be031a
liuzujun
新年活动
|
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
|
-- 活动拾荒领取阶段奖励
function _M.advLevelRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
local index = msg.index
if not role.activity:isOpenById(actid, "AdvLevel") then return 1 end
local actCfg = csvdb["activity_stagesAwardCsv"][actid]
if not actCfg then return 2 end
actCfg = actCfg[index]
if not actCfg then return 3 end
local actData = role.activity:getActData("AdvLevel") or {}
|
fa8de8ea
liuzujun
将军令一键领取bug
|
1448
|
local record = actData["r"] or ""
|
98be031a
liuzujun
新年活动
|
1449
1450
1451
1452
1453
1454
1455
1456
|
local flag = string.char(string.getbit(record, index))
if flag == "1" then return 4 end
local chapters = actCfg["condition2"]:toArray(true, "=")
local totalVal = 0
for i = 1, #chapters do
local cid = chapters[i]
|
fa8de8ea
liuzujun
将军令一键领取bug
|
1457
1458
|
local info = actData[cid] or {}
totalVal = totalVal + (info["max"] or 0)
|
98be031a
liuzujun
新年活动
|
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
|
end
if totalVal < actCfg["condition1"] then return 5 end
actData["r"] = string.setbit(record, index)
role.activity:updateActData("AdvLevel", actData)
local reward, change = role:award(actCfg.reward, {log = {desc = "advLevelStage", int1 = actid, int2 = index}})
SendPacket(actionCodes.Activity_advLevelRpc, MsgPack.pack(role:packReward(reward, change)))
return true
end
|
a5dc3b0e
chenyueqi
回归活动初版
|
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
|
function _M.returnerTaskRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local taskId = msg.id or 0
if taskId == 0 then return 0 end
local returner = role:getProperty("returner") or {}
if not returner[taskId] then return 1 end
local tday = specTime({hour = 4})
local curAllDay = (tday - returner.time) / 86400 + 1
local TaskCsv = csvdb["activity_taskCsv"][76] or {}
local taskData = TaskCsv[taskId]
if not taskData then return 2 end
|
e84a1beb
liuzujun
gm后台查询日志,公告相关协议
|
1487
|
if curAllDay < taskData.day then return 5 end
|
a5dc3b0e
chenyueqi
回归活动初版
|
1488
1489
1490
1491
|
local status = returner.status or {}
if status[taskId] then return 3 end
|
39aebe0b
chenyueqi
回归者活动,计算所有任务完成存在bug
|
1492
1493
1494
|
status[taskId] = 1
returner.status = status
|
a5dc3b0e
chenyueqi
回归活动初版
|
1495
1496
1497
1498
1499
1500
1501
1502
|
local done = true
for _, data in pairs(TaskCsv) do
if not status[data.id] then
done = false
break
end
end
|
a5dc3b0e
chenyueqi
回归活动初版
|
1503
1504
1505
1506
|
if done then
returner = {}
end
|
39aebe0b
chenyueqi
回归者活动,计算所有任务完成存在bug
|
1507
1508
|
local reward, change = role:award(taskData.reward, {log = {desc = "returner", int1 = taskData.day, int2 = taskId}})
|
c2c9dc14
chenyueqi
回归者领取任务协议号,触发限时礼包
|
1509
1510
1511
1512
1513
|
local pack = globalCsv.returner_pack:toArray(true,"=")
if pack[1] == taskData.id then
role:checkTaskEnter("Appoint", {id = pack[2]})
end
|
a5dc3b0e
chenyueqi
回归活动初版
|
1514
1515
1516
1517
1518
|
role:updateProperty({field = "returner", value = returner})
SendPacket(actionCodes.Activity_returnerTaskRpc, MsgPack.pack(role:packReward(reward, change)))
return true
end
|
50da0e37
liuzujun
挑战关卡活动 普通关卡扫荡,购买挑战次数
|
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
|
function _M.buyBattleTicketRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
local count = msg.count
if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end
role.activity:getBattleTicket(actid)
local actData = role.activity:getActData("ChallengeLevel") or {}
local battleInfo = actData[id] or {}
--["activity_scrofa_tickets"] = { 10, 20, 30, 40, 50, 100, 150, 200, 200, 200 }
local limit = #(globalCsv.activity_scrofa_tickets)
local curCount = actData["buyC"] or 0
if count <= 0 or curCount + count > limit then
return 2
end
local cost = globalCsv.activity_scrofa_tickets[curCount + 1]
if not role:checkItemEnough({[ItemId.Jade] = cost}) then return 3 end
|
d85ecb3f
liuzujun
神稀祭消耗门票bug
|
1536
|
role:costItems({[ItemId.Jade] = cost}, {log = {desc = "buyActivityBattleTicket", int1 = actid, int2 = count, long1 = curCount}})
|
50da0e37
liuzujun
挑战关卡活动 普通关卡扫荡,购买挑战次数
|
1537
1538
1539
1540
1541
1542
1543
1544
|
actData["ticket"] = (actData["ticket"] or 0) + 1
actData["buyC"] = curCount + count
role.activity:updateActData("ChallengeLevel", actData)
SendPacket(actionCodes.Activity_buyBattleTicketRpc, "")
return true
end
|
0769908c
zhangqijia
feat: 常规世界boss
|
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
|
-- 常规世界boss
function _M.startRegularWorldBossBattleRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
local id = msg.id
local count = msg.count
local actCfg = csvdb["activity_battleCsv"][actid]
if not actCfg then return 2 end
local battleCfg = actCfg[id]
if not battleCfg then return 3 end
local actData = role.activity:getActData("RegularWorldBoos") or {}
local preArr = battleCfg.prepose:toArray(true, "=")
for _, v in ipairs(preArr) do
local battleInfo = actData[v]
if not battleInfo then
return 4
end
local star = battleInfo["star"] or 0
if star <= 0 then
return 4
end
end
-- check cost
local changeFlag = false
local ticket = actData["ticket"]
local num = 0 -- cost num
if battleCfg.type ~= "" then
role.activity:getRegularWorldBossTicket(actid)
num = battleCfg.type:toArray(true, "=")[3]
if count and count > 0 then
if battleCfg.rank ~= 0 then
local bi = actData[id]
if not bi then return 8 end
local star = bi["star"] or 0
local maxP = bi["maxP"] or 0
-- 世界boss
if battleCfg.worldBoss_award ~= 0 then
if maxP < 1 then
return 9
end
else
if star < 1 then
return 9
end
end
end
num = num * count
else
num = 0
end
if ticket < num then
return 6
end
changeFlag = true
end
-- 解锁活动剧情
role:checkStoryStatus(false, 5, id)
if not count then
|
dd328bd6
zhangqijia
fix: 常规世界boss,防作弊
|
1610
|
role.__regularWorldBossBattleCache = {
|
0769908c
zhangqijia
feat: 常规世界boss
|
1611
1612
1613
1614
1615
|
key = tostring(math.random()),
actid = actid,
id = id,
format = msg.format,
}
|
dd328bd6
zhangqijia
fix: 常规世界boss,防作弊
|
1616
|
SendPacket(actionCodes.Activity_startRegularWorldBossBattleRpc, MsgPack.pack({key = role.__regularWorldBossBattleCache.key}))
|
0769908c
zhangqijia
feat: 常规世界boss
|
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
|
else
if count <= 0 then
return
end
local bi = actData[id]
local star = bi["star"] or 0
local award = battleCfg.item_clear:toNumMap()
if battleCfg.rank ~= 0 then
if getStarCount(battleCfg, star) == 3 then
local aw = battleCfg.perfect_reward:toNumMap()
for k, v in pairs(aw) do
award[k] = (award[k] or 0) + v
end
end
end
for k, v in pairs(award) do
award[k] = v * count
end
|
dd328bd6
zhangqijia
fix: 常规世界boss,防作弊
|
1637
|
local reward, change = role:award(award, {log = {desc = "regularWorldBossBattle", int1 = actid, int2 = count or 0}})
|
0769908c
zhangqijia
feat: 常规世界boss
|
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
|
changeFlag = true
actData["ticket"] = ticket - num
if battleCfg.rank ~= 0 then
if battleCfg.worldBoss_award ~= 0 and (bi["maxP"] or 0) > 0 then
bi["bossP"] = (bi["bossP"] or 0) + bi["maxP"] * count
end
bi["sum"] = bi["sum"] + bi["top"] * count
actData[id] = bi
local rankVal = 0
if battleCfg.rank == 1 then
rankVal = bi["sum"]
elseif battleCfg.rank == 2 then
rankVal = bi["top"]
end
role:updateRankCommon(RANK_TYPE.RegularWorldBoos, rankVal)
end
role.activity:updateActData("RegularWorldBoos", actData)
SendPacket(actionCodes.Activity_startRegularWorldBossBattleRpc, MsgPack.pack(role:packReward(reward, change)))
return true
end
return true
end
function _M.endRegularWorldBossBattleRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
local id = msg.id
local key = msg.key
local isWin = msg.isWin
local heros = msg.heros
local support = msg.support
if not role.activity:isOpenById(actid, "RegularWorldBoos") then
SendPacket(actionCodes.Activity_endRegularWorldBossBattleRpc, MsgPack.pack({}))
return true
end
|
dd328bd6
zhangqijia
fix: 常规世界boss,防作弊
|
1682
|
if not role.__regularWorldBossBattleCache then return 2 end
|
0769908c
zhangqijia
feat: 常规世界boss
|
1683
|
|
dd328bd6
zhangqijia
fix: 常规世界boss,防作弊
|
1684
|
if role.__regularWorldBossBattleCache.id ~= id or role.__regularWorldBossBattleCache.key ~= key and role.__regularWorldBossBattleCache.actid ~= actid then
|
0769908c
zhangqijia
feat: 常规世界boss
|
1685
1686
1687
1688
1689
1690
1691
1692
|
SendPacket(actionCodes.Activity_endRegularWorldBossBattleRpc, MsgPack.pack({errorCode = 1}))
end
-- 防作弊
if not role:checkBattleCheat("act_battle", {
id = id,
isWin = isWin,
info = msg.info,
|
dd328bd6
zhangqijia
fix: 常规世界boss,防作弊
|
1693
|
format = role.__regularWorldBossBattleCache.format
|
0769908c
zhangqijia
feat: 常规世界boss
|
1694
1695
1696
1697
|
}) then
SendPacket(actionCodes.Activity_endRegularWorldBossBattleRpc, MsgPack.pack({errorCode = 1}))
return true
end
|
dd328bd6
zhangqijia
fix: 常规世界boss,防作弊
|
1698
|
role.__regularWorldBossBattleCache = nil
|
0769908c
zhangqijia
feat: 常规世界boss
|
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
|
local actCfg = csvdb["activity_battleCsv"][actid]
if not actCfg then return 3 end
local battleCfg = actCfg[id]
if not battleCfg then return 4 end
local actData = role.activity:getActData("RegularWorldBoos") or {}
-- 总输出
local dmg = 0
for k, v in pairs(msg.info.damage) do
if k % 100 == 2 then
dmg = dmg + v
end
end
local reward, change = {}, nil
local battleInfo = actData[id] or {}
local curStar = 0
if isWin then
local herosInfo = msg.heros
local check = {}
-- 1 通关
check[1] = function(_)
return true
end
-- 2 阵亡人数 <= N
check[2] = function(_, cond)
return msg.info.dead and msg.info.dead <= cond
end
-- 3 全员存活
check[3] = function(_)
return msg.info.dead and msg.info.dead == 0
end
-- 4 指定种族 >= N
check[4] = function(_, cond)
local count = 0
for _, one in pairs(herosInfo) do
local heroData = csvdb["unitCsv"][one.type]
if heroData.camp == cond then
count = count + 1
end
end
return count >= cond
end
-- 5 指定职业 >= N
check[5] = function(_, cond)
local count = 0
for _, one in pairs(herosInfo) do
local heroData = csvdb["unitCsv"][one.type]
if heroData.job == cond then
count = count + 1
end
end
return count >= cond
end
-- 6 含有指定角色
check[6] = function(_, cond)
for _, one in pairs(herosInfo) do
if one.type == cond then
return true
end
end
return false
end
-- 7 通关耗时 <= X 秒 msg.info.atime
check[7] = function(_, cond)
return msg.info.atime and msg.info.atime <= cond
end
-- 8 总输出值 msg.info.atime
check[8] = function(_, cond)
return dmg >= cond
end
curStar = 0
local sweepConds = battleCfg.sweep_condition:toTableArray(true)
for i, cond in ipairs(sweepConds) do
if check[cond[1]] and check[cond[1]](table.unpack(cond)) then
curStar = curStar + (1 << (i - 1))
end
end
role:checkTaskEnter("ActBattlePass", {chapterId = id})
else
curStar = 0
if battleCfg.rank ~= 0 then
curStar = 1
end
end
local oldStarNum = getStarCount(battleCfg, battleInfo["star"] or 0)
local newStarNum = getStarCount(battleCfg, curStar)
if newStarNum > oldStarNum then
battleInfo["star"] = curStar
end
if battleCfg.rank ~= 0 and isWin then
if battleCfg.type ~= "" then
-- 消耗门票
role.activity:getRegularWorldBossTicket(actid)
local num = battleCfg.type:toArray(true, "=")[3]
actData["ticket"] = math.max(actData["ticket"] - num, 0)
end
-- 更新排行榜 最高伤害
battleInfo["top"] = math.max(battleInfo["top"] or 0, dmg)
battleInfo["sum"] = (battleInfo["sum"] or 0) + dmg
local rankVal = 0
if battleCfg.rank == 1 then
rankVal = battleInfo["sum"]
elseif battleCfg.rank == 2 then
rankVal = battleInfo["top"]
end
if rankVal > 0 then
role:updateRankCommon(RANK_TYPE.RegularWorldBoos, rankVal)
end
end
if (oldStarNum == 0 and newStarNum > 0) or battleCfg.rank ~= 0 then
reward = battleCfg.item_clear:toNumMap()
end
if (oldStarNum < 3 and newStarNum == 3) or (battleCfg.rank ~= 0 and newStarNum == 3) then
local aw = battleCfg.perfect_reward:toNumMap()
for k, v in pairs(aw) do
reward[k] = (reward[k] or 0) + v
end
end
role:checkBattle("act_battle", {
cfg = battleCfg,
star = newStarNum,
isWin = isWin,
info = msg.info,
reward = reward,
heros = heros,
supports = support,
})
-- 解锁活动剧情
if newStarNum >= 3 then
role:checkStoryStatus(false, 5, id)
end
if battleCfg.worldBoss_award ~= 0 and msg.point then
battleInfo["bossP"] = (battleInfo["bossP"] or 0) + msg.point
battleInfo["maxP"] = math.max(msg.point, (battleInfo["maxP"] or 0))
end
actData[id] = battleInfo
role.activity:updateActData("RegularWorldBoos", actData)
reward, change = role:award(reward, {log = {desc = "actBattle", int1 = actid, int2 = newStarNum}})
SendPacket(actionCodes.Activity_endRegularWorldBossBattleRpc, MsgPack.pack({
reward = reward,
change = change
}))
return true
end
function _M.regularWorldBossRewardRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
local id = msg.id
local index = msg.index
if not role.activity:isOpenById(actid, "RegularWorldBoos") then return 1 end
local actCfg = csvdb["activity_battleCsv"][actid]
if not actCfg then return 2 end
local battleCfg = actCfg[id]
if not battleCfg then return 3 end
if battleCfg.worldBoss_award == 0 then return 4 end
actCfg = csvdb["activity_wordboss_awardCsv"][battleCfg.worldBoss_award]
if not actCfg then return 5 end
local awardCfg = actCfg[index]
if not awardCfg then return 6 end
local totalAwardCnt = #actCfg
local preList = awardCfg.condition1:toArray(true, "=")
local actData = role.activity:getActData("RegularWorldBoos") or {}
local battleInfo = actData[id] or {}
local bossPoint = battleInfo["bossP"] or 0
if bossPoint < 1 then return 7 end
local bossRecord = battleInfo["bossR"] or ""
local r = string.char(string.getbit(bossRecord, index))
if r == "1" then
return 9
end
local ok = false
if #preList == 0 then
ok = true
else
for _, i in ipairs(preList) do
local flag = string.char(string.getbit(bossRecord, i))
if flag == "1" then
ok = true
break
end
end
end
if not ok then return 8 end
battleInfo["bossR"] = string.setbit(bossRecord, index)
local allFinish = true
for i = 1, totalAwardCnt do
if string.char(string.getbit(battleInfo["bossR"], i)) == "0" then
allFinish = false
break
end
end
if allFinish then
battleInfo["bossR"] = ""
end
battleInfo["bossP"] = bossPoint - 1
actData[id] = battleInfo
role.activity:updateActData("RegularWorldBoos", actData)
local award = awardCfg.reward:toNumMap()
local reward, change = role:award(award, {log = {desc = "regularWorldBossReward", int1 = actid, int2 = index}})
SendPacket(actionCodes.Activity_regularWorldBossRewardRpc, MsgPack.pack(role:packReward(reward, change)))
return true
end
function _M.buyWorldBossBattleTicketRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
local id = msg.id
local count = msg.count
if not role.activity:isOpenById(actid, "RegularWorldBoos") then return 1 end
role.activity:getRegularWorldBossTicket(actid)
local actData = role.activity:getActData("RegularWorldBoos") or {}
local battleInfo = actData[id] or {}
--["activity_scrofa_tickets"] = { 10, 20, 30, 40, 50, 100, 150, 200, 200, 200 }
--TODO
local limit = #(globalCsv.activity_scrofa_tickets)
local curCount = actData["buyC"] or 0
if count <= 0 or curCount + count > limit then
return 2
end
local cost = globalCsv.activity_scrofa_tickets[curCount + 1]
if not role:checkItemEnough({[ItemId.Jade] = cost}) then return 3 end
role:costItems({[ItemId.Jade] = cost}, {log = {desc = "buyRegularWorldBossTicket", int1 = actid, int2 = count, long1 = curCount}})
actData["ticket"] = (actData["ticket"] or 0) + 1
actData["buyC"] = curCount + count
role.activity:updateActData("RegularWorldBoos", actData)
SendPacket(actionCodes.Activity_buyWorldBossBattleTicketRpc, "")
return true
end
function _M.regularWorldBossMilestoneRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local actid = msg.actid
local id = msg.id
local index = msg.index
if not role.activity:isOpenById(actid, "RegularWorldBoos") then return 1 end
local actCfg = csvdb["activity_mileageCsv"][actid]
if not actCfg then return 3 end
local mileCfg = actCfg[index]
if not mileCfg then return 4 end
local actData = role.activity:getActData("RegularWorldBoos") or {}
local battleInfo = actData[id] or {}
local val = 0
if mileCfg.type == 1 then
val = battleInfo["sum"] or 0
elseif mileCfg.type == 2 then
val = battleInfo["top"] or 0
end
local record = battleInfo["r"] or ""
local flag = string.char(string.getbit(record, index))
if flag == "1" then return 5 end
if mileCfg.condition > val then return 6 end
battleInfo["r"] = string.setbit(record, index)
actData[id] = battleInfo
role.activity:updateActData("RegularWorldBoos", actData)
local award = mileCfg.reward:toNumMap()
local reward, change = role:award(award, {log = {desc = "regularWorldBossMilestone", int1 = actid, int2 = index}})
SendPacket(actionCodes.Activity_regularWorldBossMilestoneRpc, MsgPack.pack(role:packReward(reward, change)))
return true
end
|
c3c1b7e0
liuzujun
fix confict
|
1998
|
return _M
|