difenduandada
2024-12-31 34abe6963b344c882358274957f4b992456fee40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
var PartnerConst = require("partner_const")
var ActionConst = require("action_const");
var RoleController = require("role_controller");
var RoleEvent = require("role_event");
var AdventureActivityController = require("adventureactivity_controller");
var AdventureActivityConst= require("adventureactivity_const");
 
var SysController = cc.Class({
    extends: BaseController,
 
    ctor: function () {
        this.initAttrProtocalsFunList();
    },
 
    registerEvents: function() {
        this.role_vo = RoleController.getInstance().getRoleVo();
        if (this.role_vo) {
            this.role_assets_event = this.role_vo.bind(EventId.UPDATE_ROLE_ATTRIBUTE, function(key, value){
                if(key == "lev" || key == "open_day"){
                    this.requestAttrProtocals();
                }
            }.bind(this))
        }
 
        this.login_event_success = gcore.GlobalEvent.bind(EventId.EVT_RE_LINK_GAME, (function () {
            var GuideController = require("guide_controller");
            if  (!RoleController.getInstance().checkRoleSetNameViewIsOpen() && !GuideController.getInstance().isInGuide()){ // 取名界面没打开,并且不在引导中,则跳到主城
                var MainuiController = require("mainui_controller");
                var MainuiConst = require("mainui_const");
                MainuiController.getInstance().changeMainUIStatus(MainuiConst.btn_index.main_scene);
            }
            this.resetAttrProtocals();
            this.requestReLinkProtocals();            
        }).bind(this))        
    },
 
    // 登陆时请求的协议
    requestLoginProtocals: function(finish_cb) {
        var function_list = [
            // function () { this.SendProtocal(10906, {}) }.bind(this),   // 开服天数
            // function () { this.SendProtocal(10380, {}) }.bind(this),   // 开服时间
            function () { this.SendProtocal(24600, {}) }.bind(this),   // 问卷
            function () {
                var id = 0;
                if (PLATFORM_TYPR == "SH_SDK") {//深海小程序
                    id = 1;
                }
                this.SendProtocal(16691, {id:id})
            }.bind(this),   // 爱微游分享状态
            function () {
                var id = 0;
                if (PLATFORM_TYPR == "SH_SDK") {//深海小程序
                    id = 1;
                }
                this.SendProtocal(16693, {id:id})
            }.bind(this),   // 爱微游关注状态
 
            function () {
                if (PLATFORM_TYPR == "SH_SDK") {//深海小程序
                    this.SendProtocal(16695, {})
                }
            }.bind(this),   // 深海小程序收藏状态
 
            
            function () { this.SendProtocal(10500, {}) }.bind(this),   // 背包
            function () { this.SendProtocal(10501, {}) }.bind(this),   // 背包
            function () { this.SendProtocal(10325, {}) }.bind(this),   // 头像信息
            function () { this.SendProtocal(13006, {}) }.bind(this),   // 剧情副本基础信息
            function () { this.SendProtocal(13008, {}) }.bind(this),   // 剧情副本通关奖励
            function () { this.SendProtocal(13011, {}) }.bind(this),   // 剧情副本Buff数据
            function () { this.SendProtocal(13017, {}) }.bind(this),   // 剧情副本挂机数据
            // function () { this.SendProtocal(10905, {}) }.bind(this),   // 世界等级
            function () { this.SendProtocal(20700, {}) }.bind(this),   // 星河神殿挑战次数
            function () { this.SendProtocal(30001, {}) }.bind(this),   // 新主线任务
            function () { this.SendProtocal(10317, {}) }.bind(this),   // 点赞数量
            function () { this.SendProtocal(21100, {}) }.bind(this),   // 七天登陆
            function () { this.SendProtocal(13601, {}) }.bind(this),   // 七日目标
            function () { this.SendProtocal(16637, {}) }.bind(this),   // 探宝
            function () { this.SendProtocal(24700, {}) }.bind(this),   // 基金
            function () { this.SendProtocal(21012, {}) }.bind(this),   // 首充
            function () { this.SendProtocal(21010, {}) }.bind(this),   // 每日首充
            // function () { this.SendProtocal(25000, {}) }.bind(this),   // 元素圣殿
            function () { this.SendProtocal(23606, {}) }.bind(this),   // 点金
            function () { this.SendProtocal(24204, {}) }.bind(this),   // 公会战状态
            function () { this.SendProtocal(24220, {}) }.bind(this),   // 公会战宝箱
            // function () { this.SendProtocal(22200, {}) }.bind(this),   // 圣物
            // function () { this.SendProtocal(24125, {}) }.bind(this),   // 神器幻化
            // function () { this.SendProtocal(24128, {}) }.bind(this),   // 神器任务
            function () { this.SendProtocal(11000, {}) }.bind(this),   // 英雄数据
            function () { this.SendProtocal(11040, {}) }.bind(this),   // 英雄图鉴
            function () { this.SendProtocal(11037, {}) }.bind(this),   // 符文祝福
            function () { this.SendProtocal(11213, {type_list: [{type: PartnerConst.Fun_Form.Drama}, {type: PartnerConst.Fun_Form.Arena}]}) }.bind(this),     // 阵法
            function () { this.SendProtocal(24410, {}) }.bind(this),   // 远征红点
            // function () { this.SendProtocal(24411, {}) }.bind(this),   // 远征派遣红点
            function () { this.SendProtocal(24400, {}) }.bind(this),   // 远征数据
            function () { this.SendProtocal(24405, {}) }.bind(this),   // 远征支援
            function () { this.SendProtocal(19807, {}) }.bind(this),   // 邀请码(自己绑定的角色)
            function () { this.SendProtocal(19804, {}) }.bind(this),   // 邀请码红点
            function () { this.SendProtocal(19800, {}) }.bind(this),   // 邀请码
            function () { this.SendProtocal(19802, {}) }.bind(this),   // 邀请码
            // function () { this.SendProtocal(24312, {}) }.bind(this),   // 天梯是否开启
            function () { this.SendProtocal(10800, {}) }.bind(this),   // 邮件
            function () { this.SendProtocal(10926, {}) }.bind(this),   // 在线奖励
            function () { this.SendProtocal(23200, {}) }.bind(this),   // 召唤数据
            function () { this.SendProtocal(23214, {}) }.bind(this),   // 英雄置换
            // function () { this.SendProtocal(13604, {}) }.bind(this),   // 七日目标任务
            // function () { this.SendProtocal(13607, {}) }.bind(this),   // 七日目标等级奖励
            function () { this.SendProtocal(13030, {}) }.bind(this),   // 材料副本
            function () { this.SendProtocal(10400, {}) }.bind(this),   // 任务列表
            function () { this.SendProtocal(16400, {}) }.bind(this),   // 成就列表
            function () { this.SendProtocal(20300, {}) }.bind(this),   // 活跃度
            function () { this.SendProtocal(19906, {}) }.bind(this),   // 录像馆点赞
            function () { this.SendProtocal(16707, {}) }.bind(this),   // 月卡奖励
            function () { this.SendProtocal(16710, {}) }.bind(this),   // VIP礼包红点
            function () { this.SendProtocal(16712, {}) }.bind(this),   // 累充红点
            function () { this.SendProtocal(30102, {}) }.bind(this),   // 皮肤购买红点
            function () { this.SendProtocal(21006, {}) }.bind(this),   // 每日礼包
            function () { this.SendProtocal(24502, {}) }.bind(this),   // 特权礼包
            function () { this.SendProtocal(14100, {}) }.bind(this),   // 签到红点
            function () { this.SendProtocal(16705, {}) }.bind(this),   // 月卡信息
            function () { this.SendProtocal(21008, {}) }.bind(this),   // 每日礼
            function () { this.SendProtocal(16635, {}) }.bind(this),   // 手机绑定奖励状态
            function () { this.SendProtocal(16697, {}) }.bind(this),   // 手机绑定奖励状态
            function () { this.SendProtocal(16633, {}) }.bind(this),   // 微信公众号状态
            function () { this.SendProtocal(23205, {}) }.bind(this),   // 召唤5星必出
            function () { this.SendProtocal(13040, {}) }.bind(this),   // 快速作战
            
            function () { this.SendProtocal(11320, {}) }.bind(this),   // 星命塔数据
            // function () { this.SendProtocal(20706, {}) }.bind(this),   // 星河神殿每天第一次登录红点
            function () { this.SendProtocal(16687, {bid: ActionConst.ActionRankCommonType.open_server}) }.bind(this),      // 新服限购
            function () { this.SendProtocal(16687, {bid: ActionConst.ActionRankCommonType.high_value_gift}) }.bind(this),  // 小额礼包
            function () { this.SendProtocal(16687, {bid: ActionConst.ActionRankCommonType.mysterious_store}) }.bind(this), // 神秘杂货店
            function () { this.SendProtocal(21020, {} )}.bind(this), // 每日1元
            // function () { this.SendProtocal(25200, {}) }.bind(this),   // 天界副本
            // function () { this.SendProtocal(25219, {}) }.bind(this),   // 神装转盘
            function () { this.SendProtocal(25300, {}) }.bind(this),   // 战令活动
            function () { this.SendProtocal(25303, {}) }.bind(this),
            function () { this.SendProtocal(16730, {}) }.bind(this), //赠送VIP
            
            function () {this.guildRedBagProtocal() }.bind(this),     // 公会红包
            function () {this.adventrueProtocal() }.bind(this),       // 冒险
            function () {this.endlessProtocal() }.bind(this),         // 无尽试炼
            function () {this.voyageProtocal() }.bind(this),          // 远航     
            function () { this.SendProtocal(19804, {}) }.bind(this),          // 邀请码红点     
            
        ]
 
        var cur_index = 0;
        this.ping_timer_id = gcore.Timer.set(function() {
            function_list[cur_index]();
            cur_index ++;
            // game.updateProtoProgress(cur_index / function_list.length);
            if (cur_index == function_list.length -1) {
                if (finish_cb)
                    finish_cb();
            }
 
        }.bind(this), 20, function_list.length)
    },
 
    requestReLinkProtocals: function() {
        var function_list = [
            function () { this.SendProtocal(10500, {}) }.bind(this),   // 开服天数
            function () { this.SendProtocal(10501, {}) }.bind(this),   // 开服时间
            function () { this.SendProtocal(13006, {}) }.bind(this),   // 问卷
            function () { this.SendProtocal(13008, {}) }.bind(this),   // 开服天数
            function () { this.SendProtocal(13011, {}) }.bind(this),   // 开服时间
            function () { this.SendProtocal(13017, {}) }.bind(this),   // 问卷
            // function () { this.SendProtocal(25000, {}) }.bind(this),   // 开服时间
            function () { this.SendProtocal(24204, {}) }.bind(this),   // 问卷
            function () { this.SendProtocal(11000, {}) }.bind(this),   // 开服时间
            function () { this.SendProtocal(11040, {}) }.bind(this),   // 问卷
            function () { this.SendProtocal(11037, {}) }.bind(this),   // 开服天数
            function () { this.SendProtocal(11213, {type_list: [{type: PartnerConst.Fun_Form.Drama}, {type: PartnerConst.Fun_Form.Arena}]}) }.bind(this),     // 阵法
            function () { this.SendProtocal(24410, {}) }.bind(this),   // 问卷
            // function () { this.SendProtocal(24411, {}) }.bind(this),   // 开服天数
            function () { this.SendProtocal(24400, {}) }.bind(this),   // 开服时间
            function () { this.SendProtocal(24405, {}) }.bind(this),   // 问卷
            // function () { this.SendProtocal(24312, {}) }.bind(this),   // 开服时间
            function () { this.SendProtocal(23200, {}) }.bind(this),   // 问卷
            function () { this.SendProtocal(10400, {}) }.bind(this),   // 开服时间
            function () { this.SendProtocal(16400, {}) }.bind(this),   // 问卷
            function () { this.SendProtocal(20300, {}) }.bind(this),   // 开服天数
            // function () { this.SendProtocal(19906, {}) }.bind(this),   // 开服时间
            function () { this.SendProtocal(21006, {}) }.bind(this),   // 问卷
            function () { this.SendProtocal(16705, {}) }.bind(this),   // 开服天数
            function () { this.SendProtocal(24700, {}) }.bind(this),   // 开服时间
            function () { this.SendProtocal(25300, {}) }.bind(this),   // 战令任务红点
 
            function () { this.guildRedBagProtocal() }.bind(this),     // 公会红包
            function () { this.adventrueProtocal() }.bind(this),       // 冒险
            function () { this.endlessProtocal() }.bind(this),         // 无尽试炼
            function () { this.voyageProtocal() }.bind(this),           // 远航
            function () { this.arenaProtocal() }.bind(this),           // 竞技场
            function () { this.SendProtocal(30001, {}) }.bind(this),   // 新主线任务
            
        ]
 
        var cur_index = 0;
        this.ping_timer_id = gcore.Timer.set(function() {
            function_list[cur_index]();
            cur_index ++;
        }.bind(this), 10, function_list.length)
 
    },
 
    /******************以下是一些特殊的协议请求*********************/
 
    initAttrProtocalsFunList: function(force) {
        if (force || !this.attr_fun_list) {
            this.attr_fun_list = [
                {func: function () {this.adventrueProtocal()}.bind(this), req_flag: false},
                {func: function () {this.arenaProtocal() }.bind(this), req_flag: false},            
                {func: function () {this.endlessProtocal() }.bind(this), req_flag: false},         
                {func: function () {this.voyageProtocal() }.bind(this), req_flag: false},
            ]
        }
    },
 
    // 检测是否请求过数据
    checkProtocalIsCanRequest: function(id) {
        if (this.attr_fun_list && this.attr_fun_list[id] && !this.attr_fun_list[id].req_flag)
            return true
        return false
    },
 
    // 公会红包(只需要登陆和断线时请求,加入公会时,后端会主动推)
    guildRedBagProtocal: function() {
        if (this.role_vo && this.role_vo.gid != 0 && this.role_vo.gsrv_id != "")
            this.SendProtocal(13534, {})
    },
 
    // 冒险的协议请求
    adventrueProtocal: function(forces) {
        var is_open = forces;
        if(is_open == null){
            is_open = AdventureActivityController.getInstance().isOpenActivity(AdventureActivityConst.Ground_Type.adventure);
        }
        if(is_open == false)return;
        if(!this.checkProtocalIsCanRequest(0))return;
        
        this.SendProtocal(20600, {})  // 冒险基础信息
        this.SendProtocal(20601, {})  // 冒险buff信息
        this.SendProtocal(20604, {})  // 冒险伙伴信息数据
        this.SendProtocal(20634, {})  // 冒险宝箱
        if(this.attr_fun_list[0]){
            this.attr_fun_list[0].req_flag = true;
        }
    },
 
    endlessProtocal: function() {
        var open_config = Config.endless_data.data_const.open_lev;
        if (!open_config) return;
        var MainuiController = require("mainui_controller");
        var is_open = MainuiController.getInstance().checkIsOpenByActivate(open_config.val);
        if (!is_open) return
        if (!this.checkProtocalIsCanRequest(2)) return;
 
        this.SendProtocal(23900, {})
        this.SendProtocal(23903, {})
        this.SendProtocal(23906, {})
        if (this.attr_fun_list[2])
            this.attr_fun_list[2].req_flag = true;
    },
 
    // 远航协议请求
    voyageProtocal: function() {
        var lev_config = Config.shipping_data.data_const["guild_lev"];
        if (!lev_config || !this.role_vo || lev_config.val > this.role_vo.lev)
            return
 
        if (!this.checkProtocalIsCanRequest(3)) return;
 
        this.SendProtocal(23800, {})
        this.SendProtocal(23805, {})
        this.SendProtocal(23821, {})
 
        if (this.attr_fun_list[3])
            this.attr_fun_list[3].req_flag = true;
 
    },
 
    resetAttrProtocals: function() {
        this.initAttrProtocalsFunList(true);
    },
 
    requestAttrProtocals: function() {
        if (!this.attr_fun_list) return;
 
        for (var fun_i in this.attr_fun_list) {
            var fun_info = this.attr_fun_list[fun_i];
            if (!fun_info.req_flag) {
                fun_info.func();
            }
        }
    },
    //竞技场的协议请求
    arenaProtocal: function() {
        var config = Config.arena_data.data_const.limit_lev;
        if (!config || !this.role_vo || this.role_vo.lev < config.val)
            return
 
        if (!this.checkProtocalIsCanRequest(1)) return
 
        this.SendProtocal(20208, {})
        this.SendProtocal(20200, {})
        this.SendProtocal(20250, {})
        this.SendProtocal(20223, {})
        if (this.attr_fun_list[1])
            this.attr_fun_list[1].req_flag = true
    },
})
 
module.exports = SysController;