Blame view

src/models/Activity.lua 14.8 KB
e51ff6d2   zhouhaihai   冒险~
1
  local Activity = class("Activity", require("shared.ModelBase"))
be4e8031   zhouhaihai   活动 拾荒
2
  local string_format = string.format
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
3
  
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
4
  -- activity_ctr showType
e51ff6d2   zhouhaihai   冒险~
5
  Activity.ActivityType = {
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
6
  	SsrUpPoolChange = 1,	-- 特定英雄活动,切卡池
706b517e   liuzujun   翻倍掉落活动,商城免费宝箱
7
  	DoubleDrop = 2, -- 双倍掉落
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
8
9
10
11
12
13
14
15
16
17
18
19
20
  	Sign = 4,  -- 签到
  	ChangeCG = 5,	-- 客户端使用,切换抽卡界面
  	PaySignIn = 6,	--付费签到
  	ExploreCommand = 7,	-- 探索指令
  	PayBack = 8,	--返利
  
  	BonusDouble = 9,	-- 奖励关卡翻倍
  	CalendaTask = 10,	-- 日历任务
  
  	FoodSell = 11,	--贩卖周 料理
  	DrawHero = 12,	--抽卡周 招募
  	AdvDraw = 13,	--拾荒抽周 资助
  	OpenBox = 14,	--拆解周 时钟箱
e51ff6d2   zhouhaihai   冒险~
21
  }
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
22
  
9a1c54b2   zhouhaihai   活动
23
  
e51ff6d2   zhouhaihai   冒险~
24
25
26
27
  local function checkActivityType(activityType)
  	if type(activityType) == "string" then
  		activityType = Activity.ActivityType[activityType]
  	end
ea40710f   zhouhaihai   活动
28
  	return activityType or 0
e51ff6d2   zhouhaihai   冒险~
29
30
31
32
33
34
  end
  
  
  function Activity:ctor(properties)
  	Activity.super.ctor(self, properties)
  
9a1c54b2   zhouhaihai   活动
35
  	self._isOpen = {}
e51ff6d2   zhouhaihai   冒险~
36
  end
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
37
38
  
  
e51ff6d2   zhouhaihai   冒险~
39
  Activity.schema = {
be4e8031   zhouhaihai   活动 拾荒
40
  	actime 		= {"table", {}},  -- 最近检查某项活动的开始时间  {id = time}
7f9f002d   liuzujun   循环周活动
41
  	round		= {"table", {}},  -- 记录活动到了第几轮  {id = roundnum}
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
42
43
44
45
46
47
48
49
  	act4		= {"table", {}},  -- {0 = day, 1= -1, 2 = -1} == 签到活动
  	act6		= {"table", {}},  -- {1 = 1, 2 = 1} == 付费签到活动
  	act8		= {"number", 0},  -- 充值返利 
  
  	act11		= {"table", {}},  -- {0 = 贩卖数量, 1=1, 2=1}  贩卖周活动  1表示领取过该档位的奖励
  	act12		= {"table", {}},  -- {0 = 抽卡次数, 1=1, 2=1}  抽卡周活动  1表示领取过该档位的奖励
  	act13		= {"table", {}},  -- {0 = 拾荒消耗远古金币数量, 1=1, 2=1}  拾荒周活动  1表示领取过该档位的奖励
  	act14		= {"table", {}},  -- {0 = 拆解数量, 1=1, 2=1}  拆解周活动  1表示领取过该档位的奖励
e51ff6d2   zhouhaihai   冒险~
50
  }
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
51
  
e51ff6d2   zhouhaihai   冒险~
52
53
  function Activity:data()
  	return {
be4e8031   zhouhaihai   活动 拾荒
54
  		actime = self:getProperty("actime"),
7f9f002d   liuzujun   循环周活动
55
  		round = self:getProperty("round"),
7f9f002d   liuzujun   循环周活动
56
  		act4 = self:getProperty("act4"),
7f9f002d   liuzujun   循环周活动
57
  		act6 = self:getProperty("act6"),
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
58
59
60
61
62
  		act8 = self:getProperty("act8"),
  		act11 = self:getProperty("act11"),
  		act12 = self:getProperty("act12"),
  		act13 = self:getProperty("act13"),
  		act14 = self:getProperty("act14"),
e51ff6d2   zhouhaihai   冒险~
63
  	}
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
64
65
  end
  
e51ff6d2   zhouhaihai   冒险~
66
  
9a1c54b2   zhouhaihai   活动
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
  function Activity:updateProperty(params)
  	local type, default = table.unpack(self.schema[params.field])
  
  	if params.delta then
  		self:incrProperty(params.field, params.delta)
  		if not params.notNotify then
  			self.owner:notifyUpdateProperty(params.field, self:getProperty(params.field))
  		end
  		return true
  	end
  	if params.value then
  		self:setProperty(params.field, params.value)
  		if not params.notNotify then
  			self.owner:notifyUpdateProperty(params.field, self:getProperty(params.field))
  		end
  		return true
  	end
  	return false
  end
  
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
87
88
89
  function Activity:isOpenRaw(activityId, now)
  	activityId = checkActivityType(activityId)
  	local actData = csvdb["activity_ctrlCsv"][activityId]
ea40710f   zhouhaihai   活动
90
91
92
93
94
95
96
97
  	if not actData then return end
  
  	if actData.time == "" then -- 关闭
  		return false
  	end
  
  	local st = 0
  	local et = 0
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
98
  	--local now = skynet.timex()
ea40710f   zhouhaihai   活动
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
  
  	if actData.ttype == 0 then -- 时间开放
  		local openTimes = actData.time:toArray(false, "=")
  		if openTimes[1] ~= "0" then
  			st = toUnixtime(openTimes[1]..string_format("%02x", RESET_TIME))
  		end
  		if openTimes[2] ~= "0" then
  			et = toUnixtime(openTimes[2]..string_format("%02x", RESET_TIME))
  		end
   	elseif actData.ttype == 1 then -- 周期开放
   		local openTimes = actData.time:toArray(true, "=")
   		local resetTime = toUnixtime(tostring(openTimes[1]) .. string_format("%02x", RESET_TIME))
   		local r = math.floor((now - resetTime) / (openTimes[3] * 86400))
   		st = resetTime + r * (openTimes[3] * 86400)
   		et = st + openTimes[2] * 86400
  	else
  		return
  	end
  
  	if now >= st and (et == 0 or now < et) then
  		return true, st
  	end
  	return false
  end
  
  -- 缓存开放
9a1c54b2   zhouhaihai   活动
125
126
  function Activity:isOpen(activityType)
  	activityType = checkActivityType(activityType)
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
127
128
129
130
131
132
133
134
135
136
137
  	--return self._isOpen[activityType]
  	local open = false
  	for id, data in pairs(csvdb["activity_ctrlCsv"]) do
  		if data.showType == activityType then
  			open = self._isOpen[data.id]
  			if open then
  				return true, data.id
  			end
  		end
  	end
  	return false
ea40710f   zhouhaihai   活动
138
139
140
141
142
143
  end
  
  function Activity:getActData(actType)
  	actType = checkActivityType(actType)
  	return self:getProperty("act" .. actType)
  end
9a1c54b2   zhouhaihai   活动
144
  
ea40710f   zhouhaihai   活动
145
146
147
  function Activity:updateActData(actType, data, notNotify)
  	actType = checkActivityType(actType)
  	self:updateProperty({field = "act" .. actType,  value = data, notNotify = notNotify})
9a1c54b2   zhouhaihai   活动
148
149
  end
  
ea40710f   zhouhaihai   活动
150
  
9a1c54b2   zhouhaihai   活动
151
  -- 跨天刷新 --登录刷新
ea40710f   zhouhaihai   活动
152
153
  function Activity:checkActivityStatus(now, isCrossDay, notify)
  	self._isOpen = {}
be4e8031   zhouhaihai   活动 拾荒
154
  	local actime = self:getProperty("actime")
ea40710f   zhouhaihai   活动
155
  	local change = false
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
156
157
158
  	for actId, actData in pairs(csvdb["activity_ctrlCsv"]) do
  		local isOpen, startTime = self:isOpenRaw(actId, now)
  		self._isOpen[actId] = isOpen
ea40710f   zhouhaihai   活动
159
160
  
  		if isOpen then
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
161
  			if actime[actId] and actime[actId] == startTime then -- 还是之前的状态 开放中
ea40710f   zhouhaihai   活动
162
  			else  -- 重置
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
163
164
165
  				actime[actId] = startTime
  				self:closeActivity(actId, notify, true)
  				self:initActivity(actId, isCrossDay, notify)
ea40710f   zhouhaihai   活动
166
167
168
  				change = true
  			end
  		else
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
169
170
171
  			if actime[actId] then
  				self:closeActivity(actId, notify)
  				actime[actId] = nil
ea40710f   zhouhaihai   活动
172
173
174
175
176
  				change = true
  			end
  		end
  	end
  	if change then
be4e8031   zhouhaihai   活动 拾荒
177
  		self:updateProperty({field = "actime", value = actime, notNotify = not notify})
ea40710f   zhouhaihai   活动
178
  	end
9a1c54b2   zhouhaihai   活动
179
180
  end
  
ea40710f   zhouhaihai   活动
181
  local activityFunc = {}
9a1c54b2   zhouhaihai   活动
182
  
ea40710f   zhouhaihai   活动
183
184
185
186
187
188
189
190
191
192
193
194
195
  activityFunc[Activity.ActivityType.Sign] = {
  	-- ["check"] = function(self, actType, notify) -- 检查
  	-- end,
  	["init"] = function(self, actType, isCrossDay, notify)
  		if not isCrossDay then
  			activityFunc[Activity.ActivityType.Sign]["crossDay"](self, actType, notify)
  		end
  	end,
  	-- ["close"] = function(self, actType, notify)
  	-- end,
  	["crossDay"] = function(self, actType, notify)
  		local curData = self:getActData(actType)
  		curData[0] = (curData[0] or 0) + 1
be4e8031   zhouhaihai   活动 拾荒
196
  		local actData = csvdb["new_signInCsv"]
ea40710f   zhouhaihai   活动
197
198
199
200
201
202
  		if curData[0] > #actData then return end -- 满了就忽略了
  
  		-- 没满更新一下
  		self:updateActData(actType, curData, not notify)
  	end,
  }
9a1c54b2   zhouhaihai   活动
203
  
7f9f002d   liuzujun   循环周活动
204
205
206
207
  --loop1:累计料理贩卖N次
  --loop2:累计招募N次
  --loop3:累计资助N次
  --loop4:时钟箱拆解N个
93f6e69b   liuzujun   拾荒选择时间,抽卡增加sr保底
208
  function Activity:checkWeeklyAct(actType, notify, count, pool)
7f9f002d   liuzujun   循环周活动
209
210
211
212
213
214
  		local actInfoMap = {
  			[Activity.ActivityType.DrawHero] = {mailId = MailId.ActDrawCardReward, table = "activity_loop2Csv"},
  			[Activity.ActivityType.AdvDraw] = {mailId = MailId.ActAdvDrawReward, table = "activity_loop3Csv"},
  			[Activity.ActivityType.OpenBox] = {mailId = MailId.ActOpenBoxReward, table = "activity_loop4Csv"},
  			[Activity.ActivityType.FoodSell] = {mailId = MailId.ActSellFoodReward, table = "activity_loop1Csv"}
  		}
93f6e69b   liuzujun   拾荒选择时间,抽卡增加sr保底
215
216
217
  		if actType == Activity.ActivityType.DrawHero and pool == DrawCardType.FriendDraw then
  			return
  		end
7f9f002d   liuzujun   循环周活动
218
219
220
  		local info = actInfoMap[actType]
  		if not info then return end
  
ee021c58   liuzujun   每周循环任务bug
221
222
223
224
225
  		local open, actId = self:isOpen(actType)
  		if not open then
  			return
  		end
  
7f9f002d   liuzujun   循环周活动
226
227
228
  		local curData = self:getActData(actType)
  		local roundData = self:getProperty("round")
  		local curRound = roundData[actType] or 0
ee021c58   liuzujun   每周循环任务bug
229
  		local ctrlData = csvdb["activity_ctrlCsv"][actId]
7f9f002d   liuzujun   循环周活动
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
  		if not ctrlData then return end
  		if curRound >= ctrlData.condition then
  			return
  		end
  		curData[0] = (curData[0] or 0) + count
  		local totalCnt = 0
  		local finishCnt = 0
  		local maxCondition = 0
  		for k, cfg in pairs(csvdb[info.table] or {}) do
  			totalCnt = totalCnt + 1
  			if maxCondition < cfg.condition1 then
  				maxCondition = cfg.condition1
  			end
  			if not curData[cfg.id] and curData[0] >= cfg.condition1 then
  				if info.mailId then 
c59e058b   zhouhaihai   新一批日志记录
245
246
247
248
  
  					self.owner:log("activity", {
  						activity_id = cfg.id, -- 活动ID(或活动指定任务的ID)
  						activity_type = actType, -- 活动类型,见活动类型枚举表
887c1843   zhouhaihai   日志新一批
249
  						activity_reward = cfg.reward:toNumMap(), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
c59e058b   zhouhaihai   新一批日志记录
250
251
  					})
  
7f9f002d   liuzujun   循环周活动
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
  					self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1})
  					curData[cfg.id] = 1
  				end
  			end
  			if curData[cfg.id] then
  				finishCnt = finishCnt + 1
  			end
  		end
  		if totalCnt == finishCnt then
  			roundData[actType] = curRound + 1
  			for k,v in pairs(curData) do
  				if k == 0 then
  					curData[k] = curData[0] >= maxCondition and curData[0] - maxCondition or 0
  				else
  					curData[k] = nil
  				end
  			end
  			self:updateProperty({field = "round", value = roundData, notNotify = not notify})
  		end
  		self:updateActData(actType, curData, not notify)
  end
  
  -- 抽卡周
  activityFunc[Activity.ActivityType.DrawHero] = {
93f6e69b   liuzujun   拾荒选择时间,抽卡增加sr保底
276
277
  	["check"] = function(self, actType, notify, count, pool) -- 检查
  		self:checkWeeklyAct(actType, notify, count, pool)
7f9f002d   liuzujun   循环周活动
278
279
280
281
282
283
284
285
286
  	end,
  	["init"] = function(self, actType, isCrossDay, notify)
  		local roundData = self:getProperty("round")
  		roundData[actType] = 0
  		self:updateProperty({field = "round",  value = roundData, notNotify = not notify})
  	end,
  	-- ["close"] = function(self, actType, notify)
  	-- end,
  	["crossDay"] = function(self, actType, notify)
7f9f002d   liuzujun   循环周活动
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
  		self.owner:sendMail(MailId.ActDrawCard)
  	end,
  }
  
  -- 售卖周
  activityFunc[Activity.ActivityType.FoodSell] = {
  	["check"] = function(self, actType, notify, count) -- 检查
  		self:checkWeeklyAct(actType, notify, count)
  	end,
  	["init"] = function(self, actType, isCrossDay, notify)
  		local roundData = self:getProperty("round")
  		roundData[actType] = 0
  		self:updateProperty({field = "round",  value = roundData, notNotify = not notify})
  	end,
  	-- ["close"] = function(self, actType, notify)
  	-- end,
  	["crossDay"] = function(self, actType, notify)
7f9f002d   liuzujun   循环周活动
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
  		self.owner:sendMail(MailId.ActSellFood)
  	end,
  }
  
  -- 拾荒周
  activityFunc[Activity.ActivityType.AdvDraw] = {
  	["check"] = function(self, actType, notify, count) -- 检查
  		self:checkWeeklyAct(actType, notify, count)
  	end,
  	["init"] = function(self, actType, isCrossDay, notify)
  		local roundData = self:getProperty("round")
  		roundData[actType] = 0
  		self:updateProperty({field = "round",  value = roundData, notNotify = not notify})
  	end,
  	-- ["close"] = function(self, actType, notify)
  	-- end,
  	["crossDay"] = function(self, actType, notify)
7f9f002d   liuzujun   循环周活动
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
  		self.owner:sendMail(MailId.ActAdvDraw)
  	end,
  }
  
  -- 拆解周
  activityFunc[Activity.ActivityType.OpenBox] = {
  	["check"] = function(self, actType, notify, count) -- 检查
  		self:checkWeeklyAct(actType, notify, count)
  	end,
  	["init"] = function(self, actType, isCrossDay, notify)
  		local roundData = self:getProperty("round")
  		roundData[actType] = 0
  		self:updateProperty({field = "round",  value = roundData, notNotify = not notify})
  	end,
  	-- ["close"] = function(self, actType, notify)
  	-- end,
  	["crossDay"] = function(self, actType, notify)
7f9f002d   liuzujun   循环周活动
338
339
340
341
  		self.owner:sendMail(MailId.ActOpenBox)
  	end,
  }
  
51d9d20b   liuzujun   付费签到,应用市场反馈
342
343
344
345
346
347
348
349
350
  -- 付费签到
  activityFunc[Activity.ActivityType.PaySignIn] = {
  	["init"] = function(self, actType, isCrossDay, notify)
  		self:updateActData(actType, {}, not notify)
  	end,
  	-- ["close"] = function(self, actType, notify)
  	-- end,
  }
  
e52c384f   liuzujun   探索指令bug, 充值返利活动
351
352
353
354
355
  -- 充值反馈
  activityFunc[Activity.ActivityType.PayBack] = {
  	["check"] = function(self, actType, notify, twd) -- 检查
  		local oldVal = self:getActData(actType) or 0
  		local newVal = oldVal + twd
4709685d   liuzujun   返利邮件拼接充值档位
356
  		local gift, checkPoint = self.owner:getPaybackReward(oldVal, newVal)
e52c384f   liuzujun   探索指令bug, 充值返利活动
357
  		if gift ~= "" then
1cfe4c75   liuzujun   充值返利邮件内容优化
358
  			local strCp = table.concat(checkPoint ,"、")
4709685d   liuzujun   返利邮件拼接充值档位
359
  			self.owner:sendMail(MailId.PayBackAward, nil, gift, {newVal, strCp})
e52c384f   liuzujun   探索指令bug, 充值返利活动
360
361
362
363
364
365
366
367
368
369
  		end
  		self:updateActData(actType, newVal, not notify)
  	end,
  	["init"] = function(self, actType, isCrossDay, notify)
  		self:updateActData(actType, {}, not notify)
  	end,
  	-- ["close"] = function(self, actType, notify)
  	-- end,
  }
  
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
370
371
372
373
  function Activity:initActivity(actId, isCrossDay, notify)
  	local actData = csvdb["activity_ctrlCsv"][actId]
  	if not actData then return end
  	local actType = actData.showType
ea40710f   zhouhaihai   活动
374
375
376
377
378
  	if activityFunc[actType] and activityFunc[actType]['close'] then
  		activityFunc[actType]["init"](self, actType, isCrossDay, notify)
  	end
  end
  
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
379
380
381
382
  function Activity:closeActivity(actId, notify, notUpdateAct)
  	local actData = csvdb["activity_ctrlCsv"][actId]
  	if not actData then return end
  	local actType = actData.showType
ea40710f   zhouhaihai   活动
383
384
385
  	if activityFunc[actType] and activityFunc[actType]['close'] then
  		activityFunc[actType]["close"](self, actType, notify)
  	end
7f9f002d   liuzujun   循环周活动
386
387
388
  	if Activity.schema["act".. actType] then
  		self:updateActData(actType, Activity.schema["act" .. actType][2], not notify or notUpdateAct)
  	end
ea40710f   zhouhaihai   活动
389
390
391
  end
  
  function Activity:refreshDailyData(notify)
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
392
393
394
395
  	for actId, status in pairs(self._isOpen) do
  		local actData = csvdb["activity_ctrlCsv"][actId]
  		if status and actData then
  			local actType = actData.showType
ea40710f   zhouhaihai   活动
396
397
398
399
400
  			if activityFunc[actType] and activityFunc[actType]['crossDay'] then
  				activityFunc[actType]["crossDay"](self, actType, notify)
  			end
  		end
  	end
9a1c54b2   zhouhaihai   活动
401
402
  end
  
ea40710f   zhouhaihai   活动
403
  function Activity:checkActivity(notNotify, activityType, ...)
9a1c54b2   zhouhaihai   活动
404
  	if not activityType then return end
ea40710f   zhouhaihai   活动
405
406
407
  	if not self:isOpen(activityType) then return end
  	if activityFunc[activityType] and activityFunc[activityType]['check'] then
  		activityFunc[activityType]["check"](self, activityType, not notNotify, ...)
9a1c54b2   zhouhaihai   活动
408
409
410
  	end
  end
  
706b517e   liuzujun   翻倍掉落活动,商城免费宝箱
411
412
413
414
415
416
417
418
419
  -- 获取此次挂机掉落翻倍时长
  function Activity:getActHangDoubleTime(lastTs, nowTs)
  	local type = "DoubleDrop"
  	local actId = checkActivityType(type)
  	local isOpen = self:isOpen(type)
  	local openTs = self:getProperty("actime")[actId] or 0
  	local timeNow = skynet.timex()
  	lastTs =  math.max(lastTs, openTs)
  	if isOpen then
024370be   liuzujun   双倍掉掉落bug
420
  		if nowTs > openTs and nowTs > lastTs then
706b517e   liuzujun   翻倍掉落活动,商城免费宝箱
421
422
423
424
425
426
427
428
  			return nowTs - lastTs
  		else
  			return 0
  		end
  	end
  	return 0
  end
  
93f6e69b   liuzujun   拾荒选择时间,抽卡增加sr保底
429
430
  -- 获取活动卡池id
  function Activity:getActivityPool(mainType, subType)
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
431
432
433
  	local open, actId = self:isOpen(Activity.ActivityType.SsrUpPoolChange)
  	if not open then
  	--if not self:isOpen(Activity.ActivityType.SsrUpPoolChange) then	
93f6e69b   liuzujun   拾荒选择时间,抽卡增加sr保底
434
435
  		return 0
  	end
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
436
  	local actData = csvdb["activity_ctrlCsv"][actId]
93f6e69b   liuzujun   拾荒选择时间,抽卡增加sr保底
437
438
439
440
441
442
443
444
445
446
447
448
  	if not actData then return 0 end
  
  	local poolMap = actData.condition2:toMap(true, "=")
  	local key = mainType .. "_" .. subType
  	for k, v in pairs(poolMap) do
  		if k == key then
  			return v
  		end
  	end
  	return 0
  end
  
51d9d20b   liuzujun   付费签到,应用市场反馈
449
450
  -- 付费签到可领奖励
  function Activity:getPaySignReward()
7754304d   zhouhaihai   bug
451
  	local actGoodsFlag = self.owner.storeData:getProperty("actGoodsFlag")
51d9d20b   liuzujun   付费签到,应用市场反馈
452
453
454
455
456
457
458
459
  	local index = GetActGoodsIndex("paySignIn")
  	local flag = actGoodsFlag[index] or 0
  	if flag == 0 then return {} end
  
  	if not self.owner.activity:isOpen("PaySignIn") then return {} end
  
  	local diffDay = diffFromOpen() + 1
  
37bb4611   liuzujun   付费签到,抽卡阶段奖励,探索指令
460
  	local curData = self:getActData("PaySignIn")
51d9d20b   liuzujun   付费签到,应用市场反馈
461
  	local reward, change = {}
37bb4611   liuzujun   付费签到,抽卡阶段奖励,探索指令
462
  	for day, csvData in pairs(csvdb["pay_signInCsv"]) do
51d9d20b   liuzujun   付费签到,应用市场反馈
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
  		if day <= diffDay 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
  	return reward, curData
  	--if next(reward) then
  		--role.activity:updateActData("PaySignIn", curData)
  		--reward, change = role:award(reward, {log = {desc = "actPaySign"}})
  	--end
  
  	--role:log("activity", {
  	--	activity_id = curData[0], -- 活动ID(或活动指定任务的ID)
  	--	activity_type = role.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表
  	--	activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  	--})
  
  	--SendPacket(actionCodes.Activity_actPaySignRpc, MsgPack.pack(role:packReward(reward, change)))
  end
  
e51ff6d2   zhouhaihai   冒险~
490
  
706b517e   liuzujun   翻倍掉落活动,商城免费宝箱
491
  return Activity