723 lines
27 KiB
Lua
723 lines
27 KiB
Lua
------------------------------------------------
|
||
--作者: xc
|
||
--日期: 2019-05-10
|
||
--文件: BossSystem.lua
|
||
--模块: BossSystem
|
||
--描述: BOSS系统
|
||
------------------------------------------------
|
||
local RedPointCustomCondition = CS.Thousandto.Code.Logic.RedPointCustomCondition
|
||
local RedPointItemCondition = CS.Thousandto.Code.Logic.RedPointItemCondition
|
||
|
||
local BossSystem = {
|
||
BossPersonal = Dictionary:New(), --存的配置表数据K是Layer
|
||
MySelfBossRefshTime = 0, --个人BOSS剩余刷新时间
|
||
|
||
WorldBossInfoDic = Dictionary:New(), --世界BOSS信息字典,key = 配置表id,value = {BossCfg, RefreshTime, IsFollow}
|
||
LayerBossIDDic = Dictionary:New(), --page是K->value是层数和bossID字典,key = 层数,value = List<bossID>
|
||
WorldBossRankRewardMaxCount = 0, --世界BOSS排行奖励最大次数喊使用道具增加的
|
||
WorldBossReaminCount = 0, --世界Boss收益的剩余次数
|
||
CurSelectBossID = 0, --当前选择的世界BOSS id
|
||
CurWuxianBossId = 0, --当前无限BossId
|
||
|
||
WuXianBossDict = Dictionary:New(), --假无限BOSS信息,key = BossId, value = RefreshTime
|
||
StartLeaveCountDown = false, --是否开始假无限BOSS离开副本倒计时
|
||
LeaveReaminTime = 0, --假无限BOSS离开副本剩余时间
|
||
Scourge = -1, --套装和宝石Boss的天罚值
|
||
SuitGemBossType = -1,
|
||
SuitBossCount = 0,
|
||
SuitBossAllCount = 0,
|
||
SuitBossAddCount = 0, --套装Boss已购买的次数
|
||
LeaveSuitCopyTime = 0,
|
||
OlBossDict = Dictionary:New(),
|
||
SuitGemOLDict = Dictionary:New(),
|
||
WorldBossAddCount = 0, --世界Boss购买的次数
|
||
--无限Boss关闭的时间
|
||
WuxianBossCloseTime = 0,
|
||
--无限Boss将要开启的时间
|
||
WuxianBossOpenTime = 0,
|
||
--计时器的ID
|
||
TimerEventId = 0,
|
||
|
||
NewBHReCount = 0, --boss之家剩余次数
|
||
NewBHMaxCount = 0, --boss之家最大次数
|
||
}
|
||
|
||
function BossSystem:Initialize()
|
||
self:InitConfig()
|
||
self:InitWorldBossInfo()
|
||
--第一个值为什么时候执行(秒数),第二个值为验证的有效时间(比如,到5点了,1秒内都可以执行)
|
||
self.TimerEventId = GameCenter.TimerEventSystem:AddTimeStampDayEvent(5 * 60 * 60, 1,
|
||
true, nil, function(id, remainTime, param)
|
||
--请求下套装Boss的数据
|
||
local _msg = ReqMsg.MSG_Boss.ReqSuitGemBossPanel:New()
|
||
--0 套装boss
|
||
_msg.type = 0
|
||
_msg:Send()
|
||
end)
|
||
local _bossHomeItemId = tonumber(DataConfig.DataGlobal[GlobalName.BossHome_Count_Item].Params)
|
||
--boss之家增加次数红点
|
||
GameCenter.RedPointSystem:AddFuncCondition(FunctionStartIdCode.BossHome, 0, RedPointItemCondition(_bossHomeItemId, 1))
|
||
end
|
||
|
||
function BossSystem:UnInitialize()
|
||
self.BossPersonal:Clear()
|
||
self.CurSelectBossID = 0
|
||
self.CurWuxianBossId = 0
|
||
self.WorldBossInfoDic:Clear()
|
||
self.LayerBossIDDic:Clear()
|
||
if self.TimerEventId > 0 then
|
||
GameCenter.TimerEventSystem:RemoveTimerEvent(self.TimerEventId)
|
||
end
|
||
end
|
||
|
||
--################世界BOSS开始#################
|
||
function BossSystem:InitWorldBossInfo()
|
||
--初始化世界BOSS字典
|
||
DataConfig.DataBossnewWorld:Foreach(function(k, v)
|
||
local _mapnum = v.Mapnum
|
||
if not self.LayerBossIDDic:ContainsKey(v.Page) then
|
||
local _bossDic = Dictionary:New()
|
||
local _bossIDList = List:New()
|
||
_bossIDList:Add(k)
|
||
_bossDic:Add(_mapnum,_bossIDList)
|
||
self.LayerBossIDDic:Add(v.Page, _bossDic)
|
||
else
|
||
if not self.LayerBossIDDic[v.Page]:ContainsKey(_mapnum) then
|
||
local _bossIDList = List:New()
|
||
_bossIDList:Add(k)
|
||
self.LayerBossIDDic[v.Page]:Add(_mapnum, _bossIDList)
|
||
else
|
||
local _bossIDList = self.LayerBossIDDic[v.Page][_mapnum]
|
||
if not _bossIDList:Contains(k) then
|
||
_bossIDList:Add(k)
|
||
end
|
||
end
|
||
end
|
||
if not self.WorldBossInfoDic:ContainsKey(k) then
|
||
local _bossInfo = {BossCfg = v}
|
||
self.WorldBossInfoDic:Add(k, _bossInfo)
|
||
end
|
||
end)
|
||
self.LayerBossIDDic:Foreach(function(key, value)
|
||
value:SortKey(function(a, b) return a < b end)
|
||
value:Foreach(function(key1, value1)
|
||
value1:Sort(function(a, b) return a < b end)
|
||
end)
|
||
end)
|
||
end
|
||
|
||
function BossSystem:RefreshBossInfo(msg)
|
||
local _bossInfo = self.WorldBossInfoDic[msg.bossId]
|
||
if _bossInfo ~= nil then
|
||
_bossInfo.RefreshTime = msg.refreshTime
|
||
_bossInfo.IsFollow = msg.isFollowed
|
||
_bossInfo.SyncTime = Time.GetRealtimeSinceStartup()
|
||
end
|
||
end
|
||
|
||
function BossSystem:GetRefreshTime(bossInfo)
|
||
if bossInfo.RefreshTime == nil or bossInfo.SyncTime == nil then
|
||
return 0
|
||
end
|
||
local _remienTime = bossInfo.RefreshTime - (Time.GetRealtimeSinceStartup() - bossInfo.SyncTime)
|
||
if _remienTime < 0 then
|
||
return 0
|
||
end
|
||
return _remienTime
|
||
end
|
||
|
||
--上下线时,通过地图ID查找是否为无线层
|
||
function BossSystem:GetWorldBossTypeByMapId(mapId)
|
||
local _mapnum = 0
|
||
self.LayerBossIDDic:ForeachCanBreak(
|
||
function(k, v)
|
||
v:ForeachCanBreak(
|
||
function(key,value)
|
||
for i=1,#value do
|
||
local _bossCfg = DataConfig.DataBossnewWorld[value[i]]
|
||
local _cloneMap = DataConfig.DataCloneMap[_bossCfg.CloneMap]
|
||
if _cloneMap.Mapid == mapId then
|
||
_mapnum = key
|
||
return true
|
||
end
|
||
end
|
||
end
|
||
)
|
||
if _mapnum ~= 0 then
|
||
return true
|
||
end
|
||
end
|
||
)
|
||
return _mapnum
|
||
end
|
||
|
||
function BossSystem:GetNewCompIsVisible(layer)
|
||
local _dic = self.LayerBossIDDic[1]
|
||
if layer and _dic and _dic:ContainsKey(layer) then
|
||
if layer >= 0 then
|
||
return true
|
||
end
|
||
local _idList = _dic[layer]
|
||
for i = 1, #_idList do
|
||
local _info = self.WorldBossInfoDic[_idList[i]]
|
||
if _info and not _info.IsKilled then
|
||
return true
|
||
end
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
--进入套装BOSS,根据玩家等级选择进入的层数
|
||
function BossSystem:EnterSuitBossCopy()
|
||
local _layerDic = GameCenter.BossSystem:GetLayerDirByPage(WorldBossPageEnum.SuitBoss)
|
||
local _lpLevel = GameCenter.GameSceneSystem:GetLocalPlayer().Level
|
||
local _maxLv = 0
|
||
local _mapID = 0
|
||
|
||
_layerDic:ForeachCanBreak(function(key, value)
|
||
local _bossCfg = DataConfig.DataBossnewWorld[value[1]]
|
||
local _mapCfg = DataConfig.DataCloneMap[_bossCfg.CloneMap]
|
||
local _limtLevel = _mapCfg.MinLv
|
||
if _limtLevel <= _lpLevel then
|
||
if _limtLevel > _maxLv then
|
||
_mapID = _bossCfg.CloneMap
|
||
_maxLv = _limtLevel
|
||
end
|
||
else
|
||
return true
|
||
end
|
||
end)
|
||
GameCenter.DailyActivitySystem:ReqJoinActivity(12, _mapID)
|
||
end
|
||
|
||
--通过分页获得层字典
|
||
function BossSystem:GetLayerDirByPage(page)
|
||
return self.LayerBossIDDic[page]
|
||
end
|
||
|
||
--请求所有BOSS信息,1.世界boss 2.boss之家
|
||
function BossSystem:ReqAllWorldBossInfo(bossTyp)
|
||
local _req = ReqMsg.MSG_Boss.ReqOpenDreamBoss:New()
|
||
_req.bossType = bossTyp
|
||
_req:Send()
|
||
--GameCenter.Network.Send("MSG_Boss.ReqOpenDreamBoss")
|
||
end
|
||
|
||
--请求套装Boss的数据
|
||
function BossSystem:ReqSuitBossInfo()
|
||
local _msg = ReqMsg.MSG_Boss.ReqSuitGemBossPanel:New()
|
||
--0 套装boss
|
||
_msg.type = 0
|
||
_msg:Send()
|
||
end
|
||
|
||
--同步收益次数
|
||
function BossSystem:ResUpDateWorldBossReMainRankCount(result)
|
||
if result.bossType == BossType.WorldBoss then
|
||
self.WorldBossReaminCount = result.remainCount
|
||
self.WorldBossRankRewardMaxCount = result.maxCount
|
||
self:CheckWorldBossRedPoint()
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_UPDATEREMINRANKCOUNT)
|
||
elseif result.bossType == BossType.SuitBoss then
|
||
self.SuitBossCount = result.remainCount
|
||
self.SuitGemBossType = result.bossType
|
||
self:CheckSuitBossRedPoint()
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_REFESH_REMAINCOUNT, self.SuitGemBossType)
|
||
if self.SuitBossCount == 0 then
|
||
--GameCenter.PushFixEvent(UIEventDefine.UINewWorldBossEarningsNumberForm_OPEN, self.SuitGemBossType)
|
||
end
|
||
elseif result.bossType == BossType.NewBossHome then
|
||
self.NewBHReCount = result.remainCount --boss之家剩余次数
|
||
self.NewBHMaxCount = result.maxCount --boss之家最大次数
|
||
if self.NewBHReCount <= 0 then
|
||
--剩余次数不足,直接打开次数增加界面
|
||
GameCenter.PushFixEvent(UIEventDefine.UINewWorldBossEarningsNumberForm_OPEN, BossType.NewBossHome)
|
||
end
|
||
self:CheckNewBossHomeRedPoint()
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_REFRESH_BOSSHOME_COUNT)
|
||
end
|
||
end
|
||
|
||
--收益次数的提示
|
||
function BossSystem:ResRankCountTips(result)
|
||
local _bossID = GameCenter.BossSystem.CurSelectBossID
|
||
if _bossID <= 0 then
|
||
_bossID = GameCenter.BossInfoTipsSystem.CustomCfgID
|
||
end
|
||
local _bossCfg = DataConfig.DataBossnewWorld[_bossID]
|
||
local _curCfgPage = 0
|
||
if _bossCfg == nil then
|
||
return
|
||
end
|
||
_curCfgPage = _bossCfg.Page
|
||
--小于等于0的是无限层,不弹收益次数的提示
|
||
if _curCfgPage > 0 then
|
||
--晶甲Boss
|
||
if _curCfgPage == WorldBossPageEnum.SuitBoss then
|
||
--GameCenter.PushFixEvent(UIEventDefine.UINewWorldBossEarningsNumberForm_OPEN, SuitGemBossEnum.SuitBoss)
|
||
elseif _curCfgPage == WorldBossPageEnum.WordBoss then
|
||
GameCenter.PushFixEvent(UIEventDefine.UINewWorldBossEarningsNumberForm_OPEN, BossType.WorldBoss)
|
||
elseif _curCfgPage == WorldBossPageEnum.BossHome then
|
||
GameCenter.PushFixEvent(UIEventDefine.UINewWorldBossEarningsNumberForm_OPEN, BossType.NewBossHome)
|
||
else
|
||
GameCenter.PushFixEvent(UIEventDefine.UINewWorldBossEarningsNumberForm_OPEN)
|
||
end
|
||
end
|
||
end
|
||
|
||
--返回添加收益次数
|
||
function BossSystem:ResAddWorldBossRankCount(result)
|
||
if result.bossType == BossType.WorldBoss then
|
||
--总次数
|
||
self.WorldBossRankRewardMaxCount = result.maxCount
|
||
--剩余次数
|
||
self.WorldBossReaminCount = result.remainCount
|
||
--增加的次数
|
||
self.WorldBossAddCount = result.buyCount
|
||
self:CheckWorldBossRedPoint()
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_ADDWORLDRANKCOUNT)
|
||
elseif result.bossType == BossType.SuitBoss then
|
||
self.SuitBossAllCount = result.maxCount
|
||
self.SuitBossAddCount = result.buyCount
|
||
self.SuitBossCount = result.remainCount
|
||
self:CheckSuitBossRedPoint()
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_REFESH_REMAINCOUNT, BossType.SuitBoss)
|
||
elseif result.bossType == BossType.SoulMonster then
|
||
GameCenter.SoulMonsterSystem.SoulMonsterRankRewardMaxCount = result.maxCount
|
||
--剩余次数
|
||
GameCenter.SoulMonsterSystem.SoulMonsterRankRewardCount = result.remainCount
|
||
GameCenter.MainFunctionSystem:SetAlertFlag(FunctionStartIdCode.GodIsland, result.remainCount > 0)
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_HUNSHOUSENLIN_UPDATE)
|
||
elseif result.bossType == BossType.CrossHorseBoss then
|
||
--总次数
|
||
GameCenter.MountBossSystem.BossRankRewardMaxCount = result.maxCount
|
||
--剩余次数
|
||
GameCenter.MountBossSystem.BossReaminCount = result.remainCount
|
||
--增加的次数
|
||
GameCenter.MountBossSystem.BossAddCount = result.buyCount
|
||
GameCenter.MainFunctionSystem:SetAlertFlag(FunctionStartIdCode.MountECopy, GameCenter.MountBossSystem.BossReaminCount > 0)
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_CROSSMOUNTBOSS_ADDCOUNT)
|
||
elseif result.bossType == BossType.NewBossHome then
|
||
self.NewBHReCount = result.remainCount --boss之家剩余次数
|
||
self.NewBHMaxCount = result.maxCount --boss之家最大次数
|
||
self:CheckNewBossHomeRedPoint()
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_ADDWORLDRANKCOUNT)
|
||
end
|
||
Utils.ShowPromptByEnum("BossSystemAddCount", result.remainCount)
|
||
end
|
||
|
||
function BossSystem:ResOpenDreamBoss(result)
|
||
if result then
|
||
if result.mapOlList ~= nil then
|
||
for i = 1, #result.mapOlList do
|
||
local _bossMapNum = result.mapOlList[i]
|
||
if not self.OlBossDict:ContainsKey(_bossMapNum.mapModelId) then
|
||
self.OlBossDict:Add(_bossMapNum.mapModelId, _bossMapNum.num)
|
||
else
|
||
self.OlBossDict[_bossMapNum.mapModelId] = _bossMapNum.num
|
||
end
|
||
end
|
||
end
|
||
if result.bossType == BossType.WorldBoss then
|
||
for i = 1, #result.bossList do
|
||
self:RefreshBossInfo(result.bossList[i])
|
||
end
|
||
self.WorldBossRankRewardMaxCount = result.maxCount
|
||
self.WorldBossReaminCount = result.remainCount
|
||
--已购买的次数
|
||
self.WorldBossAddCount = result.buyCount
|
||
self:CheckWorldBossRedPoint()
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_UPDATEREMINRANKCOUNT)
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_NEWWORLDBOSS_REFRESHTIME)
|
||
elseif result.bossType == BossType.NewBossHome then
|
||
for i = 1, #result.bossList do
|
||
self:RefreshBossInfo(result.bossList[i])
|
||
end
|
||
self.NewBHReCount = result.remainCount--boss之家剩余次数
|
||
self.NewBHMaxCount = result.maxCount--boss之家最大次数
|
||
self:CheckNewBossHomeRedPoint()
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_UPDATEREMINRANKCOUNT)
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_NEWWORLDBOSS_REFRESHTIME)
|
||
end
|
||
end
|
||
end
|
||
|
||
--请求BOSS击杀信息
|
||
function BossSystem:ReqBossKilledInfo(bossID, bossTyp)
|
||
GameCenter.Network.Send("MSG_Boss.ReqBossKilledInfo", {bossId = bossID, bossType = bossTyp})
|
||
end
|
||
|
||
function BossSystem:ResBossKilledInfo(result)
|
||
if result.bossType == BossType.WorldBoss or result.bossType == BossType.GemBoss or result.bossType == BossType.SuitBoss then
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_NEWWORLDBOSS_KILLRECORD, result)
|
||
elseif result.bossType == BossType.SoulMonster then
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_HUNSHOU_SHOWKILLINFO, result)
|
||
elseif result.bossType == BossType.NewBossHome then
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_REFRESH_BOSSHOME_KILLRECORD, result)
|
||
end
|
||
end
|
||
|
||
--请求关注BOSS。follow = 请求方式,true:进行关注,false:取消关注,1.世界boss 2.boss之家
|
||
function BossSystem:ReqFollowBoss(bossID, isFollow, bossTyp)
|
||
--协议中:1:进行关注,2:取消关注
|
||
local _followType = isFollow and 1 or 2
|
||
GameCenter.Network.Send("MSG_Boss.ReqFollowBoss", {bossId = bossID, type = _followType, bossType = bossTyp})
|
||
end
|
||
|
||
function BossSystem:ResFollowBoss(result)
|
||
if result and result.isSuccess then
|
||
if result.bossType == BossType.WorldBoss or result.bossType == BossType.SuitBoss or result.bossType == BossType.GemBoss or result.bossType == BossType.NewBossHome then
|
||
if self.WorldBossInfoDic:ContainsKey(result.bossId) then
|
||
self.WorldBossInfoDic[result.bossId].IsFollow = result.type == 1
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_NEWWORLDBOSS_FOLLOW)
|
||
if result.type == 1 then
|
||
Utils.ShowPromptByEnum("AttentionSucceed")
|
||
end
|
||
end
|
||
elseif result.bossType == BossType.SoulMonster then
|
||
GameCenter.SoulMonsterSystem:InitBossInfo()
|
||
if GameCenter.SoulMonsterSystem.SoulMonsterBossInfoDic:ContainsKey(result.bossId) then
|
||
GameCenter.SoulMonsterSystem.SoulMonsterBossInfoDic[result.bossId].IsFollow = result.type == 1
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_HUNSHOU_GUANZHUREFREASH)
|
||
if result.type == 1 then
|
||
Utils.ShowPromptByEnum("AttentionSucceed")
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
--BOSS信息刷新
|
||
function BossSystem:ResBossRefreshInfo(result)
|
||
if result and result.bossRefreshList then
|
||
if result.bossType == BossType.WorldBoss or result.bossType == BossType.SuitBoss or result.bossType == BossType.GemBoss or result.bossType == BossType.NewBossHome then
|
||
for i = 1, #result.bossRefreshList do
|
||
self:RefreshBossInfo(result.bossRefreshList[i])
|
||
end
|
||
if result.bossType == BossType.SuitBoss then
|
||
self.SuitGemBossType = SuitGemBossEnum.SuitBoss
|
||
if self.SuitBossAllCount <= 0 then
|
||
local _msg = ReqMsg.MSG_Boss.ReqSuitGemBossPanel:New()
|
||
--0 套装boss
|
||
_msg.type = 0
|
||
_msg:Send()
|
||
end
|
||
elseif result.bossType == BossType.GemBoss then
|
||
self.SuitGemBossType = SuitGemBossEnum.GemBoss
|
||
end
|
||
-- 假无线Boss [丁华强 2019/9/6]
|
||
elseif result.bossType == BossType.WuXianBoss then
|
||
local _newBossInfoList = result.bossRefreshList
|
||
for i=1, #_newBossInfoList do
|
||
if _newBossInfoList[i].refreshTime == 0 then
|
||
self.CurWuxianBossId = _newBossInfoList[i].bossId
|
||
break
|
||
end
|
||
end
|
||
for i = 1, #_newBossInfoList do
|
||
self:RefreshBossInfo(_newBossInfoList[i])
|
||
local _msgInfo = _newBossInfoList[i]
|
||
self.WuXianBossDict[_msgInfo.bossId] = _msgInfo.refreshTime
|
||
end
|
||
local _result = self:CheckWuxianBossStates()
|
||
if _result then
|
||
self.LeaveReaminTime = 5
|
||
self.StartLeaveCountDown = true
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
--检测Boss死完没得
|
||
function BossSystem:CheckWuxianBossStates()
|
||
local _isBossAllDead = true
|
||
local _time = -1
|
||
self.WuXianBossDict:ForeachCanBreak(
|
||
function(_, _refeshTime)
|
||
-- boss信息 存活发的0 死亡发的-1
|
||
if _refeshTime == 0 then
|
||
_isBossAllDead = false
|
||
return true
|
||
end
|
||
end
|
||
)
|
||
return _isBossAllDead
|
||
end
|
||
|
||
--关注的世界boss刷新提前一分钟提示
|
||
function BossSystem:ResBossRefreshTip(result)
|
||
if result.bossType == BossType.WorldBoss or result.bossType == BossType.GemBoss or result.bossType == BossType.SuitBoss or result.bossType == BossType.NewBossHome then
|
||
--世界BOSS提前提示,result.bossId是世界BOSS配置表id
|
||
local _bossCfg = DataConfig.DataBossnewWorld[result.bossId]
|
||
if _bossCfg then
|
||
--_bossCfg.ID同时也是monster表id
|
||
GameCenter.PushFixEvent(UIEventDefine.UIBossInfoTips_OPEN, {_bossCfg.ID, _bossCfg.CloneMap, result.bossId, result.bossType})
|
||
end
|
||
elseif result.bossType == BossType.TianXuWar then
|
||
GameCenter.TerritorialWarSystem:ResAttentionMonsterRefresh(result.bossId)
|
||
end
|
||
end
|
||
|
||
--同步伤害排行信息
|
||
function BossSystem:ResSynHarmRank(result)
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_NEWWORLDBOSS_HARMRANKREFRESH, result)
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_BOSSHOME_HARMRANKREFRESH, result)
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_HUNSHOU_HURTRANKINFO, result)
|
||
if result.bossType == BossType.CrossHorseBoss then
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_MOUNTBOSS_HURTRANKINFO, result)
|
||
elseif result.bossType == BossType.SlayerBoss then
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_SLAYERCOPY_BOSSHARM, result)
|
||
elseif result.bossType == BossType.XuMiBaoKu then
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_XUMIBAOKU_BOSSHARM, result)
|
||
end
|
||
end
|
||
|
||
--击杀BOSS后,打开结算面板
|
||
function BossSystem:ResBossStateResultPanl(result)
|
||
GameCenter.PushFixEvent(UIEventDefine.UINewCompCopyResultForm_OPEN, result)
|
||
end
|
||
--################世界BOSS结束#################
|
||
|
||
--返回个人BOSS刷新时间
|
||
function BossSystem:ResMySelfBossRemainTime(msg)
|
||
self.MySelfBossRefshTime = msg.remaintime
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.BOSS_EVENT_MYSELF_REMAINTEAM,self.MySelfBossRefshTime)
|
||
end
|
||
|
||
--套装宝石Boss开界面的数据返回
|
||
function BossSystem:ResSuitGemBossPanel(msg)
|
||
if msg ~= nil then
|
||
--Boss类型
|
||
self.SuitGemBossType = msg.type
|
||
--BOSS信息
|
||
if msg.bossList ~= nil then
|
||
for i = 1, #msg.bossList do
|
||
self:RefreshBossInfo(msg.bossList[i])
|
||
end
|
||
end
|
||
if msg.mapOlList ~= nil then
|
||
for i = 1, #msg.mapOlList do
|
||
local _bossMapNum = msg.mapOlList[i]
|
||
if not self.SuitGemOLDict:ContainsKey(_bossMapNum.mapModelId) then
|
||
self.SuitGemOLDict:Add(_bossMapNum.mapModelId, _bossMapNum.num)
|
||
else
|
||
self.SuitGemOLDict[_bossMapNum.mapModelId] = _bossMapNum.num
|
||
end
|
||
end
|
||
end
|
||
self.SuitBossCount = msg.remainCount
|
||
self.SuitBossAllCount = msg.maxCount
|
||
--已购买的次数
|
||
self.SuitBossAddCount = msg.buyCount
|
||
self:CheckSuitBossRedPoint()
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_REFESH_REMAINCOUNT, self.SuitGemBossType)
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_NEWWORLDBOSS_REFRESHTIME)
|
||
end
|
||
end
|
||
|
||
function BossSystem:ResSuitGemBossScourge(msg)
|
||
if msg ~= nil then
|
||
--天遣值的实时更新
|
||
if msg.scourge and msg.scourge > 100 then
|
||
self.Scourge = 100
|
||
else
|
||
self.Scourge = msg.scourge
|
||
end
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.BOSS_EVENT_SUIT_GEM_BOSS_REFESH)
|
||
end
|
||
end
|
||
|
||
--无限层Boss开启和关闭的时间
|
||
function BossSystem:ResWuXianBossOCTime(msg)
|
||
--无限Boss关闭的时间
|
||
--self.WuxianBossCloseTime = msg.closeTime
|
||
--无限Boss将要开启的时间
|
||
--self.WuxianBossOpenTime = msg.openTime
|
||
end
|
||
|
||
--新手层BOSS击杀列表
|
||
function BossSystem:ResNoobBossPannel(msg)
|
||
if msg ~= nil then
|
||
--BOSS信息
|
||
local _bossList = msg.bossList
|
||
if _bossList then
|
||
for i=1, #_bossList do
|
||
if self.WorldBossInfoDic:ContainsKey(_bossList[i]) then
|
||
local _bossInfo = self.WorldBossInfoDic[_bossList[i]]
|
||
_bossInfo.IsKilled = true
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
--初始化个人BOSS配置表
|
||
function BossSystem:InitConfig()
|
||
DataConfig.DataBossnewPersonal:Foreach(function(k, v)
|
||
if not self.BossPersonal:ContainsKey(v.Layer) then
|
||
local _list = List:New()
|
||
_list:Add(v)
|
||
self.BossPersonal:Add(v.Layer, _list)
|
||
else
|
||
self.BossPersonal[v.Layer]:Add(v)
|
||
end
|
||
end)
|
||
self.BossPersonal:SortKey(
|
||
function(a,b)
|
||
return a < b
|
||
end
|
||
)
|
||
for k, v in pairs(self.BossPersonal) do
|
||
v:Sort(
|
||
function(a,b)
|
||
return a.Monsterid < b.Monsterid
|
||
end
|
||
)
|
||
end
|
||
end
|
||
|
||
--获得重生时间通过BOSSID
|
||
function BossSystem:GetBossReviewTimeByIs(layer,bossid)
|
||
if self.BossPersonal:ContainsKey(layer) then
|
||
local _info = self.BossPersonal[layer]:Find(
|
||
function(code)
|
||
return code.Monsterid == bossid
|
||
end
|
||
)
|
||
if _info then
|
||
return _info.ReviveTime
|
||
end
|
||
end
|
||
return 0
|
||
end
|
||
|
||
--获得位置通过BOSSID
|
||
function BossSystem:GetBossPos(monsterid,layer)
|
||
if self.BossPersonal:ContainsKey(layer) then
|
||
local _info = self.BossPersonal[layer]:Find(
|
||
function(code)
|
||
return code.Monsterid == monsterid
|
||
end
|
||
)
|
||
if _info then
|
||
return _info.Pos
|
||
end
|
||
end
|
||
return nil
|
||
end
|
||
|
||
--解析字符串得到坐标
|
||
function BossSystem:AnalysisPos(str)
|
||
if str then
|
||
local _attr = Utils.SplitStr(str,'_')
|
||
if #_attr == 2 then
|
||
return tonumber(_attr[1]),tonumber(_attr[2])
|
||
end
|
||
end
|
||
end
|
||
|
||
--解析字符串得到道具
|
||
function BossSystem:AnalysisItem(str)
|
||
if str then
|
||
local _attr = Utils.SplitStr(str,';')
|
||
local _list = List:New()
|
||
for i=1,#_attr do
|
||
_list:Add(tonumber(_attr[i]))
|
||
end
|
||
return _list
|
||
end
|
||
return nil
|
||
end
|
||
|
||
function BossSystem:GetMonsterNameByCfgName(cfgName)
|
||
return string.match(cfgName, ".+%f[(]")
|
||
end
|
||
|
||
function BossSystem:GetMonsterLvByCfgName(cfgName)
|
||
return string.match(cfgName, "%d+")
|
||
end
|
||
|
||
--更新
|
||
function BossSystem:Update(dt)
|
||
end
|
||
|
||
--检查世界boss红点
|
||
function BossSystem:CheckWorldBossRedPoint()
|
||
local _showRedPoint = false
|
||
if self.WorldBossReaminCount > 0 then
|
||
_showRedPoint = true
|
||
end
|
||
--计算是否可以购买次数
|
||
--计算买次数红点
|
||
local _lp = GameCenter.GameSceneSystem:GetLocalPlayer()
|
||
if _lp ~= nil then
|
||
local _curLevel = _lp.VipLevel
|
||
if _curLevel < 0 then
|
||
_curLevel = 0
|
||
end
|
||
local _copyVipCfgId = 16
|
||
local _curVipCfg = DataConfig.DataVip[_curLevel]
|
||
local _curLevelCanBuy = 0
|
||
if _curVipCfg ~= nil then
|
||
local _cfgTable = Utils.SplitStrByTableS(_curVipCfg.VipPowerPra, {';', '_'})
|
||
for i = 1, #_cfgTable do
|
||
if _cfgTable[i][1] == _copyVipCfgId then
|
||
_curLevelCanBuy = _cfgTable[i][3]
|
||
break
|
||
end
|
||
end
|
||
local _curBuyCount = self.WorldBossAddCount
|
||
if _curLevelCanBuy > _curBuyCount then
|
||
_showRedPoint = true
|
||
end
|
||
end
|
||
end
|
||
GameCenter.MainFunctionSystem:SetAlertFlag(FunctionStartIdCode.WorldBoss, _showRedPoint)
|
||
end
|
||
|
||
--检查套装boss红点
|
||
function BossSystem:CheckSuitBossRedPoint()
|
||
local _showRedPoint = false
|
||
if self.SuitBossCount > 0 then
|
||
_showRedPoint = true
|
||
end
|
||
--计算是否可以购买次数
|
||
--计算买次数红点
|
||
local _lp = GameCenter.GameSceneSystem:GetLocalPlayer()
|
||
if _lp ~= nil then
|
||
local _curLevel = _lp.VipLevel
|
||
if _curLevel < 0 then
|
||
_curLevel = 0
|
||
end
|
||
local _copyVipCfgId = 17
|
||
local _curVipCfg = DataConfig.DataVip[_curLevel]
|
||
local _curLevelCanBuy = 0
|
||
if _curVipCfg ~= nil then
|
||
local _cfgTable = Utils.SplitStrByTableS(_curVipCfg.VipPowerPra, {';', '_'})
|
||
for i = 1, #_cfgTable do
|
||
if _cfgTable[i][1] == _copyVipCfgId then
|
||
_curLevelCanBuy = _cfgTable[i][3]
|
||
break
|
||
end
|
||
end
|
||
local _curBuyCount = self.SuitBossAddCount
|
||
if _curLevelCanBuy > _curBuyCount then
|
||
_showRedPoint = true
|
||
end
|
||
end
|
||
end
|
||
GameCenter.MainFunctionSystem:SetAlertFlag(FunctionStartIdCode.WorldBoss1, _showRedPoint)
|
||
end
|
||
|
||
--检查新boss之家红点
|
||
function BossSystem:CheckNewBossHomeRedPoint()
|
||
GameCenter.RedPointSystem:RemoveFuncCondition(FunctionStartIdCode.BossHome, 1)
|
||
if self.NewBHReCount > 0 then
|
||
--剩余次数红点
|
||
GameCenter.RedPointSystem:AddFuncCondition(FunctionStartIdCode.BossHome, 1, RedPointCustomCondition(true))
|
||
end
|
||
end
|
||
|
||
return BossSystem
|