Blame view

src/models/RoleTask.lua 32.6 KB
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
1
2
  
  
03a6166a   zhouhaihai   餐厅优化
3
  -- 增加  checkTaskEnter 内的参数 记得增加注释
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
4
  local TaskType = {
53e8037e   zhouhaihai   任务
5
6
7
  	-- hero 相关
  	DrawHero = 1,				-- 招募				- pool  count
  	AddHero = 2,				-- 增加角色			- heroType	wakeL	camp	job
03a6166a   zhouhaihai   餐厅优化
8
9
  	LoveBreak = 3,				-- 好感度进阶			- heroType	loveL
  	Wake = 4,					-- 觉醒				- heroType	wakeL
53e8037e   zhouhaihai   任务
10
11
12
13
14
  	HeroLevelUp = 5, 			-- 角色升级			- level
  	DecoFrag = 6,				-- 碎片分解			- count
  	WakeCG = 7,					-- 觉醒到解锁CG		- heroType
  	HeroTalent = 8,				-- 天赋升级			- heroType	alv
  	DrawSSR = 9,				-- 抽到SSR			- count
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
15
16
17
  	HeroLvlCollect = 10,		-- 英雄等级收集进度
  	HeroQualityCollect = 11,	-- 英雄品质收集进度
  	HeroStarCollect = 12,		-- 英雄星级收集进度
dfa9ae5e   liuzujun   战令任务活动
18
  	DrawHeroNotFriend = 13,		-- 非友情招募		-- count
7b570ef2   liuzujun   新春活动任务
19
  	DrawHeroLimitPack = 14,		-- 抽卡限时礼貌		-- count
9e5f9701   zhangqijia   feat: 玛尼的英雄帖增加任务类型
20
21
      HeroStartSum = 15, 			-- 英雄星级总数
  	WakeCGSum = 16, 			-- 累计解锁xx张CG
df622b85   liuzujun   魔鬼训练营相关
22
23
      SSRHeroStarSum = 17, 			-- SSR英雄星级总数
      SRHeroStarSum = 18, 			-- SR英雄星级总数
9e5f9701   zhangqijia   feat: 玛尼的英雄帖增加任务类型
24
  
53e8037e   zhouhaihai   任务
25
26
27
28
  
  	--装备相关
  	AddEquip = 101,				-- 获得装备			- equipId	rarity
  	SaleEquip = 102,			-- 出售装备			- count
f60b89b1   zhouhaihai   奖励副本
29
  	EquipUp = 103,				-- 装备强化			- count
53e8037e   zhouhaihai   任务
30
31
32
33
34
35
36
37
38
39
40
41
42
  
  	-- 符文(零件)相关
  	RuneUp = 201, 				-- 符文强化			
  	DecoRune = 202,	 			-- 分解符文			- count
  	AddRune = 203,	 			-- 分解符文			- id 	type 	rarity
  	
  
  	-- 挂机相关
  	HangPass = 301,				-- 挂机通关			- id
  	HangGet = 302,				-- 挂机收货
  	HangQuick = 303, 			-- 快速挂机
  	HangBattle = 304,			-- 挂机战斗			- id
  	HangGetGold = 305,			-- 挂机获得齿轮		- count
be24b6ad   zhouhaihai   传递 count
43
  	BonusPass = 306,			-- 奖励副本通关		- id count
f76d63e1   liuzujun   联动任务活动
44
  	BonusQuick = 307, 			-- 奖励关卡扫荡		-- id count
53e8037e   zhouhaihai   任务
45
46
47
48
49
50
51
52
53
54
  
  	-- 冒险相关
  	AdvPass = 401,				-- 冒险通过关			- id 	level 	score
  	AdvStart = 402,				-- 冒险开始(包括挂机)	- id
  	AdvBattleWin = 403,			-- 冒险内战斗胜利		- id
  	AdvAllPass = 404,			-- 冒险章节通关		- id
  	AdvLevel = 405,				-- 探险者协会升级		- level
  	AdvOverTask = 406,			-- 完成任务			- id
  	AdvOpenBlock = 407,			-- 打开地块			- id
  	AdvUsePotion = 408,			-- 使用营养剂			
89338c47   zhouhaihai   技能目标
55
56
  	AdvStartSelf = 409,			-- 手动冒险			- id	
  	AdvScore = 410, 			-- 冒险分数			- score		
9912e064   zhouhaihai   新增3个每日任务类型
57
  	AdvDraw = 411, 				-- 冒险资助			- count		ptype
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
58
  	AdvHang	= 412,				-- 代理拾荒次数
161c50cc   zhouhaihai   宝藏怪活动
59
60
  	AdvMineKill = 413,			-- 宝藏怪击杀
  	AdvMineLayer = 414,			-- 宝藏洞激活
f76d63e1   liuzujun   联动任务活动
61
62
  	AdvKillBoss	= 415,			-- 拾荒击杀boss
  	AdvHangHeroCnt	= 416,		-- 拾荒人数
dfa9ae5e   liuzujun   战令任务活动
63
  	AdvCostPower = 417,			-- 消耗体力
fb891778   liuzujun   fix confict
64
  	AdvPassFirst = 418,			-- 冒险首次通关			- id
7b570ef2   liuzujun   新春活动任务
65
66
67
  	AdvUseItem = 419,			-- 使用道具				- itemId 	count
  	AdvBuild = 420,				-- 建筑交互				- buildId
  	AdvKill = 421,				-- 拾荒击败敌人
0c6b1a62   chenyueqi   物资危机增加 代理拾荒时间和拾荒击...
68
  	AdvHangTime = 422,			-- 代理拾荒时间 		- count
53e8037e   zhouhaihai   任务
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
  	
  	--爬塔相关
  	TowerPass = 501,			-- 爬塔通关			- level
  	TowerBattle = 502,			-- 爬塔战斗			- level
  
  	-- 餐厅相关
  	FoodMGet = 601,				-- 食材获取
  	MakeFood = 602,				-- 制作料理			- id	count
  	GetOderTask = 603,			-- 接受餐厅订单		- rarity
  	OverOderTask = 604,			-- 完成特别订单		- rarity
  	FoodSell = 605, 			-- 料理贩卖			- count
  	FoodSellQuick = 606, 		-- 料理快速贩卖	
  	FoodSellGold = 607, 		-- 贩卖获得齿轮		- count	
  	DinerPopular = 608,			-- 人气值			- count
  	DinerLevelUp = 609,			-- 餐厅升级			- level type
d763fb14   zhouhaihai   签到 九宫格
84
  	DinerTalentUp = 610,		-- 天赋升级			- type level
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
85
  	VillageApply = 611,			-- 餐厅委托个数
53e8037e   zhouhaihai   任务
86
87
88
  
  	-- 车厢相关
  	PotionMake = 701, 			-- 营养剂制作			- id	count
9912e064   zhouhaihai   新增3个每日任务类型
89
  	OpenBox = 702,				-- 拆解时间箱			- id
d763fb14   zhouhaihai   签到 九宫格
90
  	SupportSkill = 703, 		-- 后勤支援技升级		- id   level
53e8037e   zhouhaihai   任务
91
92
  	
  
3dbbc9f3   zhouhaihai   加上新的任务
93
94
95
96
97
98
99
100
101
  	-- pvp相关
  	PvpWin = 751,				-- pvp胜利			- score
  	PvpBattle = 752,			-- pvp挑战
  
  	--好友相关
  	GiveFriendP = 801,			-- 赠送友情点			- count
  	AddFriend = 802,			-- 加入一个好友		- count
  	GetFriendP = 803,			-- 获得友情点 		- count
  
9ea0c502   liuzujun   限时礼包
102
  	-- 角色相关 
f0aff632   zhouhaihai   调整顺序
103
104
105
106
107
108
109
  	RoleLevelUp = 851,			-- 角色升级			- curlevel
  	RuneQualityCollect	= 852,	-- 铭文品质收集进度
  
  	-- 其他相关
  	SignIn = 901,				-- 签到
  	Pay	= 902,					-- 充值
  	ShopAll = 903,				-- 在任意商店购买 	
ac885527   liuzujun   联动签到活动
110
  	DailyTask = 904,			-- 完成每日活跃任务
f76d63e1   liuzujun   联动任务活动
111
112
  	RadioTaskStart = 905,		-- 电台任务开始			
  	FinishSpeTask = 906,		-- 指定任务完成			
c756d4df   liuzujun   新年将军令活动
113
  	AddItem = 907,				-- 获得道具
dfa9ae5e   liuzujun   战令任务活动
114
115
116
  	Login = 908,				-- 登入
  	CostDiamond = 909,			-- 消耗钻石
  	WeekTask = 910,				-- 完成每周活跃任务
7b570ef2   liuzujun   新春活动任务
117
  	ActBattlePass = 911,		-- 活动关卡通关		-- chapterId
c2c9dc14   chenyueqi   回归者领取任务协议号,触发限时礼包
118
  	Appoint = 912, 				-- 触发限时礼包,指定id
a3bb2d5d   liuzujun   指南 改名任务
119
  	Rename = 913,				-- 重命名
923a626e   zhangqijia   feat: 远征, 增加消耗虹光玉...
120
      CostJade = 914, 			-- 消耗虹光玉
9f21cb8e   zhangqijia   fix: 修改触发礼包逻辑
121
  	BuyLimitPack = 915, 		-- 购买指定id礼包触发
df622b85   liuzujun   魔鬼训练营相关
122
  	CostItem = 916,			-- 消耗道具
9ea0c502   liuzujun   限时礼包
123
  
53e8037e   zhouhaihai   任务
124
  	--功能未实现 todo
53e8037e   zhouhaihai   任务
125
  	AdvShop = 1002,				-- 冒险商城
53e8037e   zhouhaihai   任务
126
127
128
  	UnionBoss = 1004,			-- 工会boss
  	UnionBattle = 1005,			-- 工会战
  	AddUnion = 1006,			-- 加入一个公会
53e8037e   zhouhaihai   任务
129
130
131
  	BindPhone = 1008,			-- 绑定手机
  	WeChat = 1009,				-- 关注微信
  	WeBlog = 1010,				-- 关注微博
00e663bd   zhouhaihai   剧情相关
132
133
  }
  
d763fb14   zhouhaihai   签到 九宫格
134
135
  local function f(field, func)
  	return {type = "field", value = field, func = func}
00e663bd   zhouhaihai   剧情相关
136
137
  end
  
53e8037e   zhouhaihai   任务
138
  -- 剧情任务监听
00e663bd   zhouhaihai   剧情相关
139
140
141
  local StoryListener = {
  	func = "checkStoryStatus",
  	listen = {
9912e064   zhouhaihai   新增3个每日任务类型
142
143
144
145
146
  		[TaskType.HangPass] = {{1, f("id")}},
  		[TaskType.AdvPass] = {{4, f("id")}},
  		[TaskType.LoveBreak] = {{2, f("heroType")}},
  		[TaskType.Wake] = {{3, f("heroType"), f("wakeL")}},
  		[TaskType.AddHero] = {{3, f("heroType"), f("wakeL")}},
53e8037e   zhouhaihai   任务
147
148
149
150
151
152
153
  	}
  }
  
  -- 通用任务监听
  local CommonListener = {
  	func = "checkCommonTasks",
  	listen = {
9912e064   zhouhaihai   新增3个每日任务类型
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
  		[TaskType.HangGet] = {{1}},
  		[TaskType.HangQuick] = {{2}},
  		[TaskType.HangBattle] = {{3}},
  		[TaskType.DrawHero] = {{4, f("count"), f("pool")}},
  		[TaskType.TowerBattle] = {{5}},
  		[TaskType.PvpBattle] = {{6}},
  		[TaskType.PvpWin] = {{7}},
  		[TaskType.AdvStart] = {{8}},
  		[TaskType.AdvBattleWin] = {{9}},
  		[TaskType.AdvShop] = {{10}},
  		[TaskType.GetOderTask] = {{11}},
  		[TaskType.OverOderTask] = {{12}},
  		[TaskType.MakeFood] = {{13, f("count")}},
  		[TaskType.FoodSell] = {{14, f("count")}},
  		[TaskType.FoodSellQuick] = {{15}},
  		[TaskType.FoodMGet] = {{16}},
  		[TaskType.HeroLevelUp] = {{17}},
  		[TaskType.Wake] = {{18}},
  		[TaskType.EquipUp] = {{19, f("count")}},
  		[TaskType.GiveFriendP] = {{20, f("count")}},
  		[TaskType.UnionBoss] = {{21}},
  		[TaskType.GetFriendP] = {{22, f("count")}},
be24b6ad   zhouhaihai   传递 count
176
  		[TaskType.BonusPass] = {{23, f("count")}},
9912e064   zhouhaihai   新增3个每日任务类型
177
  		[TaskType.AdvStartSelf] = {{24}},
7228c195   zhouhaihai   商城 购买
178
  		[TaskType.ShopAll] = {{25, f("count")}},
9912e064   zhouhaihai   新增3个每日任务类型
179
  		[TaskType.RuneUp] = {{26}},
56d52cf4   zhouhaihai   任务
180
  		[TaskType.OpenBox] = {{27, f("count"), f("id")}},
9912e064   zhouhaihai   新增3个每日任务类型
181
182
  		[TaskType.AdvDraw] = {{28, f("count"), f("ptype")}},
  		[TaskType.PotionMake] = {{29, f("count"), f("id")}},
53e8037e   zhouhaihai   任务
183
184
185
186
187
188
189
  	}
  }
  
  -- 成就监听
  local AchievListener = {
  	func = "checkAchievTask",
  	listen = {
9912e064   zhouhaihai   新增3个每日任务类型
190
191
192
  		[TaskType.HangPass] = {{1, f("id")}},
  		[TaskType.UnionBattle] = {{2}},
  		[TaskType.PvpWin] = {{3}, {4, f("score")}},
a6549a94   zhouhaihai   次数加上
193
  		[TaskType.AdvAllPass] = {{5, 1, f("id")}},
9912e064   zhouhaihai   新增3个每日任务类型
194
195
196
197
198
199
200
201
202
203
204
  		[TaskType.AdvLevel] = {{6, f("level")}},
  		[TaskType.AdvScore] = {{7, f("score")}},
  		[TaskType.AdvBattleWin] = {{8}},
  		[TaskType.AdvOverTask] = {{9}},
  		[TaskType.AdvOpenBlock] = {{10}},
  		[TaskType.AdvUsePotion] = {{11}},
  		[TaskType.AdvStart] = {{12}},
  		[TaskType.FoodSell] = {{13, f("count")}},
  		[TaskType.OverOderTask] = {{14}},
  		[TaskType.FoodSellGold] = {{15, f("count")}},
  		[TaskType.DinerPopular] = {{16, f("count")}},
6afa6078   liuzujun   爬塔成就bug
205
  		[TaskType.TowerPass] = {{17, f("level"), f("type")}},
56d52cf4   zhouhaihai   任务
206
  		[TaskType.OpenBox] = {{18, f("count")}},
9912e064   zhouhaihai   新增3个每日任务类型
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
  		[TaskType.DinerLevelUp] = {{19, f("level"), f("type")}},
  		[TaskType.DinerTalentUp] = {{20, 1, f("type")}},
  		[TaskType.HangGetGold] = {{21, f("count")}},
  		[TaskType.HeroLevelUp] = {{22, f("level")}},
  		[TaskType.Wake] = {{23, f("wakeL")}},
  		[TaskType.WakeCG] = {{24}},
  		[TaskType.HeroTalent] = {{25, f("alv")}},
  		[TaskType.AddHero] = {{26, f("heroType")}, {27}},
  		[TaskType.DrawSSR] = {{28, f("count")}},
  		[TaskType.DrawHero] = {{29, f("count"), f("pool")}},
  		[TaskType.AddEquip] = {{30, f("rarity")}, {34, 1, f("rarity")}},
  		[TaskType.AddRune] = {{31, f("rarity")}, {35, 1, f("rarity")}},
  		[TaskType.EquipUp] = {{32, f("count")}},
  		[TaskType.RuneUp] = {{33}},
  		[TaskType.AddUnion] = {{36}},
  		[TaskType.AddFriend] = {{37, f("count")}},
  		[TaskType.BindPhone] = {{38, 1}},
  		[TaskType.WeChat] = {{38, 2}},
  		[TaskType.WeBlog] = {{38, 3}},
  		[TaskType.SignIn] = {{39}},
00e663bd   zhouhaihai   剧情相关
227
228
229
  	}
  }
  
9a1c54b2   zhouhaihai   活动
230
  local SudokuListener = {
d763fb14   zhouhaihai   签到 九宫格
231
232
233
234
235
236
237
238
239
240
241
242
  	func = "checkSudokuTask",
  	listen = {
  		[TaskType.HangPass] = {{1, 1, f("id")}},
  		[TaskType.DrawHero] = {{4, f("count")}},
  		[TaskType.HeroLevelUp] = {{5, f("level")}},
  		[TaskType.Wake] = {{6, f("wakeL")}},
  		[TaskType.AddFriend] = {{7, f("count")}},
  		[TaskType.GetFriendP] = {{8, f("count")}},
  		[TaskType.AdvStart] = {{9, 1}},
  		[TaskType.AdvDraw] = {{10, f("count")}},
  		[TaskType.DinerLevelUp] = {{11, f("level"), f("type")}},
  		[TaskType.FoodSell] = {{12, f("count")}},
56d52cf4   zhouhaihai   任务
243
  		[TaskType.OpenBox] = {{13, f("count")}},
d763fb14   zhouhaihai   签到 九宫格
244
245
246
247
  		[TaskType.TowerPass] = {{14, f("level")}},
  		[TaskType.PvpWin] = {{15, 1}},
  		[TaskType.DinerTalentUp] = {{16, f("level"), f("type")}},
  		[TaskType.RuneUp] = {{17, 1}},
a3bb2d5d   liuzujun   指南 改名任务
248
  		[TaskType.Rename] = {{20, 1}},
d763fb14   zhouhaihai   签到 九宫格
249
250
251
  	}
  }
  
7f9f002d   liuzujun   循环周活动
252
  local Activity = require("models.Activity")
161c50cc   zhouhaihai   宝藏怪活动
253
  
9a1c54b2   zhouhaihai   活动
254
255
  local ActivityListener = {
  	func = "checkActivityTask",
7f9f002d   liuzujun   循环周活动
256
  	listen = {
93f6e69b   liuzujun   拾荒选择时间,抽卡增加sr保底
257
  		[TaskType.DrawHero] = {{Activity.ActivityType.DrawHero, f("count"), f("pool")}},
7f9f002d   liuzujun   循环周活动
258
259
260
  		[TaskType.FoodSell] = {{Activity.ActivityType.FoodSell, f("count")}},
  		[TaskType.AdvDraw] = {{Activity.ActivityType.AdvDraw, f("count")}},
  		[TaskType.OpenBox] = {{Activity.ActivityType.OpenBox, f("count")}},
e52c384f   liuzujun   探索指令bug, 充值返利活动
261
  		[TaskType.Pay] = {{Activity.ActivityType.PayBack, f("twd")}},
161c50cc   zhouhaihai   宝藏怪活动
262
263
  		[TaskType.AdvMineKill] = {{Activity.ActivityType.Crisis, 1}},
  		[TaskType.AdvMineLayer] = {{Activity.ActivityType.Crisis, 2}},
d199e7b9   zhouhaihai   物资危机 增加消耗体力 类型
264
  		[TaskType.AdvCostPower] = {{Activity.ActivityType.Crisis, 3, f("count")}},
ac885527   liuzujun   联动签到活动
265
  		[TaskType.DailyTask] = {{Activity.ActivityType.CommonSignIn, f("pre"), f("cur")}},
c756d4df   liuzujun   新年将军令活动
266
  		[TaskType.AddItem] = {{Activity.ActivityType.BattleCommand, f("id"), f("count")}},
0c6b1a62   chenyueqi   物资危机增加 代理拾荒时间和拾荒击...
267
268
  		[TaskType.AdvHangTime] = {{Activity.ActivityType.Crisis, 4, f("count")}},
  		[TaskType.AdvKillBoss] = {{Activity.ActivityType.Crisis, 5}},
9a1c54b2   zhouhaihai   活动
269
270
271
  	}
  }
  
9ea0c502   liuzujun   限时礼包
272
273
274
275
276
277
  local StoreListener = {
  	func = "checkStoreTask",
  	listen = {
  		[TaskType.HangPass] = {{TriggerEventType.HangPass, f("id")}},
  		[TaskType.RoleLevelUp] = {{TriggerEventType.LevelUp, f("level")}},
  		[TaskType.TowerPass] = {{TriggerEventType.TowerPass, f("level")}},
0c54995a   liuzujun   第一次通关拾荒章节推送限时礼包,活...
278
  		[TaskType.AdvPassFirst] = {{TriggerEventType.AdvPass, f("id")}},
00bf6029   liuzujun   限时礼包,抽卡ssr广播
279
  		[TaskType.AddHero] = {{TriggerEventType.AddNewHero, f("heroType")}, {TriggerEventType.SSRCount, f("ssrCount")}},
7113ad0c   liuzujun   每日抽卡次数触发礼包
280
  		[TaskType.DrawHeroLimitPack] = {{TriggerEventType.DrawHeroCnt, f("count")}},
c2c9dc14   chenyueqi   回归者领取任务协议号,触发限时礼包
281
  		[TaskType.Appoint] = {{TriggerEventType.Appoint, f("id")}},
b92a81c9   liuzujun   CB2限时礼包
282
283
284
285
286
  		[TaskType.SignIn] = {{TriggerEventType.SignIn, 1}},
  		[TaskType.DrawHero] = {{TriggerEventType.DrawHero, f("count")}},
  		[TaskType.FoodSell]= {{TriggerEventType.FoodSell, f("count")}},
  		[TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}},
  		[TaskType.CostDiamond] = {{TriggerEventType.CostDiamond, f("count")}},
9f21cb8e   zhangqijia   fix: 修改触发礼包逻辑
287
  		[TaskType.BuyLimitPack] = {{TriggerEventType.BuyLimitPack, f("id")}},
b454725a   zhangqijia   feat: 英雄精进触发礼包, 修...
288
  		[TaskType.HeroTalent] = {{TriggerEventType.HeroTalent, f("count")}},
9ea0c502   liuzujun   限时礼包
289
290
291
  	}
  }
  
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
292
293
294
295
  local CalendaTaskListener = {
  	func = "checkCalendaTask",
  	listen = {
  		[TaskType.DrawHero] = {{1, 1, f("count")}},
be24b6ad   zhouhaihai   传递 count
296
  		[TaskType.BonusPass]= {{2, 1, f("count")}},
d51ed472   liuzujun   日历任务 拾荒开始任务
297
  		[TaskType.AdvStart]= {{3, 1}},
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
298
299
  		[TaskType.DinerLevelUp]= {{4, 2, f("level")}},
  		[TaskType.HeroLvlCollect]= {{5, 3}},		-- x名y级英雄
7b570ef2   liuzujun   新春活动任务
300
  		[TaskType.AdvHang]= {{6, 3, f("actid")}},			----
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
301
302
303
304
305
306
  		[TaskType.HeroQualityCollect]= {{7, 3}},
  		[TaskType.OverOderTask]= {{8, 1}},
  		[TaskType.VillageApply]= {{9, 1}},
  		[TaskType.PvpWin]= {{10, 2, f("score")}},
  		[TaskType.DinerPopular]= {{11, 2, f("count")}},
  		[TaskType.RoleLevelUp]= {{12, 2, f("level")}},
6afa6078   liuzujun   爬塔成就bug
307
  		[TaskType.TowerPass]= {{13, 3, f("level"), f("type")}},
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
308
  		[TaskType.HeroTalent]= {{14, 1}},
190e1415   liuzujun   英雄帖活动初始化
309
  		[TaskType.HangPass]= {{15, 3}},
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
310
311
312
  		[TaskType.HeroStarCollect]= {{16, 3}},
  		[TaskType.FoodSell]= {{17, 1, f("count")}},
  		[TaskType.HangGet]= {{18, 3, f("reward")}},
ffa0e259   liuzujun   日历活动 穿戴x个y品质铭文
313
  		[TaskType.RuneQualityCollect]= {{19, 3}},
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
314
  		[TaskType.OpenBox]= {{20, 3, f("count"), f("quality")}},
f76d63e1   liuzujun   联动任务活动
315
316
  		[TaskType.RadioTaskStart] = {{21, 1}, {22, 3, f("heroCnt")}},
  		[TaskType.BonusQuick] = {{23, 1, f("count")}},
75876cb3   liuzujun   代理拾荒出勤人数计数错误, 代理拾...
317
  		[TaskType.AdvHangHeroCnt] = {{24, 3, f("count")}},
f76d63e1   liuzujun   联动任务活动
318
319
320
321
  		[TaskType.AdvKillBoss] = {{25, 1}},
  		[TaskType.AdvMineKill] = {{26, 1}},
  		[TaskType.PvpBattle] = {{27, 1}},
  		[TaskType.FinishSpeTask] = {{28, 3, f("taskId"), f("actId")}},
dfa9ae5e   liuzujun   战令任务活动
322
323
324
325
  		[TaskType.Login] = {{29, 1}},
  		[TaskType.DailyTask] = {{30, 2, f("cur")}},
  		[TaskType.WeekTask] = {{31, 2, f("cur")}},
  		[TaskType.MakeFood] = {{32, 1, f("count")}},
7b570ef2   liuzujun   新春活动任务
326
  		[TaskType.AddItem] = {{33, 3, f("type"), f("count")}, {42, 3, f("id"), f("count")}},
dfa9ae5e   liuzujun   战令任务活动
327
328
329
  		[TaskType.CostDiamond] = {{34, 1, f("count")}},
  		[TaskType.DrawHeroNotFriend] = {{35, 1, f("count")}},
  		[TaskType.AdvCostPower] = {{36, 1, f("count")}},
7b570ef2   liuzujun   新春活动任务
330
331
332
333
334
335
  
  		[TaskType.AdvUseItem] = {{37, 3, f("itemId"), f("count")}},
  		[TaskType.AdvBuild] = {{38, 3, f("buildId")}},
  		[TaskType.AdvKill] = {{39, 1, f("chapterId")}},
  		[TaskType.ActBattlePass] = {{40, 3, f("chapterId")}},
  		[TaskType.AdvPass] = {{41, 3, f("id")}},
923a626e   zhangqijia   feat: 远征, 增加消耗虹光玉...
336
  		[TaskType.CostJade] = {{43, 1, f("count")}},
9e5f9701   zhangqijia   feat: 玛尼的英雄帖增加任务类型
337
338
  		[TaskType.HeroStartSum] = {{44, 3}},
  		[TaskType.WakeCGSum] = {{45, 1, f("count")}},
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
339
340
341
  	}
  }
  
dfa9ae5e   liuzujun   战令任务活动
342
343
344
  local BattleCommandTaskListener = {
  	func = "checkBattleCommandTask",
  	listen = CalendaTaskListener["listen"]
b620581a   liuzujun   战令活动,战令相关的任务活动
345
346
  }
  
78e5b90e   liuzujun   完成需求:新玩家任务
347
348
349
350
351
  local NewUserTaskListener = {
  	func = "checkNewUserTask",
  	listen = CalendaTaskListener["listen"]
  }
  
a5dc3b0e   chenyueqi   回归活动初版
352
353
354
355
356
  local ReturnerTask = {
  	func = "checkReturnerTask",
  	listen = CalendaTaskListener["listen"]
  }
  
df622b85   liuzujun   魔鬼训练营相关
357
358
359
360
361
362
363
364
365
366
  local TraningCampTask = {
  	func = "checkTraingCampTask",
  	listen = {
  		[TaskType.HangPass]= {{1, 3}},
  		[TaskType.SSRHeroStarSum] = {{2, 3}},
  		[TaskType.SRHeroStarSum] = {{3, 3}},
  		[TaskType.CostItem] = {{4, 3, f("id"), f("count")}},
  	}
  }
  
00e663bd   zhouhaihai   剧情相关
367
368
  local TaskListeners = {
  	StoryListener,
53e8037e   zhouhaihai   任务
369
370
  	CommonListener,
  	AchievListener,
9a1c54b2   zhouhaihai   活动
371
372
  	SudokuListener,
  	ActivityListener,
9ea0c502   liuzujun   限时礼包
373
  	StoreListener,
e0ad10e9   liuzujun   英雄帖任务简单类型测试
374
  	CalendaTaskListener,
dfa9ae5e   liuzujun   战令任务活动
375
  	BattleCommandTaskListener,
a5dc3b0e   chenyueqi   回归活动初版
376
  	ReturnerTask,
78e5b90e   liuzujun   完成需求:新玩家任务
377
  	NewUserTaskListener,
df622b85   liuzujun   魔鬼训练营相关
378
  	TraningCampTask,
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
379
380
381
382
383
384
  }
  
  local RoleTask = {}
  
  function RoleTask.bind(Role)
  
00e663bd   zhouhaihai   剧情相关
385
386
  	-- 任务相关入口
  	function Role:checkTaskEnter(taskType, params, notNotify)
03a6166a   zhouhaihai   餐厅优化
387
388
389
390
  		params = params or {}
  		if type(taskType) == "string" then
  			taskType = TaskType[taskType]
  		end
00e663bd   zhouhaihai   剧情相关
391
392
  		for _, listener in ipairs(TaskListeners) do
  			if listener and listener.listen and listener.listen[taskType] and listener["func"] then
53e8037e   zhouhaihai   任务
393
  				for _, vs in ipairs(listener.listen[taskType]) do
89338c47   zhouhaihai   技能目标
394
  					local pms = {}
53e8037e   zhouhaihai   任务
395
396
  					for __, v in ipairs(vs) do
  						if type(v) == "table" and v.type then
9912e064   zhouhaihai   新增3个每日任务类型
397
  							if v.type == "field" then
d763fb14   zhouhaihai   签到 九宫格
398
399
400
401
402
  								local value = params[v.value]
  								if v.func then
  									value = v.func(value)
  								end
  								table.insert(pms, value)
53e8037e   zhouhaihai   任务
403
404
405
  							else
  								table.insert(pms, v)
  							end
00e663bd   zhouhaihai   剧情相关
406
407
408
  						else
  							table.insert(pms, v)
  						end
00e663bd   zhouhaihai   剧情相关
409
  					end
53e8037e   zhouhaihai   任务
410
  					self[listener["func"]](self, notNotify, table.unpack(pms))
00e663bd   zhouhaihai   剧情相关
411
  				end
00e663bd   zhouhaihai   剧情相关
412
413
  			end
  		end
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
414
415
  	end
  
00e663bd   zhouhaihai   剧情相关
416
417
418
419
420
421
422
423
  	--剧情相关----begin-------------
  	local function checkStoryStatusByHang(role, data, status, cond1) -- cond1 carbonId
  		if tonumber(data.unlockData) ~= cond1 then return end
  		status.s = 1
  		return true
  	end
  
  	local function checkStoryStatusByLove(role, data, status, cond1)  -- cond1 heroType
14f1591b   zhouhaihai   删除好感度相关
424
425
426
427
428
  		-- if  data.sort ~= cond1 then return end
  		-- local curL = role:getProperty("loveStatus"):getv(cond1, 0)
  		-- if curL < tonumber(data.unlockData) then return end
  		-- status.s = 1
  		-- return true
00e663bd   zhouhaihai   剧情相关
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
  	end
  
  	local function checkStoryStatusByMultStar(role, data, status, cond1, cond2) -- cond1 heroType, cond2 wakeL
  		local heroType = cond1
  		local need = data.unlockData:toArray(true, "=")
  		local had = false
  		for _, v in pairs(need) do
  			if v == heroType then
  				had = true
  				break
  			end
  		end
  		if not had then return end
  		if cond2 > (status["s" .. heroType] or 0) then
  			status["s" .. heroType] = cond2
  		end
  		local starC = 0
  		for _, v in pairs(need) do
  			starC = starC + (status["s" .. v] or 0)
  		end
  		if starC >= tonumber(data.unlockData2) then
  			table.clear(status)
  			status.s = 1
  		end
  		return true
  	end
  
  	local function checkStoryStatusByAdv(role, data, status, cond1) -- cond1 advId
  		if tonumber(data.unlockData) ~= cond1 then return end
  		status.s = 1
  		return true
  	end
  
be697585   liuzujun   活动剧情解锁
462
463
464
465
466
467
468
469
470
471
  	local function checkStoryStatusByActBattle(role, data, status, cond1)	-- cond1 carbonId
  		local actid = data.sort
  		if not role.activity:isOpenById(actid) then return end
  		if cond1 and tonumber(data.unlockData) == cond1 then
  			status.s = 1
  			return true
  		end
  		return
  	end
  
00e663bd   zhouhaihai   剧情相关
472
473
474
475
476
  	local checkstoryStatusFunc = {
  		[1] = checkStoryStatusByHang,
  		[2] = checkStoryStatusByLove,
  		[3] = checkStoryStatusByMultStar,
  		[4] = checkStoryStatusByAdv,
be697585   liuzujun   活动剧情解锁
477
  		[5] = checkStoryStatusByActBattle,
00e663bd   zhouhaihai   剧情相关
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
  	}
  
  	function Role:checkStoryStatus(notNotify, stype, cond1, cond2, cond3)
  		local storyBookStatus = self:getProperty("storyB")
  		local change = {}
  		for id, data in pairs(csvdb["story_bookCsv"]) do
  			if stype == data.unlockType and checkstoryStatusFunc[stype] then
  				local curStatus = storyBookStatus[id] or {}
  				if not curStatus.s then  -- 存在状态就是已经完成
  					local isChange = checkstoryStatusFunc[stype](self, data, curStatus, cond1, cond2, cond3)
  					if isChange then
  						storyBookStatus[id] = curStatus
  						table.insert(change, {type = "storyB", field = id, value = curStatus, isOnlyToC = true})
  					end
  				end
  			end
  		end
  		if next(change) then
  			self:setProperty("storyB", storyBookStatus)  -- 统一写入数据库
  			if not notNotify then
  				self:changeUpdates(change)
  			end
  		end
  	end
  
  	--剧情相关----end-------------
53e8037e   zhouhaihai   任务
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
  
  	function Role:checkCommonTasks(notNotify, stype, count, cond1, cond2)
  		count = count or 1
  		self:checkLoopTask(notNotify, stype, count, cond1, cond2)
  	end
  
  	function Role:checkLoopTask(notNotify, stype, count, cond1, cond2)
  		local tasks = {self:getProperty("dTask")["t"] or {}, self:getProperty("wTask")["t"] or {}}
  		local isChange = {false, false}
  		for key, status in ipairs(tasks) do
  			local taskDatas = csvdb["task_loopCsv"][key]
  			for taskId, data in pairs(taskDatas) do
  				if status[taskId] ~= -1 and data.type == stype and (data.condition2 == 0 or data.condition2 == cond1) then
  					status[taskId] = (status[taskId] or 0) + count
  					isChange[key] = 1
e84a1beb   liuzujun   gm后台查询日志,公告相关协议
519
                      self:mylog("role_action", {desc = "onTask", int1 = taskId, int2 = status[taskId], short1 = key, cint1 = data.condition1})
53e8037e   zhouhaihai   任务
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
  				end
  			end
  		end
  		local change = {}
  		if isChange[1] then
  			table.insert(change, {type = "dTask", field = "t", value = tasks[1]})
  		end
  		if isChange[2] then
  			table.insert(change, {type = "wTask", field = "t", value = tasks[2]})
  		end
  		if next(change) then
  			self:changeUpdates(change, notNotify)
  		end
  	end
  
  	function Role:checkAchievTask(notNotify, stype, v1, v2)
  		local change = {}
  		local achiveStatus = self:getProperty("achiveT")
  
  		local IsFindMax = {
ca865c7e   zhouhaihai   成就bug
540
  			[1] = true,
53e8037e   zhouhaihai   任务
541
542
543
544
  			[4] = true,
  			[6] = true,
  			[7] = true,
  			[16] = true,
e04abcb4   chenyueqi   电波塔的任务只算主塔的进度
545
  			[17] = true,
53e8037e   zhouhaihai   任务
546
547
548
549
  			[19] = true,
  			[22] = true,
  			[23] = true,
  			[25] = true,
71003290   zhouhaihai   好友成就 bug
550
  			[37] = true,
53e8037e   zhouhaihai   任务
551
552
  		}
  
89338c47   zhouhaihai   技能目标
553
  		for tId , achiveData in pairs(csvdb["achievement_typeCsv"]) do
53e8037e   zhouhaihai   任务
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
  			local curStatus = achiveStatus[tId] or 0
  			if achiveData.type == stype then
  				if achiveData.type == 1 then --取出难度
  					v2 = math.floor(v1 / 10000)
  				end
  
  				if achiveData.type == 26 then
  					local campS = {}
  					local jobS = {}
  					for _, hero in pairs(self.heros) do
  						local unitData = csvdb["unitCsv"][hero:getProperty("type")]
  						campS[unitData.camp] = (campS[unitData.camp] or 0) + 1
  						jobS[unitData.job] = (jobS[unitData.job] or 0) + 1
  					end
  					local nStatus = 0
  					if achiveData.condition2 == 1 then
89338c47   zhouhaihai   技能目标
570
  						for k , v in pairs(campS) do
53e8037e   zhouhaihai   任务
571
572
573
  							nStatus = math.max(nStatus, v)
  						end
  					elseif achiveData.condition2 == 2 then
89338c47   zhouhaihai   技能目标
574
  						for k , v in pairs(jobS) do
53e8037e   zhouhaihai   任务
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
  							nStatus = math.max(nStatus, v)
  						end
  					end
  					if nStatus > curStatus then
  						table.insert(change, {type = "achiveT", field = tId, value = nStatus})
  					end
  				elseif achiveData.type == 30 then --装备套装
  					if achiveData.condition2 == 0 or achiveData.condition2 == v1 then
  						local suitS = {}
  						for equipType, equips in pairs(self:getProperty("equips")) do
  							for lv, c in pairs(equips) do
  								local equipData = csvdb["equipCsv"][equipType][lv]
  								if achiveData.condition2 == 0 or achiveData.condition2 == equipData.rarity then
  									if equipData.suit ~= "" then
  										suitS[equipData.suit] = suitS[equipData.suit] or {}
  										suitS[equipData.suit][equipType] = 1
  									end
  								end
  							end
  						end
  						local nStatus = 0
  						for k , v in pairs(suitS) do
  							local n = 0
  							for _, __ in pairs(v) do
  								n = n + 1
  							end
  							nStatus = math.max(nStatus, n)
  						end
53e8037e   zhouhaihai   任务
603
604
605
606
607
608
609
610
611
  						if nStatus > curStatus then
  							table.insert(change, {type = "achiveT", field = tId, value = nStatus})
  						end
  					end
  				elseif achiveData.type == 31 then -- 符文套装
  					if achiveData.condition2 == 0 or achiveData.condition2 == v1 then
  						local suitS = {}
  						for _, rune in pairs(self.runeBag) do
  							local runeData = csvdb["runeCsv"][rune:getProperty("type")][rune:getProperty("id")]
89338c47   zhouhaihai   技能目标
612
  							if achiveData.condition2 == 0 or achiveData.condition2 == runeData.rarity then
53e8037e   zhouhaihai   任务
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
  								if runeData.suit ~= "" then
  									suitS[runeData.suit] = suitS[runeData.suit] or {}
  									suitS[runeData.suit][runeData.type] = 1
  								end
  							end
  						end
  						local nStatus = 0
  						for k , v in pairs(suitS) do
  							local n = 0
  							for _, __ in pairs(v) do
  								n = n + 1
  							end
  							nStatus = math.max(nStatus, n)
  						end
  						if nStatus > curStatus then
  							table.insert(change, {type = "achiveT", field = tId, value = nStatus})
  						end
  					end
  				elseif IsFindMax[achiveData.type] then -- 最大值
  					if achiveData.condition2 == 0 or achiveData.condition2 == v2 then
  						if (v1 or 0) > curStatus then
  							table.insert(change, {type = "achiveT", field = tId, value = v1})
  						end
  					end
  				else --通用增加
  					if achiveData.condition2 == 0 or achiveData.condition2 == v2 then 
  						table.insert(change, {type = "achiveT", field = tId, value = curStatus + (v1 or 1)})
  					end
  				end
  			end
  		end
  		if next(change) then
e84a1beb   liuzujun   gm后台查询日志,公告相关协议
645
646
647
              for _, info in ipairs(change) do
                  self:mylog("role_action", {desc = "onTask", int1 = info.field, int2 = info.value, short1 = 3, cint1 = 0})
              end
53e8037e   zhouhaihai   任务
648
649
  			self:changeUpdates(change, notNotify)
  		end
53e8037e   zhouhaihai   任务
650
  	end
89338c47   zhouhaihai   技能目标
651
  
d763fb14   zhouhaihai   签到 九宫格
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
  	-- 九宫格任务 
  	function Role:checkSudokuTask(notNotify, stype, count, cond)
  		local change = false
  		local sudoku = self:getProperty("sudoku")
  
  		local curPhase = sudoku[-1] or 1
  		if curPhase == -1 then return end
  
  		local IsFindMax = {
  			[5] = true,
  			[6] = true,
  			[7] = true,
  			[11] = true,
  			[14] = true,
  			[16] = true,
  		}
  
  		sudoku.task = sudoku.task or {}
d763fb14   zhouhaihai   签到 九宫格
670
671
672
673
674
675
  		for pause, guide_sudokuData in pairs(csvdb["guide_sudokuCsv"]) do
  			if pause >= curPhase then
  				sudoku.task[pause] = sudoku.task[pause] or {}
  				for id , sudikuData in pairs(guide_sudokuData) do
  					local curStatus = sudoku.task[pause][id] or 0
  
dea89131   zhouhaihai   修复bug
676
  					if curStatus ~= -1 and sudikuData.type == stype then 
d763fb14   zhouhaihai   签到 九宫格
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
  						if IsFindMax[sudikuData.type] then -- 最大值
  							if sudikuData.con2 == 0 or sudikuData.con2 == cond then
  								if (count or 0) > curStatus then
  									change = true
  									sudoku.task[pause][id] = count
  								end
  							end
  						else --通用增加
  							if sudikuData.con2 == 0 or sudikuData.con2 == cond then 
  								change = true
  								sudoku.task[pause][id] = curStatus + (count or 1)
  							end
  						end
  					end
  				end
  			end
  		end
  
  		if change then
  			self:updateProperty({field = "sudoku", value = sudoku, notNotify = notNotify})
  		end
  	end
  
9a1c54b2   zhouhaihai   活动
700
  	function Role:checkActivityTask(notNotify, activityType, ...)
00bf6029   liuzujun   限时礼包,抽卡ssr广播
701
  		if not self.activity then return end
ea40710f   zhouhaihai   活动
702
  		self.activity:checkActivity(notNotify, activityType, ...)
9a1c54b2   zhouhaihai   活动
703
704
  	end
  
9ea0c502   liuzujun   限时礼包
705
  	function Role:checkStoreTask(notNotify, triggerType, param)
00bf6029   liuzujun   限时礼包,抽卡ssr广播
706
  		if not self.storeData then return end
9ea0c502   liuzujun   限时礼包
707
708
709
  		self.storeData:OnTriggerLimitTimePack(triggerType, param)
  	end
  
7b570ef2   liuzujun   新春活动任务
710
  	function Role:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2)
dfa9ae5e   liuzujun   战令任务活动
711
  		local calTask = self:getProperty(keyName) or {}
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
712
713
714
715
716
717
718
  		param1 = param1 or 1
  
  		local cid = actData.condition
  		for k, taskList in pairs(csvdb["activity_taskCsv"]) do
  			if k == cid then
  				for id, cfg in pairs(taskList) do
  					if cfg.type == mainType then
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
719
720
721
722
723
  						if subType == 1 then	-- 增加数值
  							calTask[id] = (calTask[id] or 0) + param1
  						elseif subType == 2 then	-- 直接赋值
  							calTask[id] = param1
  						elseif subType == 3 then	-- 自定义类型
b3f13e56   liuzujun   英雄令英雄收集相关任务
724
725
726
727
728
  							if cfg.type == 7 then	-- 英雄品质收集进度
  								local count = 0
  								for _, hero in pairs(self.heros) do
  									local unitData = csvdb["unitCsv"][hero:getProperty("type")]
  									if unitData then
cc30a8b3   liuzujun   玛尼英雄帖任务类型7与15 bug
729
  										if cfg.condition2 == unitData.rare then
b3f13e56   liuzujun   英雄令英雄收集相关任务
730
731
732
733
  											count = count + 1
  										end
  									end
  								end
4bd3095f   liuzujun   英雄帖任务bug
734
  								if (calTask[id] or 0) < count then
b3f13e56   liuzujun   英雄令英雄收集相关任务
735
736
737
738
739
740
741
742
743
  									calTask[id] = count
  								end
  							elseif cfg.type == 5 then	-- 英雄等级收集进度
  								local count = 0
  								for _, hero in pairs(self.heros) do
  									if cfg.condition2 <= hero:getProperty("level") then
  										count = count + 1
  									end
  								end
366dcc54   liuzujun   日历活动bug
744
  								if (calTask[id] or 0) < count then
b3f13e56   liuzujun   英雄令英雄收集相关任务
745
746
747
748
749
750
751
752
753
  									calTask[id] = count
  								end
  							elseif cfg.type == 16 then	-- 英雄星级收集进度
  								local count = 0
  								for _, hero in pairs(self.heros) do
  									if cfg.condition2 <= hero:getProperty("wakeL") then
  										count = count + 1
  									end
  								end
366dcc54   liuzujun   日历活动bug
754
  								if (calTask[id] or 0) < count then
b3f13e56   liuzujun   英雄令英雄收集相关任务
755
756
757
  									calTask[id] = count
  								end
  							elseif cfg.type == 18 then	-- 挂机累计收获id,y个
b3f13e56   liuzujun   英雄令英雄收集相关任务
758
759
760
761
762
763
  								for rid, v in pairs(param1) do
  									if cfg.condition2 == rid then
  										calTask[id] = (calTask[id] or 0) + v
  									end
  								end
  							elseif cfg.type == 19 then	-- x名英雄装备y品质以上符文套装
ffa0e259   liuzujun   日历活动 穿戴x个y品质铭文
764
765
766
767
768
  								local count = 0
  								for _, hero in pairs(self.heros) do
  									local rcount = 0
  									for _,uid in pairs(hero:getRunes()) do
  										if uid > 0 then
4bd3095f   liuzujun   英雄帖任务bug
769
  											local runeData = self.runeBag[uid]
9e5f9701   zhangqijia   feat: 玛尼的英雄帖增加任务类型
770
  											if runeData then
ffa0e259   liuzujun   日历活动 穿戴x个y品质铭文
771
772
773
774
775
776
777
778
779
780
781
782
783
  												local csvData = csvdb["runeCsv"][runeData:getProperty("type")][runeData:getProperty("id")]
  
  												if csvData and cfg.condition2 <= csvData.rarity then
  													rcount = rcount + 1
  												end
  											end
  										end
  									end
  									if rcount == 6 then
  										count = count + 1
  									end
  								end
  								calTask[id] = count
b3f13e56   liuzujun   英雄令英雄收集相关任务
784
  							elseif cfg.type == 20 then	-- 开启x品质时钟箱子
ffa0e259   liuzujun   日历活动 穿戴x个y品质铭文
785
  								if cfg.condition2 <= (param2 or 0) then
dfa9ae5e   liuzujun   战令任务活动
786
  									calTask[id] = (calTask[id] or 0) + param1
ffa0e259   liuzujun   日历活动 穿戴x个y品质铭文
787
  								end
190e1415   liuzujun   英雄帖活动初始化
788
789
  							elseif cfg.type == 15 then -- 通关关卡
  								if (calTask[id] or 0) == 0 then
9e5f9701   zhangqijia   feat: 玛尼的英雄帖增加任务类型
790
  									if self:checkHangPass(cfg.condition2) then
190e1415   liuzujun   英雄帖活动初始化
791
  										calTask[id] = 1
9e5f9701   zhangqijia   feat: 玛尼的英雄帖增加任务类型
792
  									end
cc30a8b3   liuzujun   玛尼英雄帖任务类型7与15 bug
793
794
795
796
797
  									--local hangPass = self:getProperty("hangPass")
  									--local diff = math.floor(cfg.condition2 / 10000)
  									--if (hangPass[diff] or 0) >= cfg.condition2 then
  									--	calTask[id] = 1
  									--end
190e1415   liuzujun   英雄帖活动初始化
798
  								end
f76d63e1   liuzujun   联动任务活动
799
800
801
802
803
  							elseif cfg.type == 22 then	-- 电台任务出勤人数
  								calTask[id] = (calTask[id] or 0) + (param1 or 0)
  							elseif cfg.type == 24 then	-- 代理拾荒出勤人数
  								calTask[id] = (calTask[id] or 0) + (param1 or 0)
  							elseif cfg.type == 28 then	-- 完成指定任务
e6e49b45   liuzujun   一键领取成就奖励
804
  								--print(actId,param2, cfg.condition2, param1)
7b570ef2   liuzujun   新春活动任务
805
  								if actData.id == param2 and cfg.condition2 == param1 then
f76d63e1   liuzujun   联动任务活动
806
807
  									calTask[id] = (calTask[id] or 0) + 1
  								end
dfa9ae5e   liuzujun   战令任务活动
808
809
810
811
  							elseif cfg.type == 33 then	-- 获得指定类型道具多少个
  								if cfg.condition2 == param1 then
  									calTask[id] = (calTask[id] or 0) + (param2 or 0)
  								end
7b570ef2   liuzujun   新春活动任务
812
813
814
815
816
817
818
819
820
821
822
  							elseif cfg.type == 42 then	-- 获得指定id道具多少个
  								if cfg.condition2 == param1 then
  									calTask[id] = (calTask[id] or 0) + (param2 or 0)
  								end
  							elseif cfg.type == 6 then  -- 代理拾荒次数
  								if cfg.condition2 == 0 or (cfg.condition2 == 1 and param1) then
  									calTask[id] = (calTask[id] or 0) + 1
  								end
  							elseif cfg.type == 37 then -- 拾荒使用道具
  								if cfg.condition2 == param1 then
  									calTask[id] = (calTask[id] or 0) + (param2 or 0)
9e5f9701   zhangqijia   feat: 玛尼的英雄帖增加任务类型
823
  								end
7b570ef2   liuzujun   新春活动任务
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
  							elseif cfg.type == 38 then	-- 和指定建筑交互
  								local condArr = cfg.condition3:toArray(true, "=")
  								for i = 0, #condArr do
  									if condArr[i] == param1 then
  										calTask[id] = (calTask[id] or 0) + 1
  										break
  									end
  								end
  							elseif cfg.type == 39 then	-- 拾荒特定章节消灭敌人
  								local condArr = cfg.condition3:toArray(true, "=")
  								for i = 0, #condArr do
  									if condArr[i] == param1 then
  										calTask[id] = (calTask[id] or 0) + 1
  										break
  									end
  								end
  							elseif cfg.type == 40 then	-- 指定活动关卡通关
  								if cfg.condition2 == param1 then
  									calTask[id] = (calTask[id] or 0) + 1
  								end
  							elseif cfg.type == 41 then	-- 通关拾荒指定关卡
  								if cfg.condition2 == param1 then
  									calTask[id] = (calTask[id] or 0) + 1
  								end
6afa6078   liuzujun   爬塔成就bug
848
  							elseif cfg.type == 13 then	-- 挑战电波塔主塔
ea54a935   liuzujun   电波塔bug
849
  								if cfg.condition2 <= param1 and param2 == 1 then
6afa6078   liuzujun   爬塔成就bug
850
851
  									calTask[id] = (calTask[id] or 0) + 1
  								end
9e5f9701   zhangqijia   feat: 玛尼的英雄帖增加任务类型
852
853
854
855
856
857
858
859
  							elseif cfg.type == 44 then --玩家拥有拾荒者总星级达到xxx
  								local count = 0
  								for _, hero in pairs(self.heros) do
  									count = count + hero:getProperty("wakeL")
  								end
  								if (calTask[id] or 0) < count then
  									calTask[id] = count
  								end
b3f13e56   liuzujun   英雄令英雄收集相关任务
860
  							end
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
861
862
863
864
865
  						end
  					end
  				end
  			end
  		end
dfa9ae5e   liuzujun   战令任务活动
866
  		self:updateProperty({field = keyName, value = calTask, notNotify = notNotify})
7b570ef2   liuzujun   新春活动任务
867
868
869
870
871
872
873
874
875
876
877
878
879
  	end
  
  	function Role:checkCalendaTask(notNotify, mainType, subType, param1, param2)
  		--print("check calenda task", mainType, subType, param1, param2)
  		local actEnum = "CalendaTask"
  		local keyName = "calTask"
  		if not self.activity then return end
  		local open, actId = self.activity:isOpen(actEnum)
  		local actData = csvdb["activity_ctrlCsv"][actId]
  		if not actData then return end
  		if not open then return end
  
  		self:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2)
accf94c4   liuzujun   活动以类型标识,修改双倍活动bug
880
881
  	end
  
dfa9ae5e   liuzujun   战令任务活动
882
883
884
885
  	function Role:checkBattleCommandTask(notNotify, mainType, subType, param1, param2)
  		--print("check battle command task", mainType, subType, param1, param2)
  		local actEnum = "BattleCommandTask"
  		local keyName = "bcTask"
b620581a   liuzujun   战令活动,战令相关的任务活动
886
  		if not self.activity then return end
dfa9ae5e   liuzujun   战令任务活动
887
  		local open, actId = self.activity:isOpen(actEnum)
b620581a   liuzujun   战令活动,战令相关的任务活动
888
889
890
891
  		local actData = csvdb["activity_ctrlCsv"][actId]
  		if not actData then return end
  		if not open then return end
  
7b570ef2   liuzujun   新春活动任务
892
  		self:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2)
b620581a   liuzujun   战令活动,战令相关的任务活动
893
894
  	end
  
78e5b90e   liuzujun   完成需求:新玩家任务
895
896
897
898
899
900
901
902
903
904
905
906
907
  	function Role:checkNewUserTask(notNotify, mainType, subType, param1, param2)
  		--print("check new user task", mainType, subType, param1, param2)
  		local actEnum = "NewUserTask"
  		local keyName = "nbTask"
  		if not self.activity then return end
  		local open, actId = self.activity:isOpen(actEnum)
  		local actData = csvdb["activity_ctrlCsv"][actId]
  		if not actData then return end
  		if not open then return end
  
  		self:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2)
  	end
  
a5dc3b0e   chenyueqi   回归活动初版
908
909
910
911
912
913
914
915
916
  	function Role:checkReturnerTask(notNotify, mainType, subType, param1, param2)
  		-- print("check returner task", mainType, subType, param1, param2)
  		local returner = self:getProperty("returner") or {}
  		if not returner.time then return end
  		local actData = csvdb["activity_ctrlCsv"][76]
  		local keyName = "returner"
  		self:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2)
  	end
  
df622b85   liuzujun   魔鬼训练营相关
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
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
  	function Role:checkTraingCampTask(notNotify, mainType, subType, param1, param2)
  		local trainTask = self:getProperty("trainTask") or {}
  		param1 = param1 or 1
  
  		for id, cfg in pairs(csvdb["training_camp_taskCsv"]) do
  				if cfg.type == mainType then
  					if subType == 1 then	-- 增加数值
  						trainTask[id] = (trainTask[id] or 0) + param1
  					elseif subType == 2 then	-- 直接赋值
  						trainTask[id] = param1
  					elseif subType == 3 then	-- 自定义类型
  						if cfg.type == 1 then -- 通关关卡
  							if (trainTask[id] or 0) == 0 then
  								if self:checkHangPass(cfg.condition2) then
  									trainTask[id] = 1
  								end
  							end
  						elseif cfg.type == 2 then --玩家拥有SR拾荒者总星级达到xxx
  							local count = 0
  							for _, hero in pairs(self.heros) do
  								if hero:getRare() == HeroQuality.SR then
  									count = count + hero:getProperty("wakeL")
  								end
  							end
  							if (trainTask[id] or 0) < count then
  								trainTask[id] = count
  							end
  						elseif cfg.type == 3 then --玩家拥有SR拾荒者总星级达到xxx
  							local count = 0
  							for _, hero in pairs(self.heros) do
  								if hero:getRare() == HeroQuality.SSR then
  									count = count + hero:getProperty("wakeL")
  								end
  							end
  							if (trainTask[id] or 0) < count then
  								trainTask[id] = count
  							end
  						elseif cfg.type == 4 then	-- 消耗指定id道具多少个
  							if cfg.condition2 == param1 then
  								trainTask[id] = (trainTask[id] or 0) + (param2 or 0)
  							end
  						end
  					end
  				end
  		end
  		self:updateProperty({field = "trainTask", value = trainTask, notNotify = notNotify})
  	end
  
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
965
966
  end
  
a25b4535   liuzujun   fix conflict
967
  return RoleTask