Selaa lähdekoodia

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

huangyuhao80 6 päivää sitten
vanhempi
commit
2f68a7a79b

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

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

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

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

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

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

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

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