Blame view

src/models/Activity.lua 27.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,	--拆解周 时钟箱
f7a55da3   liuzujun   新增cb2临时限时礼包
21
  	RaceDraw = 16,  -- 定向招募活动
847f9a7b   liuzujun   兑换活动,邮件内容修改
22
23
24
25
26
  
  	ChallengeLevel = 17,	-- 挑战关卡活动
  	Exchange = 18,	-- 兑换活动
  	HangDrop = 19,	-- 挂机掉落活动
  	Gachakon = 20,	-- 扭蛋活动
686d4fd6   liuzujun   兑换活动支持兑换多个, 新增卡池
27
28
29
  
  	WishHeroPool = 23, 	-- 心愿卡池
  	ActHeroPool = 24, -- 活动卡池
8e892c71   liuzujun   挑战关卡活动打完再扣门票
30
  	ActShopGoods = 25, 	-- 活动商品
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
31
  
161c50cc   zhouhaihai   宝藏怪活动
32
  	Crisis = 26, -- 宝藏怪活动
ac885527   liuzujun   联动签到活动
33
34
  
  	CommonSignIn = 28, 	--通用签到
cab7184b   chenyueqi   活动能量bug
35
  	FriendEnergy = 30, -- 好友互赠能量活动 
161c50cc   zhouhaihai   宝藏怪活动
36
  }
9a1c54b2   zhouhaihai   活动
37
  
e51ff6d2   zhouhaihai   冒险~
38
39
40
41
  local function checkActivityType(activityType)
  	if type(activityType) == "string" then
  		activityType = Activity.ActivityType[activityType]
  	end
ea40710f   zhouhaihai   活动
42
  	return activityType or 0
e51ff6d2   zhouhaihai   冒险~
43
44
45
46
47
48
  end
  
  
  function Activity:ctor(properties)
  	Activity.super.ctor(self, properties)
  
9a1c54b2   zhouhaihai   活动
49
  	self._isOpen = {}
e51ff6d2   zhouhaihai   冒险~
50
  end
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
51
  
686d4fd6   liuzujun   兑换活动支持兑换多个, 新增卡池
52
53
54
55
56
57
58
  function Activity:getType(actType)
  	if type(actType) == "string" then
  		actType = Activity.ActivityType[actType]
  	end
  	return actType or 0
  end
  
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
59
  
e51ff6d2   zhouhaihai   冒险~
60
  Activity.schema = {
be4e8031   zhouhaihai   活动 拾荒
61
  	actime 		= {"table", {}},  -- 最近检查某项活动的开始时间  {id = time}
7f9f002d   liuzujun   循环周活动
62
  	round		= {"table", {}},  -- 记录活动到了第几轮  {id = roundnum}
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
63
  	act4		= {"table", {}},  -- {0 = day, 1= -1, 2 = -1} == 签到活动
ede282c0   liuzujun   付费签到规则改为按登录天数计算进度...
64
  	act6		= {"table", {}},  -- {0 = day, 1 = 1, 2 = 1} == 付费签到活动
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
65
66
67
68
69
70
  	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表示领取过该档位的奖励
847f9a7b   liuzujun   兑换活动,邮件内容修改
71
  
b8b1c164   liuzujun   扭蛋活动,万能碎片bug
72
73
  	act17		= {"table", {}},	  -- {id=关卡星数, totalDmg=Boss总伤害}
  	act18		= {"table", {}, true},	  -- {id=兑换数量}
2bc706ab   liuzujun   兑换活动重置,累充功能
74
  	act19		= {"number", 0},	  -- {挂机信息}
b8b1c164   liuzujun   扭蛋活动,万能碎片bug
75
  	act20		= {"table", {}},	  -- {id=扭蛋抽出数量}
eb5ffd1c   liuzujun   世界boss翻牌奖励 活动卡池保底...
76
77
  
  	act24		= {"table", {}, true},	-- 活动卡池 {id=repaynum}
161c50cc   zhouhaihai   宝藏怪活动
78
  	act26 		= {"table", {}},	-- {task = {id = count}, socre = {id = status}}
ac885527   liuzujun   联动签到活动
79
80
  
  	act28		= {"table", {}},	-- 每日活跃签到 {0=day, 1=1,2=1,3=1}
cab7184b   chenyueqi   活动能量bug
81
  	act30 		= {"table", {}}, -- {magic = 0, limit = 0, reward = {id = 1, id = 1}, giveAE = {}, getAE = {}} 奖励字段1表示领取过奖励
e51ff6d2   zhouhaihai   冒险~
82
  }
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
83
  
e51ff6d2   zhouhaihai   冒险~
84
85
  function Activity:data()
  	return {
be4e8031   zhouhaihai   活动 拾荒
86
  		actime = self:getProperty("actime"),
7f9f002d   liuzujun   循环周活动
87
  		round = self:getProperty("round"),
7f9f002d   liuzujun   循环周活动
88
  		act4 = self:getProperty("act4"),
7f9f002d   liuzujun   循环周活动
89
  		act6 = self:getProperty("act6"),
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
90
91
92
93
94
  		act8 = self:getProperty("act8"),
  		act11 = self:getProperty("act11"),
  		act12 = self:getProperty("act12"),
  		act13 = self:getProperty("act13"),
  		act14 = self:getProperty("act14"),
1be743f3   liuzujun   扭蛋机调试
95
96
97
98
99
  
  		act17 = self:getProperty("act17"),
  		act18 = self:getProperty("act18"),
  		act19 = self:getProperty("act19"),
  		act20 = self:getProperty("act20"),
ac885527   liuzujun   联动签到活动
100
  		act24 = self:getProperty("act24"),
558c9044   zhouhaihai   物资危机
101
  		act26 = self:getProperty("act26"),
ac885527   liuzujun   联动签到活动
102
103
  
  		act28 = self:getProperty("act28"),
cab7184b   chenyueqi   活动能量bug
104
  		act30 = self:getProperty("act30"),
e51ff6d2   zhouhaihai   冒险~
105
  	}
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
106
107
  end
  
e51ff6d2   zhouhaihai   冒险~
108
  
9a1c54b2   zhouhaihai   活动
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
  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
129
130
131
  function Activity:isOpenRaw(activityId, now)
  	activityId = checkActivityType(activityId)
  	local actData = csvdb["activity_ctrlCsv"][activityId]
ea40710f   zhouhaihai   活动
132
133
134
135
136
137
138
139
  	if not actData then return end
  
  	if actData.time == "" then -- 关闭
  		return false
  	end
  
  	local st = 0
  	local et = 0
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
140
  	--local now = skynet.timex()
ea40710f   zhouhaihai   活动
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
  
  	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   活动
167
168
  function Activity:isOpen(activityType)
  	activityType = checkActivityType(activityType)
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
169
170
171
172
173
174
175
176
177
178
179
  	--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   活动
180
181
  end
  
686d4fd6   liuzujun   兑换活动支持兑换多个, 新增卡池
182
183
184
185
  function Activity:isOpenById(id, activityType)
  	activityType = checkActivityType(activityType)
  	local cfg = csvdb["activity_ctrlCsv"][id]
  	if not cfg then return false end
be697585   liuzujun   活动剧情解锁
186
  	if activityType ~= 0 and cfg.showType ~= activityType then return false end
686d4fd6   liuzujun   兑换活动支持兑换多个, 新增卡池
187
  
b8b1c164   liuzujun   扭蛋活动,万能碎片bug
188
189
190
  	return self._isOpen[id]
  end
  
ea40710f   zhouhaihai   活动
191
192
193
194
  function Activity:getActData(actType)
  	actType = checkActivityType(actType)
  	return self:getProperty("act" .. actType)
  end
9a1c54b2   zhouhaihai   活动
195
  
ea40710f   zhouhaihai   活动
196
197
198
  function Activity:updateActData(actType, data, notNotify)
  	actType = checkActivityType(actType)
  	self:updateProperty({field = "act" .. actType,  value = data, notNotify = notNotify})
9a1c54b2   zhouhaihai   活动
199
200
  end
  
ea40710f   zhouhaihai   活动
201
  
9a1c54b2   zhouhaihai   活动
202
  -- 跨天刷新 --登录刷新
ea40710f   zhouhaihai   活动
203
204
  function Activity:checkActivityStatus(now, isCrossDay, notify)
  	self._isOpen = {}
be4e8031   zhouhaihai   活动 拾荒
205
  	local actime = self:getProperty("actime")
ea40710f   zhouhaihai   活动
206
  	local change = false
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
207
208
209
  	for actId, actData in pairs(csvdb["activity_ctrlCsv"]) do
  		local isOpen, startTime = self:isOpenRaw(actId, now)
  		self._isOpen[actId] = isOpen
ea40710f   zhouhaihai   活动
210
211
  
  		if isOpen then
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
212
  			if actime[actId] and actime[actId] == startTime then -- 还是之前的状态 开放中
66fe093a   liuzujun   元旦关卡活动
213
  				self:onLoginActivity(actId)
ea40710f   zhouhaihai   活动
214
  			else  -- 重置
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
215
216
217
  				actime[actId] = startTime
  				self:closeActivity(actId, notify, true)
  				self:initActivity(actId, isCrossDay, notify)
ea40710f   zhouhaihai   活动
218
219
220
  				change = true
  			end
  		else
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
221
222
223
  			if actime[actId] then
  				self:closeActivity(actId, notify)
  				actime[actId] = nil
ea40710f   zhouhaihai   活动
224
225
226
227
228
  				change = true
  			end
  		end
  	end
  	if change then
be4e8031   zhouhaihai   活动 拾荒
229
  		self:updateProperty({field = "actime", value = actime, notNotify = not notify})
ea40710f   zhouhaihai   活动
230
  	end
9a1c54b2   zhouhaihai   活动
231
232
  end
  
ea40710f   zhouhaihai   活动
233
  local activityFunc = {}
9a1c54b2   zhouhaihai   活动
234
  
ea40710f   zhouhaihai   活动
235
236
237
238
239
240
241
242
243
244
245
246
247
  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   活动 拾荒
248
  		local actData = csvdb["new_signInCsv"]
ea40710f   zhouhaihai   活动
249
250
251
252
253
254
  		if curData[0] > #actData then return end -- 满了就忽略了
  
  		-- 没满更新一下
  		self:updateActData(actType, curData, not notify)
  	end,
  }
9a1c54b2   zhouhaihai   活动
255
  
7f9f002d   liuzujun   循环周活动
256
257
258
259
  --loop1:累计料理贩卖N次
  --loop2:累计招募N次
  --loop3:累计资助N次
  --loop4:时钟箱拆解N个
93f6e69b   liuzujun   拾荒选择时间,抽卡增加sr保底
260
  function Activity:checkWeeklyAct(actType, notify, count, pool)
7f9f002d   liuzujun   循环周活动
261
262
263
264
265
266
  		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保底
267
268
269
  		if actType == Activity.ActivityType.DrawHero and pool == DrawCardType.FriendDraw then
  			return
  		end
7f9f002d   liuzujun   循环周活动
270
271
272
  		local info = actInfoMap[actType]
  		if not info then return end
  
ee021c58   liuzujun   每周循环任务bug
273
274
275
276
277
  		local open, actId = self:isOpen(actType)
  		if not open then
  			return
  		end
  
7f9f002d   liuzujun   循环周活动
278
279
280
  		local curData = self:getActData(actType)
  		local roundData = self:getProperty("round")
  		local curRound = roundData[actType] or 0
ee021c58   liuzujun   每周循环任务bug
281
  		local ctrlData = csvdb["activity_ctrlCsv"][actId]
7f9f002d   liuzujun   循环周活动
282
283
284
285
286
287
288
289
  		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
b8d77233   liuzujun   拆解周活动跨轮数据异常bug
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
  		local flag = true
  		while flag do
  			--print("tatal number :", curData[0])
  			for i = 1, #csvdb[info.table] do
  				local cfg = csvdb[info.table][i]
  			--for k, cfg in pairs(csvdb[info.table] or {}) do
  				totalCnt = totalCnt + 1
  				if maxCondition < cfg.condition1 then
  					maxCondition = cfg.condition1
  				end
  				--print("cur condition", cfg.condition1)
  				if curData[0] < cfg.condition1 then
  					flag = false
  					break
  				end
c59e058b   zhouhaihai   新一批日志记录
305
  
b8d77233   liuzujun   拆解周活动跨轮数据异常bug
306
307
308
  				--print(curData[0], cfg.condition1)
  				if not curData[cfg.id] and curData[0] >= cfg.condition1 then
  					if info.mailId then 
c59e058b   zhouhaihai   新一批日志记录
309
  
b8d77233   liuzujun   拆解周活动跨轮数据异常bug
310
311
312
313
314
  						self.owner:log("activity", {
  							activity_id = cfg.id, -- 活动ID(或活动指定任务的ID)
  							activity_type = actType, -- 活动类型,见活动类型枚举表
  							activity_reward = cfg.reward:toNumMap(), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  						})
c59e058b   zhouhaihai   新一批日志记录
315
  
b8d77233   liuzujun   拆解周活动跨轮数据异常bug
316
317
318
319
320
321
  						self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1})
  						curData[cfg.id] = 1
  					end
  				end
  				if curData[cfg.id] then
  					finishCnt = finishCnt + 1
7f9f002d   liuzujun   循环周活动
322
323
  				end
  			end
b8d77233   liuzujun   拆解周活动跨轮数据异常bug
324
325
326
327
328
329
330
331
332
333
334
335
336
  			if totalCnt == finishCnt then
  				roundData[actType] = (roundData[actType] or 0) + 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
  				--print("cur round ".. roundData[actType], ctrlData.condition)
  				if roundData[actType] >= ctrlData.condition then
  					curData[0] = maxCondition
  					flag = false
7f9f002d   liuzujun   循环周活动
337
  				end
b8d77233   liuzujun   拆解周活动跨轮数据异常bug
338
  				self:updateProperty({field = "round", value = roundData, notNotify = not notify})
7f9f002d   liuzujun   循环周活动
339
  			end
7f9f002d   liuzujun   循环周活动
340
341
342
343
344
345
  		end
  		self:updateActData(actType, curData, not notify)
  end
  
  -- 抽卡周
  activityFunc[Activity.ActivityType.DrawHero] = {
93f6e69b   liuzujun   拾荒选择时间,抽卡增加sr保底
346
347
  	["check"] = function(self, actType, notify, count, pool) -- 检查
  		self:checkWeeklyAct(actType, notify, count, pool)
7f9f002d   liuzujun   循环周活动
348
349
350
351
352
353
354
355
356
  	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   循环周活动
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
  		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   循环周活动
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
  		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   循环周活动
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
  		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   循环周活动
408
409
410
411
  		self.owner:sendMail(MailId.ActOpenBox)
  	end,
  }
  
51d9d20b   liuzujun   付费签到,应用市场反馈
412
413
414
415
416
  -- 付费签到
  activityFunc[Activity.ActivityType.PaySignIn] = {
  	["init"] = function(self, actType, isCrossDay, notify)
  		self:updateActData(actType, {}, not notify)
  	end,
ede282c0   liuzujun   付费签到规则改为按登录天数计算进度...
417
418
419
420
421
  	["crossDay"] = function(self, actType, notify)
  		local curData = self:getActData(actType)
  		curData[0] = (curData[0] or 0) + 1
  		self:updateActData(actType, curData, not notify)
  	end,
460afa6e   liuzujun   付费签到改为主动领取,战斗关卡不一...
422
423
  	["close"] = function(self, actType, notify)
  		self.owner.storeData:SetActGoodsFlag("paySignIn", 0)
d4d00016   liuzujun   付费签到开始时间改为开服时间
424
425
426
427
428
429
430
431
432
  		
  		local rechargeRecord = self.owner.storeData:getProperty("payR")
  		for id, cfg in pairs(csvdb["shop_rechargeCsv"]) do
  			if cfg.shop == 2 and cfg.type == CardType.PaySignCard then
  				rechargeRecord[id] = nil
  				break
  			end
  		end
  		self.owner.storeData:updateProperty({field="payR", value=rechargeRecord})
460afa6e   liuzujun   付费签到改为主动领取,战斗关卡不一...
433
  	end,
51d9d20b   liuzujun   付费签到,应用市场反馈
434
435
  }
  
e52c384f   liuzujun   探索指令bug, 充值返利活动
436
437
438
439
440
  -- 充值反馈
  activityFunc[Activity.ActivityType.PayBack] = {
  	["check"] = function(self, actType, notify, twd) -- 检查
  		local oldVal = self:getActData(actType) or 0
  		local newVal = oldVal + twd
4709685d   liuzujun   返利邮件拼接充值档位
441
  		local gift, checkPoint = self.owner:getPaybackReward(oldVal, newVal)
e52c384f   liuzujun   探索指令bug, 充值返利活动
442
  		if gift ~= "" then
1cfe4c75   liuzujun   充值返利邮件内容优化
443
  			local strCp = table.concat(checkPoint ,"、")
4709685d   liuzujun   返利邮件拼接充值档位
444
  			self.owner:sendMail(MailId.PayBackAward, nil, gift, {newVal, strCp})
e52c384f   liuzujun   探索指令bug, 充值返利活动
445
446
447
448
449
450
451
452
453
454
  		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,
  }
  
190e1415   liuzujun   英雄帖活动初始化
455
456
457
  -- 英雄帖
  activityFunc[Activity.ActivityType.CalendaTask] = {
  	["init"] = function(self, actType, isCrossDay, notify)
6e411115   liuzujun   开启x品质时钟箱任务计数错误bug
458
  		local calTask = self.owner:getProperty("calTask")
190e1415   liuzujun   英雄帖活动初始化
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
  		calTask = {}
  		local role = self.owner
  		local buildL = role.dinerData:getProperty("buildL")
  		local curLevel = buildL:getv(1, 1)
  		role:checkTaskEnter("DinerLevelUp", {level = curLevel})
  
  		role:checkTaskEnter("HeroLvlCollect", {})
  		role:checkTaskEnter("HeroQualityCollect", {})
  
  		local curPopular = role.dinerData:getProperty("popular")
  		role:checkTaskEnter("DinerPopular", {count = curPopular})
  
  		local rLevel = role:getProperty("level")
  		role:checkTaskEnter("RoleLevelUp", {level = rLevel})
  
  		local towerInfo = role:getProperty("towerInfo")
  		role:checkTaskEnter("TowerPass", {level = towerInfo.l})
  		--"PvpWin"
576c791c   liuzujun   玛尼英雄帖活动通过任务bug 元旦...
477
478
  		--role:checkTaskEnter("HangPass", {id = 0})
  		role:checkCalendaTask(true, 15, 3)
190e1415   liuzujun   英雄帖活动初始化
479
480
481
482
  		role:checkTaskEnter("HeroStarCollect", {})
  		role:checkTaskEnter("RuneQualityCollect", {})
  
  	end,
f76d63e1   liuzujun   联动任务活动
483
  	["close"] = function(self, actType, notify)
6e411115   liuzujun   开启x品质时钟箱任务计数错误bug
484
  		self.owner:updateProperty({field="calTask", value={}})
f76d63e1   liuzujun   联动任务活动
485
  	end,
190e1415   liuzujun   英雄帖活动初始化
486
487
  }
  
847f9a7b   liuzujun   兑换活动,邮件内容修改
488
489
490
  -- 兑换
  activityFunc[Activity.ActivityType.Exchange] = {
  	["init"] = function(self, actType, isCrossDay, notify, actId)
847f9a7b   liuzujun   兑换活动,邮件内容修改
491
492
493
494
  		local actData = self:getActData(actType) or {}
  		actData[actId] = {}
  		self:updateActData(actType, actData, not notify)
  	end,
a6898231   liuzujun   兑换活动上线检测是否需要刷新
495
  	["login"] = function(self, actType, actId)
7245bc4b   liuzujun   登入刷新兑换活动商店
496
  		activityFunc[Activity.ActivityType.Exchange]["crossDay"](self, actType, true, actId)
a6898231   liuzujun   兑换活动上线检测是否需要刷新
497
  	end,
2bc706ab   liuzujun   兑换活动重置,累充功能
498
499
500
501
502
503
504
505
  	["crossDay"] = function(self, actType, notify, actId)
  		local actData = self:getActData(actType) or {}
  		local lastTs = actData["ts"] or 0
  		local timeNow = skynet.timex()
  		local cfg = csvdb["activity_ctrlCsv"][actId]
  		if not cfg then return end
  		local refreshTimes = cfg.condition2:toArray(false, "=")
  		for i = 1, #refreshTimes do
16f58f21   liuzujun   兑换商店不刷新bug
506
  			local rt = toUnixtime(refreshTimes[i]..string_format("%02x", RESET_TIME))
2bc706ab   liuzujun   兑换活动重置,累充功能
507
508
509
510
511
  			if timeNow >= rt and rt > lastTs then
  				lastTs = rt
  				actData = {}
  			end
  		end
16f58f21   liuzujun   兑换商店不刷新bug
512
513
  		if not next(actData) then
  			actData["ts"] = timeNow
2bc706ab   liuzujun   兑换活动重置,累充功能
514
515
516
517
518
519
520
521
  			self:updateActData(actType, actData, not notify)
  		end
  	end,
  	["close"] = function(self, actType, notify, actId)
  		local actData = self:getActData(actType) or {}
  		actData[actId] = nil
  		self:updateActData(actType, actData, not notify)
  	end,
847f9a7b   liuzujun   兑换活动,邮件内容修改
522
523
524
525
526
527
528
529
530
531
532
533
  }
  
  -- 扭蛋机
  activityFunc[Activity.ActivityType.Gachakon] = {
  	["init"] = function(self, actType, isCrossDay, notify, actId)
  		self:updateActData(actType, {}, not notify)
  	end,
  	["crossDay"] = function(self, actType, notify)
  		self:updateActData(actType, {}, not notify)
  	end,
  }
  
eb5ffd1c   liuzujun   世界boss翻牌奖励 活动卡池保底...
534
535
536
537
538
539
540
541
  -- 活动卡池
  activityFunc[Activity.ActivityType.ActHeroPool] = {
  	["init"] = function(self, actType, isCrossDay, notify, actId)
  	end,
  	["close"] = function(self, actType, notify, actId)
  		local actData = self:getActData(actType)
  		local cfg = csvdb["activity_ctrlCsv"][actId]
  		if not cfg then return end
0c54995a   liuzujun   第一次通关拾荒章节推送限时礼包,活...
542
  		-- 保底次数转换成万能碎片
0285ef6c   liuzujun   活动卡池结束回馈次数通关邮件折算碎...
543
544
545
546
547
  		--local count = math.ceil(((actData[cfg.condition] or 0) / 100) * 60)
  		--if count > 0 then
  		--	local gift = {[723] = count}
  		--	self.owner:sendMail(MailId.ActivityPoolRet, nil, gift, {})
  		--end
eb5ffd1c   liuzujun   世界boss翻牌奖励 活动卡池保底...
548
549
550
551
552
  		actData[cfg.condition] = nil
  		self:updateActData(actType, actData, not notify)
  	end,
  }
  
2bc706ab   liuzujun   兑换活动重置,累充功能
553
554
555
556
  -- 挂机掉落
  activityFunc[Activity.ActivityType.HangDrop] = {
  	["init"] = function(self, actType, isCrossDay, notify, actId)
  		local actime = self:getProperty("actime")
576c791c   liuzujun   玛尼英雄帖活动通过任务bug 元旦...
557
558
  		local ctime = self.owner:getProperty("ctime")
  		local startTime = math.max(actime[actId], ctime)
2bc706ab   liuzujun   兑换活动重置,累充功能
559
560
561
562
563
564
565
566
  		local actData = self:getActData(actType) or 0
  		local cfg = csvdb["activity_putCsv"][actId]
  		if not cfg then return end
  		actData = startTime
  		self:updateActData(actType, actData, not notify)
  	end
  }
  
66fe093a   liuzujun   元旦关卡活动
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
  --ChallengeLevel
  activityFunc[Activity.ActivityType.ChallengeLevel] = {
  	["init"] = function(self, actType, isCrossDay, notify, actId)
  		self:getBattleTicket(actId)
  	end,
  	["login"] = function(self, actType, actId)
  		self:getBattleTicket(actId)
  	end
  }
  
  function Activity:onLoginActivity(actId)
  	local actData = csvdb["activity_ctrlCsv"][actId]
  	if not actData then return end
  	local actType = actData.showType
  	if activityFunc[actType] and activityFunc[actType]['login'] then
  		activityFunc[actType]["login"](self, actType, actId)
  	end
  end
  
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
586
587
588
589
  function Activity:initActivity(actId, isCrossDay, notify)
  	local actData = csvdb["activity_ctrlCsv"][actId]
  	if not actData then return end
  	local actType = actData.showType
66fe093a   liuzujun   元旦关卡活动
590
  	if activityFunc[actType] and activityFunc[actType]['init'] then
847f9a7b   liuzujun   兑换活动,邮件内容修改
591
  		activityFunc[actType]["init"](self, actType, isCrossDay, notify, actId)
ea40710f   zhouhaihai   活动
592
593
594
  	end
  end
  
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
595
596
597
598
  function Activity:closeActivity(actId, notify, notUpdateAct)
  	local actData = csvdb["activity_ctrlCsv"][actId]
  	if not actData then return end
  	local actType = actData.showType
ea40710f   zhouhaihai   活动
599
  	if activityFunc[actType] and activityFunc[actType]['close'] then
847f9a7b   liuzujun   兑换活动,邮件内容修改
600
  		activityFunc[actType]["close"](self, actType, notify, actId)
ea40710f   zhouhaihai   活动
601
  	end
fb344e8a   liuzujun   活动结束回收邮件
602
  	self:recycleActItem(actId)
7f9f002d   liuzujun   循环周活动
603
  	if Activity.schema["act".. actType] then
eb5ffd1c   liuzujun   世界boss翻牌奖励 活动卡池保底...
604
605
606
  		if not Activity.schema["act" .. actType][3] then 
  			self:updateActData(actType, Activity.schema["act" .. actType][2], not notify or notUpdateAct)
  		end
7f9f002d   liuzujun   循环周活动
607
  	end
ea40710f   zhouhaihai   活动
608
609
610
  end
  
  function Activity:refreshDailyData(notify)
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
611
612
613
614
  	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   活动
615
  			if activityFunc[actType] and activityFunc[actType]['crossDay'] then
2bc706ab   liuzujun   兑换活动重置,累充功能
616
  				activityFunc[actType]["crossDay"](self, actType, notify, actId)
ea40710f   zhouhaihai   活动
617
618
619
  			end
  		end
  	end
9a1c54b2   zhouhaihai   活动
620
621
  end
  
ea40710f   zhouhaihai   活动
622
  function Activity:checkActivity(notNotify, activityType, ...)
9a1c54b2   zhouhaihai   活动
623
  	if not activityType then return end
ea40710f   zhouhaihai   活动
624
625
626
  	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   活动
627
628
629
  	end
  end
  
706b517e   liuzujun   翻倍掉落活动,商城免费宝箱
630
631
632
  -- 获取此次挂机掉落翻倍时长
  function Activity:getActHangDoubleTime(lastTs, nowTs)
  	local type = "DoubleDrop"
2bc706ab   liuzujun   兑换活动重置,累充功能
633
634
  	--local actId = checkActivityType(type)
  	local isOpen, actId = self:isOpen(type)
706b517e   liuzujun   翻倍掉落活动,商城免费宝箱
635
636
637
638
  	local openTs = self:getProperty("actime")[actId] or 0
  	local timeNow = skynet.timex()
  	lastTs =  math.max(lastTs, openTs)
  	if isOpen then
024370be   liuzujun   双倍掉掉落bug
639
  		if nowTs > openTs and nowTs > lastTs then
706b517e   liuzujun   翻倍掉落活动,商城免费宝箱
640
641
642
643
644
645
646
647
  			return nowTs - lastTs
  		else
  			return 0
  		end
  	end
  	return 0
  end
  
93f6e69b   liuzujun   拾荒选择时间,抽卡增加sr保底
648
649
  -- 获取活动卡池id
  function Activity:getActivityPool(mainType, subType)
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
650
651
652
  	local open, actId = self:isOpen(Activity.ActivityType.SsrUpPoolChange)
  	if not open then
  	--if not self:isOpen(Activity.ActivityType.SsrUpPoolChange) then	
93f6e69b   liuzujun   拾荒选择时间,抽卡增加sr保底
653
654
  		return 0
  	end
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
655
  	local actData = csvdb["activity_ctrlCsv"][actId]
93f6e69b   liuzujun   拾荒选择时间,抽卡增加sr保底
656
657
658
659
660
661
662
663
664
665
666
667
  	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   付费签到,应用市场反馈
668
669
  -- 付费签到可领奖励
  function Activity:getPaySignReward()
7754304d   zhouhaihai   bug
670
  	local actGoodsFlag = self.owner.storeData:getProperty("actGoodsFlag")
51d9d20b   liuzujun   付费签到,应用市场反馈
671
672
673
674
675
676
677
678
  	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   付费签到,抽卡阶段奖励,探索指令
679
  	local curData = self:getActData("PaySignIn")
51d9d20b   liuzujun   付费签到,应用市场反馈
680
  	local reward, change = {}
37bb4611   liuzujun   付费签到,抽卡阶段奖励,探索指令
681
  	for day, csvData in pairs(csvdb["pay_signInCsv"]) do
51d9d20b   liuzujun   付费签到,应用市场反馈
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
  		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
  
847f9a7b   liuzujun   兑换活动,邮件内容修改
709
710
711
712
713
714
715
  -- 回收活动道具
  function Activity:recycleActItem(actId)
  	local role = self.owner
  	local actCfg = csvdb["activity_ctrlCsv"][actId]
  	if not actCfg then return end
  	local gift = {}
  	local costs = {}
1be743f3   liuzujun   扭蛋机调试
716
  	for _, arr in ipairs(actCfg.recycle:toTableArray(true)) do
847f9a7b   liuzujun   兑换活动,邮件内容修改
717
718
719
720
  		local fromId, toId, toNum = arr[1], arr[2], arr[3]
  		local itemCount = role:getItemCount(fromId)
  		if itemCount > 0 then
  			costs[fromId] = (costs[fromId] or 0) + itemCount
40dd5057   zhouhaihai   奖励内容错误
721
  			gift[toId] = (gift[toId] or 0) + toNum * itemCount
847f9a7b   liuzujun   兑换活动,邮件内容修改
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
  		end
  	end
  	if next(costs) then
  		local itemStr = ""
  		for k, v in pairs(costs) do
  			if itemStr ~= "" then
  				itemStr = itemStr .. " "
  			end
  			itemStr = itemStr .. k .. "=" .. v
  		end
  		role:costItems(costs, {log = {desc = "actRecycle"}})
  		role:sendMail(actCfg.recycle_email, nil, gift, {itemStr})
  	end
  end
  
66fe093a   liuzujun   元旦关卡活动
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
  -- 活动挑战关卡计算门票
  function Activity:getBattleTicket(actId)
  	local role = self.owner
  	local createTs = role:getProperty("ctime")
  	local actCfg = csvdb["activity_ctrlCsv"][actId]
  	if not actCfg then return 0 end
  
  	local actStartTime = 0
  	local openTimes = actCfg.time:toArray(false, "=")
  	actStartTime = toUnixtime(openTimes[1]..string_format("%02x", RESET_TIME))
  	local actData = self:getActData("ChallengeLevel") or {}
  	local startTs = actData["ts"] or math.max(actStartTime, createTs)
  	local timeNow = skynet.timex()
  	local modify = false
  	local arr = actCfg.condition2:toArray(true, "=")
  
  	local ticketId, init, limit, duration = arr[1] or 0, arr[2] or 0, arr[3] or 0, arr[4] or 10000
  
  	local count = actData["ticket"] or init
  	local add = math.max(math.floor((timeNow - startTs) / (duration * 60)), 0)
  
  	local newCount= math.min(count + add, limit)
  	if newCount ~= count or newCount >= limit then
  		modify = true
  	end
  	add = newCount - count
  
  	if modify or not next(actData) then
  		actData["ticket"] = newCount
  		actData["ts"] = newCount >= limit and timeNow or (startTs + add * duration * 60)
  		self:updateActData("ChallengeLevel", actData)
  	end
  end
  
485c8c35   liuzujun   活动礼包购买记录活动过期清理
771
772
773
774
775
776
777
778
779
780
781
782
783
784
  activityFunc[Activity.ActivityType.ActShopGoods] = {
  	["init"] = function(self, actType, isCrossDay, notify, actId)
  	end,
  	["close"] = function(self, actType, notify)
  		local rechargeRecord = self.owner.storeData:getProperty("payR")
  		for id, cfg in pairs(csvdb["shop_rechargeCsv"]) do
  			if cfg.shop == 3 and cfg.type == ShopPackType.ActShopPack then
  				rechargeRecord[id] = nil
  			end
  		end
  		self.owner.storeData:updateProperty({field="payR", value=rechargeRecord})
  	end,
  }
  
091912ed   chenyueqi   未测试版好友能量助力活动
785
786
  activityFunc[Activity.ActivityType.FriendEnergy] = {
  	["init"] = function (self, actType, isCrossDay, notify, actId)
6a61fe2c   chenyueqi   少个大括号
787
  		local data = {magic = 0, limit = 0, reward = {}, giveAE = {}, getAE = {}, new = self:getActFriendNew()}
091912ed   chenyueqi   未测试版好友能量助力活动
788
789
  		self:updateActData(actType, data, not notify)
  	end,
0886d05a   chenyueqi   修改联动好友赠送获得的红点记录和通知
790
  	["login"] = function (self, actType)
cab7184b   chenyueqi   活动能量bug
791
  		local actData = self:getActData(actType) or {}
0886d05a   chenyueqi   修改联动好友赠送获得的红点记录和通知
792
793
794
  		actData.new = self:getActFriendNew()
  		self:updateActData(actType, actData, not notify)
  	end,
091912ed   chenyueqi   未测试版好友能量助力活动
795
796
797
798
799
800
801
802
803
804
805
  	["crossDay"] = function(self, actType, notify)
  		local actData = self:getActData(actType)
  		actData.limit = 0
  		actData.giveAE = {}
  		actData.getAE = {}
  		self:updateActData(actType, actData, not notify)
  	end,
  	["close"] = function (self, actType, notify, actId)
  		redisproxy:del(FRIEND_ENERGY:format(self.owner:getProperty("id")))
  	end
  }
161c50cc   zhouhaihai   宝藏怪活动
806
  
cab7184b   chenyueqi   活动能量bug
807
  function Activity:getActFriendNew()
0886d05a   chenyueqi   修改联动好友赠送获得的红点记录和通知
808
809
810
811
812
813
814
815
816
  	local roleId = self.owner:getProperty("id")
  	local friendIds = {}
  	local friends = redisproxy:hgetall(FRIEND_KEY:format(roleId))
  	for i = 1, #friends , 2 do
  		local objId = tonumber(friends[i])
  		friendIds[objId] = 1
  	end
  
  	local ids = {}
cab7184b   chenyueqi   活动能量bug
817
818
819
820
  	local members = redisproxy:smembers(FRIEND_ENERGY:format(roleId))
  	for _, id in pairs(members) do
  		if friendIds[tonumber(id)] then
  			ids[tonumber(id)] = 1
0886d05a   chenyueqi   修改联动好友赠送获得的红点记录和通知
821
  		end
cab7184b   chenyueqi   活动能量bug
822
  	end
0886d05a   chenyueqi   修改联动好友赠送获得的红点记录和通知
823
824
825
  	return ids
  end
  
161c50cc   zhouhaihai   宝藏怪活动
826
827
828
829
830
831
832
  activityFunc[Activity.ActivityType.Crisis] = {
  	["check"] = function(self, actType, notify, atype, count) -- 检查
  		count = count or 1
  		local isOpen, actId = self:isOpen(actType)
  		local actData = self:getActData(actType) or {}
  		actData.task = actData.task or {}
  		local change = false
e8719dc4   zhouhaihai   物资危机bug
833
  		local actCsv = csvdb["activity_crisisCsv"][actId]
161c50cc   zhouhaihai   宝藏怪活动
834
835
836
  		for id, actSet in pairs(actCsv) do
  			if actSet.type == atype then
  				local status = actData.task[id] or 0
bb30b1c1   zhouhaihai   宝藏怪
837
838
839
840
841
842
843
844
845
846
847
848
849
850
  				if status ~= -1 then
  					status = status + count
  					if status >= actSet.condition1 then
  						local reward
  						if actSet.loop == 1 then
  							local rcount = math.floor(status / actSet.condition1)
  							reward = actSet.reward:toNumMap()
  							for itemId, itemC in pairs(reward) do
  								reward[itemId] = itemC * rcount
  							end
  							status = status % actSet.condition1
  						else
  							reward = actSet.reward
  							status = -1
161c50cc   zhouhaihai   宝藏怪活动
851
  						end
b47316e6   zhouhaihai   活动奖励bug
852
  
bb30b1c1   zhouhaihai   宝藏怪
853
854
855
856
  						self.owner:award(reward, {log = {desc = "activity_crisis"}, notNotify = not notify})
  					end
  					actData.task[id] = status
  					change = true
161c50cc   zhouhaihai   宝藏怪活动
857
  				end
161c50cc   zhouhaihai   宝藏怪活动
858
859
860
861
862
863
864
865
866
867
  			end
  		end
  		if change then
  			-- 更新下排行榜
  			self.owner:updateRankCommon(RANK_TYPE.ActCrisis, self.owner:getItemCount(ItemId.CrisisScore))
  			self:updateActData(actType, actData)
  		end
  	end,
  }
  
ac885527   liuzujun   联动签到活动
868
869
870
871
872
873
874
875
876
  activityFunc[Activity.ActivityType.CommonSignIn] = {
  	["init"] = function(self, actType, isCrossDay, notify, actId)
  		if not isCrossDay then
  			activityFunc[Activity.ActivityType.CommonSignIn]["crossDay"](self, actType, notify, actId)
  		end
  	end,
  	["crossDay"] = function(self, actType, notify, actId)
  		local actCfg = csvdb["activity_ctrlCsv"][actId]
  		if not actCfg then return end
6e411115   liuzujun   开启x品质时钟箱任务计数错误bug
877
  		local conArr = actCfg.condition2:toArray(true, "=")
ac885527   liuzujun   联动签到活动
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
  		-- 0 登录即可, 1 达到指定活跃度
  		if conArr[1] ~= 0 then
  			return
  		end
  		local curData = self:getActData(actType) or {}
  		curData[0] = (curData[0] or 0) + 1
  		self:updateActData(actType, curData, not notify)
  	end,
  	["check"] = function(self, actType, notify, pre, cur) -- 检查
  		local isOpen, actId = self:isOpen(actType)
  		local actData = self:getActData(actType) or {}
  		local actCfg = csvdb["activity_ctrlCsv"][actId]
  		if not actCfg then return end
  		local conArr = actCfg.condition2:toArray("true", "=")
  		-- 0 登录即可, 1 达到指定活跃度
  		if conArr[1] ~= 1 then
  			return
  		end
  		local val = conArr[2] or 0
  		if pre < val and cur >= val then
  			actData[0] = (actData[0] or 0) + 1
  			self:updateActData(actType, actData, not notify)
  		end
  	end,
  }
  
706b517e   liuzujun   翻倍掉落活动,商城免费宝箱
904
  return Activity