113 lines
4.0 KiB
JavaScript
113 lines
4.0 KiB
JavaScript
|
|
// ////////////////////////////////////////////////////////////////////
|
||
|
|
// 这里填写简要说明(必填),
|
||
|
|
// @author. lwc@syg.com(必填, 创建模块的人员)
|
||
|
|
// @editor. xxx@syg.com(必填, 后续维护以及修改的人员)
|
||
|
|
// @description.
|
||
|
|
// 公会秘境 后端 国辉 策划 松岳
|
||
|
|
// <br/>Create. 2019年9月11日
|
||
|
|
// ////////////////////////////////////////////////////////////////////
|
||
|
|
const BridgeClass = require( "bridge.class" );
|
||
|
|
var GuildConst = require("guild_const");
|
||
|
|
var GuildEvent = require("guild_event");
|
||
|
|
|
||
|
|
var GuildsecretareaModel = cc.Class({
|
||
|
|
extends: BridgeClass,
|
||
|
|
ctor: function () {
|
||
|
|
var ctrl = require("guildsecretarea_controller");
|
||
|
|
this.ctrl = ctrl.getInstance();
|
||
|
|
},
|
||
|
|
|
||
|
|
initConfig: function () {
|
||
|
|
this.dic_boss_rank_info = {}
|
||
|
|
},
|
||
|
|
|
||
|
|
//公会秘境数据..用于判定红点用
|
||
|
|
updateSecretareaData: function (data) {
|
||
|
|
this.secretarea_data = data
|
||
|
|
this.checkRedPoint(true)
|
||
|
|
},
|
||
|
|
updateSecretareaBuyCount: function (data) {
|
||
|
|
if (data && this.secretarea_data) {
|
||
|
|
this.secretarea_data.count = data.count
|
||
|
|
this.secretarea_data.last_buy_time = data.last_buy_time
|
||
|
|
this.checkRedPoint(true)
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
checkRedPoint: function (is_check_main) {
|
||
|
|
let status = false
|
||
|
|
if (this.secretarea_data) {
|
||
|
|
if (this.secretarea_data.bid == 0) { return false }
|
||
|
|
|
||
|
|
if (this.secretarea_data.count > 0 && this.secretarea_data.end_time > client.socket.getTime()) {
|
||
|
|
//有挑战次数
|
||
|
|
status = true
|
||
|
|
} else {
|
||
|
|
//是否能量领奖
|
||
|
|
if (this.secretarea_data.is_reward == 1) {
|
||
|
|
//已领奖励信息
|
||
|
|
let dic_progress_reward = {}
|
||
|
|
for (const i in this.secretarea_data.progress_reward) {
|
||
|
|
const v = this.secretarea_data.progress_reward[i];
|
||
|
|
dic_progress_reward[v.order] = true
|
||
|
|
}
|
||
|
|
if (game.configs.guild_secret_area_data && game.configs.guild_secret_area_data.data_box_reward) {
|
||
|
|
let box_reward_list = game.configs.guild_secret_area_data.data_box_reward[this.secretarea_data.bid]
|
||
|
|
if (box_reward_list && Utils.next(box_reward_list) != null) {
|
||
|
|
box_reward_list.sort(function (a, b) {
|
||
|
|
return a.number - b.number;
|
||
|
|
});
|
||
|
|
let per_hp = this.secretarea_data.hp * 100 / this.secretarea_data.max_hp
|
||
|
|
for (const i in box_reward_list) {
|
||
|
|
const config = box_reward_list[i];
|
||
|
|
let per = config.progress / 10
|
||
|
|
if (!dic_progress_reward[config.number] && per_hp <= per) {
|
||
|
|
status = true
|
||
|
|
break
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if (is_check_main) {
|
||
|
|
|
||
|
|
}
|
||
|
|
gcore.GlobalEvent.fire(GuildEvent.UpdateGuildRedStatus, GuildConst.red_index.guild_secret_area, status)
|
||
|
|
return status
|
||
|
|
},
|
||
|
|
|
||
|
|
updateBossRankInfo: function (data) {
|
||
|
|
if (!data) { return }
|
||
|
|
this.dic_boss_rank_info[data.boss_id] = data
|
||
|
|
},
|
||
|
|
|
||
|
|
getBossRankInfoByBossID: function (boss_id) {
|
||
|
|
if (this.dic_boss_rank_info) {
|
||
|
|
return this.dic_boss_rank_info[boss_id]
|
||
|
|
}
|
||
|
|
return null
|
||
|
|
},
|
||
|
|
|
||
|
|
clearBossRankInfo: function () {
|
||
|
|
this.dic_boss_rank_info = {}
|
||
|
|
},
|
||
|
|
|
||
|
|
//讨伐信息更新
|
||
|
|
updateStartCrusadeInfo: function (data) {
|
||
|
|
this.start_crusade_data = data
|
||
|
|
},
|
||
|
|
//是否显示开始讨伐窗口
|
||
|
|
isShowStartCrusade: function () {
|
||
|
|
if (this.start_crusade_data && this.start_crusade_data.flag == 0) {
|
||
|
|
this.start_crusade_data.flag = 1
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
return false
|
||
|
|
},
|
||
|
|
|
||
|
|
__delete: function () {
|
||
|
|
},
|
||
|
|
});
|