Procházet zdrojové kódy

修改首充活动,月卡活动事件注册

huangyuhao80 před 6 dny
rodič
revize
2f68a7a79b

+ 2 - 2
meta/userapi/lua/ActFirstRecharge.lua

@@ -3,7 +3,7 @@ ActFirstRecharge = {}
3
 ActFirstRecharge.__index = ActFirstRecharge
3
 ActFirstRecharge.__index = ActFirstRecharge
4
 
4
 
5
 local function _rechargeType()
5
 local function _rechargeType()
6
-    return "0"
6
+    return "21"
7
 end
7
 end
8
 
8
 
9
 local function _playerDbKey()
9
 local function _playerDbKey()
@@ -107,6 +107,6 @@ end
107
 --TODO 一定要放到文件最后
107
 --TODO 一定要放到文件最后
108
 EventListerTable.registerType("首充活动", _rechargeType(), _playerDbKey())
108
 EventListerTable.registerType("首充活动", _rechargeType(), _playerDbKey())
109
 --注册充值事件
109
 --注册充值事件
110
-RechargeEventListerTable:eventLister(_rechargeType(), "首充活动", ActFirstRecharge.rechargeEvent)
110
+RechargeEventListerTable:eventLister("0", "首充活动", ActFirstRecharge.rechargeEvent)
111
 -- 注册请求消息监听
111
 -- 注册请求消息监听
112
 RechargeMessageEventListerTable:eventLister(_rechargeType(), "首充活动", ActFirstRecharge.reqAction)
112
 RechargeMessageEventListerTable:eventLister(_rechargeType(), "首充活动", ActFirstRecharge.reqAction)

+ 1 - 1
meta/userapi/lua/ActMonthlyGrow.lua

@@ -3,7 +3,7 @@ ActMonthlyGrow = {}
3
 ActMonthlyGrow.__index = ActMonthlyGrow
3
 ActMonthlyGrow.__index = ActMonthlyGrow
4
 
4
 
5
 local function _rechargeType()
5
 local function _rechargeType()
6
-    return "2"
6
+    return "22"
7
 end
7
 end
8
 
8
 
9
 local function _playerDbKey()
9
 local function _playerDbKey()

+ 83 - 64
meta/userapi/lua/ActivityManager.lua

@@ -6,9 +6,11 @@ local this = {}
6
 
6
 
7
 -- 活动类型
7
 -- 活动类型
8
 local ACTIVITY_TYPE = {
8
 local ACTIVITY_TYPE = {
9
-    WORLD_BOSS = 1,    -- 世界BOSS争夺战
10
-    SIEGE_WAR = 2,     -- 攻城战
11
-    MONSTER_LEGION = 3 -- 怪物军团
9
+    WORLD_BOSS = 1, -- 世界BOSS争夺战
10
+    SIEGE_WAR = 2, -- 攻城战
11
+    MONSTER_LEGION = 3, -- 怪物军团
12
+    FIRST_RECHARGE = 4, -- 首充活动
13
+    MONTHLY_GROW = 5 -- 月卡活动
12
 }
14
 }
13
 
15
 
14
 -- 活动配置
16
 -- 活动配置
@@ -30,13 +32,25 @@ local ACTIVITY_CONFIG = {
30
         description = "每周三、周五晚上7点开启,抵御怪物入侵",
32
         description = "每周三、周五晚上7点开启,抵御怪物入侵",
31
         module = MonsterLegion,
33
         module = MonsterLegion,
32
         enabled = true
34
         enabled = true
35
+    },
36
+    [ACTIVITY_TYPE.FIRST_RECHARGE] = {
37
+        name = "首充活动",
38
+        description = "首充送体验天使",
39
+        module = ActFirstRecharge,
40
+        enabled = true
41
+    },
42
+    [ACTIVITY_TYPE.MONTHLY_GROW] = {
43
+        name = "月卡活动",
44
+        description = "购买送经验,金币,挂机加成",
45
+        module = ActMonthlyGrow,
46
+        enabled = true
33
     }
47
     }
34
 }
48
 }
35
 
49
 
36
 -- 初始化所有活动系统
50
 -- 初始化所有活动系统
37
 function this.Init()
51
 function this.Init()
38
     info("活动管理器初始化开始")
52
     info("活动管理器初始化开始")
39
-    
53
+
40
     -- 初始化各个活动系统
54
     -- 初始化各个活动系统
41
     for activityType, config in pairs(ACTIVITY_CONFIG) do
55
     for activityType, config in pairs(ACTIVITY_CONFIG) do
42
         if config.enabled and config.module and config.module.Init then
56
         if config.enabled and config.module and config.module.Init then
@@ -48,27 +62,30 @@ function this.Init()
48
             end
62
             end
49
         end
63
         end
50
     end
64
     end
51
-    
65
+
52
     -- 启动活动检查定时器
66
     -- 启动活动检查定时器
53
     this.StartActivityCheckTimer()
67
     this.StartActivityCheckTimer()
54
-    
68
+
55
     info("活动管理器初始化完成")
69
     info("活动管理器初始化完成")
56
 end
70
 end
57
 
71
 
58
 -- 启动活动检查定时器
72
 -- 启动活动检查定时器
59
 function this.StartActivityCheckTimer()
73
 function this.StartActivityCheckTimer()
60
     -- 每30秒检查一次活动状态
74
     -- 每30秒检查一次活动状态
61
-    setTimer(30000, function()
62
-        this.CheckAllActivities()
63
-    end)
75
+    setTimer(
76
+        30000,
77
+        function()
78
+            this.CheckAllActivities()
79
+        end
80
+    )
64
 end
81
 end
65
 
82
 
66
 -- 检查所有活动状态
83
 -- 检查所有活动状态
67
 function this.CheckAllActivities()
84
 function this.CheckAllActivities()
68
     for activityType, config in pairs(ACTIVITY_CONFIG) do
85
     for activityType, config in pairs(ACTIVITY_CONFIG) do
69
         if config.enabled and config.module then
86
         if config.enabled and config.module then
70
-            -- 这里可以添加活动状态检查逻辑
71
-            -- 例如:检查活动是否异常、是否需要重启等
87
+        -- 这里可以添加活动状态检查逻辑
88
+        -- 例如:检查活动是否异常、是否需要重启等
72
         end
89
         end
73
     end
90
     end
74
 end
91
 end
@@ -79,7 +96,7 @@ function this.GetActivityInfo(activityType)
79
     if not config or not config.enabled then
96
     if not config or not config.enabled then
80
         return nil
97
         return nil
81
     end
98
     end
82
-    
99
+
83
     local module = config.module
100
     local module = config.module
84
     local info = {
101
     local info = {
85
         type = activityType,
102
         type = activityType,
@@ -90,34 +107,34 @@ function this.GetActivityInfo(activityType)
90
         timeRemaining = 0,
107
         timeRemaining = 0,
91
         participants = 0
108
         participants = 0
92
     }
109
     }
93
-    
110
+
94
     -- 获取活动状态
111
     -- 获取活动状态
95
     if module.GetActivityStatus then
112
     if module.GetActivityStatus then
96
         info.status = module.GetActivityStatus()
113
         info.status = module.GetActivityStatus()
97
     end
114
     end
98
-    
115
+
99
     -- 获取当前阶段
116
     -- 获取当前阶段
100
     if module.GetCurrentPhase then
117
     if module.GetCurrentPhase then
101
         info.phase = module.GetCurrentPhase()
118
         info.phase = module.GetCurrentPhase()
102
     end
119
     end
103
-    
120
+
104
     -- 获取剩余时间
121
     -- 获取剩余时间
105
     if module.GetActivityRemainingTime then
122
     if module.GetActivityRemainingTime then
106
         info.timeRemaining = module.GetActivityRemainingTime()
123
         info.timeRemaining = module.GetActivityRemainingTime()
107
     end
124
     end
108
-    
125
+
109
     -- 获取参与人数
126
     -- 获取参与人数
110
     if module.GetParticipantCount then
127
     if module.GetParticipantCount then
111
         info.participants = module.GetParticipantCount()
128
         info.participants = module.GetParticipantCount()
112
     end
129
     end
113
-    
130
+
114
     return info
131
     return info
115
 end
132
 end
116
 
133
 
117
 -- 获取所有活动信息
134
 -- 获取所有活动信息
118
 function this.GetAllActivitiesInfo()
135
 function this.GetAllActivitiesInfo()
119
     local activities = {}
136
     local activities = {}
120
-    
137
+
121
     for activityType, config in pairs(ACTIVITY_CONFIG) do
138
     for activityType, config in pairs(ACTIVITY_CONFIG) do
122
         if config.enabled then
139
         if config.enabled then
123
             local info = this.GetActivityInfo(activityType)
140
             local info = this.GetActivityInfo(activityType)
@@ -126,7 +143,7 @@ function this.GetAllActivitiesInfo()
126
             end
143
             end
127
         end
144
         end
128
     end
145
     end
129
-    
146
+
130
     return activities
147
     return activities
131
 end
148
 end
132
 
149
 
@@ -136,7 +153,7 @@ function this.StartActivity(activityType)
136
     if not config or not config.enabled then
153
     if not config or not config.enabled then
137
         return false, "活动不存在或已禁用"
154
         return false, "活动不存在或已禁用"
138
     end
155
     end
139
-    
156
+
140
     local module = config.module
157
     local module = config.module
141
     if module.StartActivity then
158
     if module.StartActivity then
142
         local success, err = pcall(module.StartActivity)
159
         local success, err = pcall(module.StartActivity)
@@ -158,7 +175,7 @@ function this.StopActivity(activityType)
158
     if not config or not config.enabled then
175
     if not config or not config.enabled then
159
         return false, "活动不存在或已禁用"
176
         return false, "活动不存在或已禁用"
160
     end
177
     end
161
-    
178
+
162
     local module = config.module
179
     local module = config.module
163
     if module.EndActivity then
180
     if module.EndActivity then
164
         local success, err = pcall(module.EndActivity)
181
         local success, err = pcall(module.EndActivity)
@@ -180,9 +197,9 @@ function this.PlayerJoinActivity(actor, activityType)
180
     if not config or not config.enabled then
197
     if not config or not config.enabled then
181
         return false, "活动不存在或已禁用"
198
         return false, "活动不存在或已禁用"
182
     end
199
     end
183
-    
200
+
184
     local module = config.module
201
     local module = config.module
185
-    
202
+
186
     -- 根据活动类型调用相应的报名函数
203
     -- 根据活动类型调用相应的报名函数
187
     if activityType == ACTIVITY_TYPE.WORLD_BOSS then
204
     if activityType == ACTIVITY_TYPE.WORLD_BOSS then
188
         if module.PlayerRegister then
205
         if module.PlayerRegister then
@@ -197,7 +214,7 @@ function this.PlayerJoinActivity(actor, activityType)
197
             return module.PlayerRegister(actor)
214
             return module.PlayerRegister(actor)
198
         end
215
         end
199
     end
216
     end
200
-    
217
+
201
     return false, "活动不支持报名功能"
218
     return false, "活动不支持报名功能"
202
 end
219
 end
203
 
220
 
@@ -207,13 +224,13 @@ function this.CanPlayerJoinActivity(actor, activityType)
207
     if not config or not config.enabled then
224
     if not config or not config.enabled then
208
         return false, "活动不存在或已禁用"
225
         return false, "活动不存在或已禁用"
209
     end
226
     end
210
-    
227
+
211
     local module = config.module
228
     local module = config.module
212
-    
229
+
213
     if module.CanPlayerParticipate then
230
     if module.CanPlayerParticipate then
214
         return module.CanPlayerParticipate(actor)
231
         return module.CanPlayerParticipate(actor)
215
     end
232
     end
216
-    
233
+
217
     return false, "活动不支持参与检查"
234
     return false, "活动不支持参与检查"
218
 end
235
 end
219
 
236
 
@@ -223,9 +240,9 @@ function this.GetActivityRanking(activityType, rankingType)
223
     if not config or not config.enabled then
240
     if not config or not config.enabled then
224
         return {}
241
         return {}
225
     end
242
     end
226
-    
243
+
227
     local module = config.module
244
     local module = config.module
228
-    
245
+
229
     if rankingType == "player" then
246
     if rankingType == "player" then
230
         if module.GetPlayerScoreRanking then
247
         if module.GetPlayerScoreRanking then
231
             return module.GetPlayerScoreRanking()
248
             return module.GetPlayerScoreRanking()
@@ -239,7 +256,7 @@ function this.GetActivityRanking(activityType, rankingType)
239
             return module.GetAllianceDamageRanking()
256
             return module.GetAllianceDamageRanking()
240
         end
257
         end
241
     end
258
     end
242
-    
259
+
243
     return {}
260
     return {}
244
 end
261
 end
245
 
262
 
@@ -249,34 +266,34 @@ function this.GetActivityDetailedStatus(activityType)
249
     if not config or not config.enabled then
266
     if not config or not config.enabled then
250
         return nil
267
         return nil
251
     end
268
     end
252
-    
269
+
253
     local module = config.module
270
     local module = config.module
254
     local status = {
271
     local status = {
255
         type = activityType,
272
         type = activityType,
256
         name = config.name,
273
         name = config.name,
257
         enabled = config.enabled
274
         enabled = config.enabled
258
     }
275
     }
259
-    
276
+
260
     -- 获取活动状态
277
     -- 获取活动状态
261
     if module.GetActivityStatus then
278
     if module.GetActivityStatus then
262
         status.status = module.GetActivityStatus()
279
         status.status = module.GetActivityStatus()
263
     end
280
     end
264
-    
281
+
265
     -- 获取当前阶段
282
     -- 获取当前阶段
266
     if module.GetCurrentPhase then
283
     if module.GetCurrentPhase then
267
         status.phase = module.GetCurrentPhase()
284
         status.phase = module.GetCurrentPhase()
268
     end
285
     end
269
-    
286
+
270
     -- 获取剩余时间
287
     -- 获取剩余时间
271
     if module.GetActivityRemainingTime then
288
     if module.GetActivityRemainingTime then
272
         status.timeRemaining = module.GetActivityRemainingTime()
289
         status.timeRemaining = module.GetActivityRemainingTime()
273
     end
290
     end
274
-    
291
+
275
     -- 获取参与人数
292
     -- 获取参与人数
276
     if module.GetParticipantCount then
293
     if module.GetParticipantCount then
277
         status.participants = module.GetParticipantCount()
294
         status.participants = module.GetParticipantCount()
278
     end
295
     end
279
-    
296
+
280
     -- 根据活动类型获取特定信息
297
     -- 根据活动类型获取特定信息
281
     if activityType == ACTIVITY_TYPE.WORLD_BOSS then
298
     if activityType == ACTIVITY_TYPE.WORLD_BOSS then
282
         if module.GetBossHPInfo then
299
         if module.GetBossHPInfo then
@@ -297,7 +314,7 @@ function this.GetActivityDetailedStatus(activityType)
297
             status.stats = module.GetActivityStats()
314
             status.stats = module.GetActivityStats()
298
         end
315
         end
299
     end
316
     end
300
-    
317
+
301
     return status
318
     return status
302
 end
319
 end
303
 
320
 
@@ -307,13 +324,13 @@ function this.SendActivityNotice(activityType, message)
307
     if not config or not config.enabled then
324
     if not config or not config.enabled then
308
         return false
325
         return false
309
     end
326
     end
310
-    
327
+
311
     local module = config.module
328
     local module = config.module
312
     if module.SendWorldNotice then
329
     if module.SendWorldNotice then
313
         module.SendWorldNotice(message)
330
         module.SendWorldNotice(message)
314
         return true
331
         return true
315
     end
332
     end
316
-    
333
+
317
     return false
334
     return false
318
 end
335
 end
319
 
336
 
@@ -323,7 +340,7 @@ function this.GetActivityConfig(activityType)
323
     if not config then
340
     if not config then
324
         return nil
341
         return nil
325
     end
342
     end
326
-    
343
+
327
     return {
344
     return {
328
         type = activityType,
345
         type = activityType,
329
         name = config.name,
346
         name = config.name,
@@ -335,11 +352,11 @@ end
335
 -- 获取所有活动配置
352
 -- 获取所有活动配置
336
 function this.GetAllActivityConfigs()
353
 function this.GetAllActivityConfigs()
337
     local configs = {}
354
     local configs = {}
338
-    
355
+
339
     for activityType, config in pairs(ACTIVITY_CONFIG) do
356
     for activityType, config in pairs(ACTIVITY_CONFIG) do
340
         table.insert(configs, this.GetActivityConfig(activityType))
357
         table.insert(configs, this.GetActivityConfig(activityType))
341
     end
358
     end
342
-    
359
+
343
     return configs
360
     return configs
344
 end
361
 end
345
 
362
 
@@ -349,15 +366,15 @@ function this.SetActivityEnabled(activityType, enabled)
349
     if not config then
366
     if not config then
350
         return false, "活动不存在"
367
         return false, "活动不存在"
351
     end
368
     end
352
-    
369
+
353
     config.enabled = enabled
370
     config.enabled = enabled
354
-    
371
+
355
     if enabled then
372
     if enabled then
356
         info("活动已启用:", config.name)
373
         info("活动已启用:", config.name)
357
     else
374
     else
358
         info("活动已禁用:", config.name)
375
         info("活动已禁用:", config.name)
359
     end
376
     end
360
-    
377
+
361
     return true
378
     return true
362
 end
379
 end
363
 
380
 
@@ -367,14 +384,14 @@ function this.RestartActivitySystem(activityType)
367
     if not config or not config.enabled then
384
     if not config or not config.enabled then
368
         return false, "活动不存在或已禁用"
385
         return false, "活动不存在或已禁用"
369
     end
386
     end
370
-    
387
+
371
     local module = config.module
388
     local module = config.module
372
-    
389
+
373
     -- 停止当前活动
390
     -- 停止当前活动
374
     if module.EndActivity then
391
     if module.EndActivity then
375
         pcall(module.EndActivity)
392
         pcall(module.EndActivity)
376
     end
393
     end
377
-    
394
+
378
     -- 重新初始化
395
     -- 重新初始化
379
     if module.Init then
396
     if module.Init then
380
         local success, err = pcall(module.Init)
397
         local success, err = pcall(module.Init)
@@ -386,7 +403,7 @@ function this.RestartActivitySystem(activityType)
386
             return false, "活动系统重启失败:" .. err
403
             return false, "活动系统重启失败:" .. err
387
         end
404
         end
388
     end
405
     end
389
-    
406
+
390
     return false, "活动模块不支持重启功能"
407
     return false, "活动模块不支持重启功能"
391
 end
408
 end
392
 
409
 
@@ -398,26 +415,29 @@ function this.GetActivityStatistics()
398
         activeActivities = 0,
415
         activeActivities = 0,
399
         activities = {}
416
         activities = {}
400
     }
417
     }
401
-    
418
+
402
     for activityType, config in pairs(ACTIVITY_CONFIG) do
419
     for activityType, config in pairs(ACTIVITY_CONFIG) do
403
         stats.totalActivities = stats.totalActivities + 1
420
         stats.totalActivities = stats.totalActivities + 1
404
-        
421
+
405
         if config.enabled then
422
         if config.enabled then
406
             stats.enabledActivities = stats.enabledActivities + 1
423
             stats.enabledActivities = stats.enabledActivities + 1
407
-            
424
+
408
             local status = this.GetActivityDetailedStatus(activityType)
425
             local status = this.GetActivityDetailedStatus(activityType)
409
             if status and status.status and status.status > 0 then
426
             if status and status.status and status.status > 0 then
410
                 stats.activeActivities = stats.activeActivities + 1
427
                 stats.activeActivities = stats.activeActivities + 1
411
             end
428
             end
412
-            
413
-            table.insert(stats.activities, {
414
-                type = activityType,
415
-                name = config.name,
416
-                status = status
417
-            })
429
+
430
+            table.insert(
431
+                stats.activities,
432
+                {
433
+                    type = activityType,
434
+                    name = config.name,
435
+                    status = status
436
+                }
437
+            )
418
         end
438
         end
419
     end
439
     end
420
-    
440
+
421
     return stats
441
     return stats
422
 end
442
 end
423
 
443
 
@@ -427,7 +447,7 @@ function this.CleanupActivityData(activityType)
427
     if not config or not config.enabled then
447
     if not config or not config.enabled then
428
         return false, "活动不存在或已禁用"
448
         return false, "活动不存在或已禁用"
429
     end
449
     end
430
-    
450
+
431
     local module = config.module
451
     local module = config.module
432
     if module.CleanupActivityData then
452
     if module.CleanupActivityData then
433
         local success, err = pcall(module.CleanupActivityData)
453
         local success, err = pcall(module.CleanupActivityData)
@@ -439,14 +459,14 @@ function this.CleanupActivityData(activityType)
439
             return false, "活动数据清理失败:" .. err
459
             return false, "活动数据清理失败:" .. err
440
         end
460
         end
441
     end
461
     end
442
-    
462
+
443
     return false, "活动模块不支持数据清理功能"
463
     return false, "活动模块不支持数据清理功能"
444
 end
464
 end
445
 
465
 
446
 -- 清理所有活动数据
466
 -- 清理所有活动数据
447
 function this.CleanupAllActivityData()
467
 function this.CleanupAllActivityData()
448
     local results = {}
468
     local results = {}
449
-    
469
+
450
     for activityType, config in pairs(ACTIVITY_CONFIG) do
470
     for activityType, config in pairs(ACTIVITY_CONFIG) do
451
         if config.enabled then
471
         if config.enabled then
452
             local success, message = this.CleanupActivityData(activityType)
472
             local success, message = this.CleanupActivityData(activityType)
@@ -456,10 +476,9 @@ function this.CleanupAllActivityData()
456
             }
476
             }
457
         end
477
         end
458
     end
478
     end
459
-    
479
+
460
     return results
480
     return results
461
 end
481
 end
462
 
482
 
463
 -- 导出模块
483
 -- 导出模块
464
 return this
484
 return this
465
-

+ 2 - 0
meta/userapi/lua/QFunction-0.lua

@@ -700,6 +700,7 @@ function login(play)
700
     gameDebug.debug(Player.onLoginEnd, play)
700
     gameDebug.debug(Player.onLoginEnd, play)
701
     gameDebug.debug(Transaction.onLoginEnd, play)
701
     gameDebug.debug(Transaction.onLoginEnd, play)
702
     -- gameDebug.debug( OperationalActivities.openActive, play)
702
     -- gameDebug.debug( OperationalActivities.openActive, play)
703
+    gameDebug.debug(ActMonthlyGrow.login, play)
703
 end
704
 end
704
 
705
 
705
 function exit(actor)
706
 function exit(actor)
@@ -1806,6 +1807,7 @@ function rolehourheart(actor)
1806
     end
1807
     end
1807
     -- 连击试炼增加副本次数
1808
     -- 连击试炼增加副本次数
1808
     ComboTest.roleHourHeart(actor)
1809
     ComboTest.roleHourHeart(actor)
1810
+    ActMonthlyGrow.midNightUpdate(actor)
1809
 end
1811
 end
1810
 
1812
 
1811
 --- 活动次数重置后触发
1813
 --- 活动次数重置后触发