local WorldBoss_Model = {} local private = { seekHelpList = {}, -- 服务器发送的请求协助列表 } local EventSystem = require('Event/EventSystem') local world_boss_pb = require('Proto/world_boss_pb') local worldboss_info_pb = require("Proto/worldboss_info_pb") local LeaveTimeNum local NoticePrefKey = "%s_WORLDBOSSNOTICE_%s" --存储是否提醒boss开启的PrefKey local NoticePrefListKey = "WORLDBOSSNOTICE" local RemindPrefKey_WorldBoss = "WORLDBOSSNOTICE_WorldBoss" local RemindPrefKey_WarZoneWorldBoss = "WORLDBOSSNOTICE_WarZoneWorldBoss" local NOTICE_HIGHEST_LV_BOSS_INITED = "NOTICE_HIGHEST_LV_BOSS_INITED" local NOTICE_HIGHEST_LV_COUNTRY_BOSS_INITED = "NOTICE_HIGHEST_LV_COUNTRY_BOSS_INITED" local TIME_IGNORE = DataSheetManager.ConstData:GetDataByID("WorldBossHelpIgoreCD").IntValue WorldBoss_Model.EnterType = { Common = world_boss_pb.WorldBossEnterCommon, --正常进入 Assistant = world_boss_pb.WorldBossEnterAssistant, --助战进入 Call = world_boss_pb.WorldBossEnterCall, --队长推送 Rival = world_boss_pb.WorldBossRivalChase, -- 仇人追杀 Follow = world_boss_pb.WorldBossEnterFollow, -- 跟随进入 } WorldBoss_Model.HelpType = { Normal = world_boss_pb.Normal, Killed = world_boss_pb.Killed, Attacked = world_boss_pb.Attacked, } local hasEnterNums = 0 local officialPosNums = 0 function WorldBoss_Model.OnStartup() NetManager.RegisterMsgCB(MessageEnums.MessageWBPayForRelive, private.WBPayForReliveResponse) NetManager.RegisterMsgCB(MessageEnums.MessageEnterWorldBoss, private.EnterWorldBossResponse) NetManager.RegisterMsgCB(MessageEnums.MessageG2CWorldBossData, private.G2CWorldBossData) NetManager.RegisterMsgCB(MessageEnums.MessageG2CPushWorldBossResult, private.G2CWorldBossResult) NetManager.RegisterMsgCB(MessageEnums.MessageG2CEnterWorldBoss,private.OnG2CEnterWorldBoss) NetManager.RegisterMsgCB(MessageEnums.MessageWorldBossSeekHelp,private.SeekHelpResp) NetManager.RegisterMsgCB(MessageEnums.MessageG2CPushWorldBossSeekHelp,private.OnPushSeekHelpMsg) NetManager.RegisterMsgCB(MessageEnums.MessageG2CPushWorldBossTeamMemberCall,private.OnPushWorldBossTeamMemberCall) EventSystem.Regist(EventID.UI_RefreshOfficialPositionInfo, private.OnOfficialPositionUpdate) EventSystem.Regist(EventID.WorldBoss_SendResult , private.SendWorldBossResult) EventSystem.Regist(EventID.WorldBoss_PlayerAllHeroBeKilled , private.OnPlayerHeroAllBeKilled) EventSystem.Regist(EventID.WorldBoss_ClearAllSeekHelp , WorldBoss_Model.ClearAllSeekHelp) EventSystem.Regist(EventID.AcquireSystemRedAfterUnlock, private.OnLoginPostprocess) EventSystem.Regist(EventID.UI_WorldBoss_UpdateInfo, private.OnLoginPostprocess) EventSystem.Regist(EventID.TeamLevelUpdate, private.ResetNoticeList) WorldBoss_Model.RewardCountLeft = 0 WorldBoss_Model.PayRewardCount = 0 -- 剩余购买次数 WorldBoss_Model.RelivePaidCount = 0 WorldBoss_Model.MaxComboKillCount = 0 for _, v in DataSheetManager.WorldBossKillBroadcast:GetEnumerator() do if WorldBoss_Model.MaxComboKillCount < v.ID then WorldBoss_Model.MaxComboKillCount = v.ID end end private.IsPassGuideMission = false private.CurBossConfig = {} private.hasEnterBossDict = {} end function WorldBoss_Model.InitData(info) WorldBoss_Model.SyncWorldBossInfo(info) --该请求需要断线重连回来执行,来保证boss状态的正确 --因此从原来的Login_Model的OnRealEnterLevel提到了这里,原来的位置断线重连不会执行 WorldBoss_Model.C2GWorldBossData() end function WorldBoss_Model.OnShutdown() WorldBoss_Model.WorldBossInfoDic = nil WorldBoss_Model.CountryWorldBossInfoDic = nil end function WorldBoss_Model.SetIsEnterMain(value) private.isEnterMain = value end function WorldBoss_Model.GetIsEnterMain() return private.isEnterMain end --需要监听官职变化,修改挑战次数 function private.OnOfficialPositionUpdate() local newNums = CTL.Activities.GetLeftTimesByType(LuaConst.ActivityType.WorldBoss, hasEnterNums, officialPosNums) if newNums ~= WorldBoss_Model.RewardCountLeft then WorldBoss_Model.RewardCountLeft = newNums EventSystem.Dispatch(EventID.UI_PurchaseNumsSuccess) end end -- 登录和战斗胜利时同步世界BOSS信息 function WorldBoss_Model.SyncWorldBossInfo(worldbossInfo) WorldBoss_Model.PayRewardCount = worldbossInfo.payRewardCount hasEnterNums = worldbossInfo.rewardCountLeft officialPosNums = worldbossInfo.officialFreeCount WorldBoss_Model.RewardCountLeft = CTL.Activities.GetLeftTimesByType(LuaConst.ActivityType.WorldBoss, hasEnterNums, officialPosNums) private.IsPassGuideMission = worldbossInfo.WorldBossGuideDone for i, id in ipairs(worldbossInfo.EnterWorldBoss) do WorldBoss_Model.SetHasEnterBoss(id) end private.RefreshRedPoint() EventSystem.Dispatch(EventID.UI_WorldBoss_UpdateRewardTimes) end function private.OnLoginPostprocess() if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.WorldBoss) then private.InitNoticeList() private.RefreshRedPoint() end end function private.InitNoticeList() local _, bossId = private.GetCurHighestLvBossId() local _, countryBossId = private.GetCurHighestLvCountryBossId() private.InitBossNoticeList(bossId, countryBossId) private.InitCountryBossNoticeList(bossId,countryBossId) end --仅需求上线后,强制重置一次玩家勾选的boss数据(勾选可挑战的最高等级) --初始化衣昭勾选数据 function private.InitBossNoticeList(bossId, countryBossId) if bossId > 0 and not PersistentData.PlayerData:Get(NOTICE_HIGHEST_LV_BOSS_INITED) then local noticeList = {} if bossId > 0 then noticeList[bossId] = true end if countryBossId > 0 then noticeList[countryBossId] = true end PersistentData.PlayerData:Set(NoticePrefListKey, noticeList, true) PersistentData.PlayerData:Set(NOTICE_HIGHEST_LV_BOSS_INITED, true, true) end end --初始化乱世勾选数据 function private.InitCountryBossNoticeList(bossId, countryBossId) if countryBossId > 0 and not PersistentData.PlayerData:Get(NOTICE_HIGHEST_LV_COUNTRY_BOSS_INITED) then local noticeList = {} if bossId > 0 then noticeList[bossId] = true end if countryBossId > 0 then noticeList[countryBossId] = true end PersistentData.PlayerData:Set(NoticePrefListKey, noticeList, true) PersistentData.PlayerData:Set(NOTICE_HIGHEST_LV_COUNTRY_BOSS_INITED, true, true) end end --玩家升级有新boss解锁后,重置勾选数据 function private.ResetNoticeList() local isBossReset, bossId = private.GetCurHighestLvBossId() local isCountryBossReset, countryBossId = private.GetCurHighestLvCountryBossId() if isBossReset or isCountryBossReset then local noticeList = {} noticeList[bossId] = true if bossId > 0 then noticeList[bossId] = true end if countryBossId > 0 then noticeList[countryBossId] = true end PersistentData.PlayerData:Set(NoticePrefListKey, noticeList, true) end end --衣昭:是否重置勾选数据,当前可打最高bossId function private.GetCurHighestLvBossId() local bossId = 0 if WorldBoss_Model.WorldBossInfoDic then for _, bossInfo in pairs(WorldBoss_Model.WorldBossInfoDic) do if CTL.WorldBoss.GetBossStateAndLev(bossInfo) ~= CTL.WorldBoss.BossState.UnOpen then if bossInfo.ID > bossId then bossId = bossInfo.ID end end end local noticeList = PersistentData.PlayerData:Get(NoticePrefListKey) return not noticeList or not noticeList[bossId], bossId end return false, 0 end --乱世:是否重置勾选数据,当前可打最高bossId function private.GetCurHighestLvCountryBossId() local countryBossId = 0 if WorldBoss_Model.CountryWorldBossInfoDic then for _, bossInfo in pairs(WorldBoss_Model.CountryWorldBossInfoDic) do if CTL.WorldBoss.GetBossStateAndLev(bossInfo) ~= CTL.WorldBoss.BossState.UnOpen then if bossInfo.ID > countryBossId then countryBossId = bossInfo.ID end end end local noticeList = PersistentData.PlayerData:Get(NoticePrefListKey) return not noticeList or not noticeList[countryBossId], countryBossId end return false, 0 end function private.RefreshRedPoint() local isRed = false local isUnlock = MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.WorldBoss) local activityState = CTL.Activities.GetState(LuaConst.ActivityType.WorldBoss) if isUnlock and activityState == CTL.Activities.ActivityState.Opening then --有boss存活才给红点 isRed = WorldBoss_Model.IsBossAlive() and WorldBoss_Model.IsTimesLeft() end if isRed then EventSystem.Dispatch(EventID.UI_Activity_Refresh_Single_RedPoint, LuaConst.ActivityType.WorldBoss, true) CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.BossMain_World) else EventSystem.Dispatch(EventID.UI_Activity_Refresh_Single_RedPoint, LuaConst.ActivityType.WorldBoss, false) CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.BossMain_World) end end function WorldBoss_Model.OnEnterWorldBoss() WorldBoss_Model.RelivePaidCount = 0 WorldBoss_Model.SetIsAttacked(false) end function WorldBoss_Model.SetIsAttacked(value) private.IsAttackedByPlayers = value end function WorldBoss_Model.GetIsAttacked() return private.IsAttackedByPlayers end function WorldBoss_Model.IsTimesLeft() return WorldBoss_Model.RewardCountLeft > 0 end function WorldBoss_Model.EnterWorldBossRequest(bossID, helpGRoomID, helpAcid, enterType) if CTL.TeamMatch.IsCanGoOtherScene(LuaConst.LevelType.SyncWorldBoss) == false then return end local msg = world_boss_pb.EnterWorldBossReq() msg.worldbossCfgId = bossID msg.GRoomID = helpGRoomID or "" msg.Acid = "" if not string.isNilOrEmpty(helpAcid) then msg.Acid = helpAcid end msg.EnterType = enterType or WorldBoss_Model.EnterType.Common NetManager.SendMessage(MessageEnums.MessageEnterWorldBoss, msg) private.CurBossConfig = DataSheetManager.WorldBoss:GetDataByID(bossID) end function private.EnterWorldBossResponse(msgResp) logging.log(LTAG.LOG, "EnterWorldBossResponse") MDL.WorldBoss.OnEnterWorldBoss() end --收到世界boss的请求进入的回复信息 function private.OnG2CEnterWorldBoss(msg) logging.log(LTAG.LOG, "OnG2CEnterWorldBoss") if msg.ErrCode ~= 0 then NetManager.DealingWithMsgCode(msg.ErrCode) end end --付费复活 function WorldBoss_Model.WBPayForReliveRequest() local msg = world_boss_pb.WBPayForReliveReq() NetManager.SendMessage(MessageEnums.MessageWBPayForRelive, msg) end function private.WBPayForReliveResponse(msgResp) logging.log(LTAG.LOG, "WBPayForReliveResp") if msgResp.Resp.Code == 0 then WorldBoss_Model.RelivePaidCount = msgResp.paidCount end end --客户端主动请求世界boss信息,只在上线请求 function WorldBoss_Model.C2GWorldBossData() local msg = world_boss_pb.C2GWorldBossData() msg.bossType = LuaConst.WorldBossType.WorldBoss NetManager.SendMessage(MessageEnums.MessageC2GWorldBossData, msg) end --当前是否有满足挑战条件的boss存活 function WorldBoss_Model.IsBossAlive() if WorldBoss_Model.WorldBossInfoDic == nil then return false end for _, bossInfo in pairs(WorldBoss_Model.WorldBossInfoDic) do local lev = bossInfo.BossConfig.ShowLevel local curLv = MDL.HeroSelect.GetTeamLevel() if curLv >= lev then local bossState = CTL.WorldBoss.GetBossOpenState(bossInfo) if bossState == CTL.WorldBoss.BossState.Opening then return true end end end return false end function private.G2CWorldBossData(msgResp) local bossType = msgResp.bossType if WorldBoss_Model.WorldBossInfoDic == nil then WorldBoss_Model.WorldBossInfoDic = {} end if WorldBoss_Model.CountryWorldBossInfoDic == nil then WorldBoss_Model.CountryWorldBossInfoDic = {} end for _, info in ipairs(msgResp.datas) do local bossConfig = DataSheetManager.WorldBoss:GetDataByID(info.worldbossId) local bossInfoDic = {} if bossConfig.BossType == LuaConst.WorldBossType.WorldBoss then bossInfoDic = WorldBoss_Model.WorldBossInfoDic elseif bossConfig.BossType == LuaConst.WorldBossType.WarZoneWorldBoss then bossInfoDic = WorldBoss_Model.CountryWorldBossInfoDic end local bossInfo = bossInfoDic[info.worldbossId] if bossInfo then --移除旧的计时器 local timerID = bossInfo.TimerID if timerID then TimerUtil.Remove(timerID) end bossInfo.TimerID = nil bossInfo.NextTime = info.nextTime bossInfo.IsBossDead = info.isBoosDead else bossInfo = { ID = info.worldbossId, BossConfig = DataSheetManager.WorldBoss:GetDataByID(info.worldbossId), NextTime = info.nextTime, IsBossDead = info.isBoosDead, } bossInfoDic[info.worldbossId] = bossInfo end --添加计时器 --红点计算依赖这个计时器,可能正好卡到点计算结果有误,这里延迟1s local offsetTime = info.nextTime - UTL.Time.GetServerTimestamp() + 1 if offsetTime > 0 then local timerID = TimerUtil.Interval(function() private.ChangeWorldBossInfoState(info.worldbossId) end, offsetTime, 1) bossInfo.TimerID = timerID local isNotice = WorldBoss_Model.GetNoticePref(info.worldbossId) CTL.WorldBoss.SetBossNoticeState(info.worldbossId, isNotice, false) end end EventSystem.Dispatch(EventID.UI_WorldBoss_UpdateInfo) EventSystem.Dispatch(EventID.UI_CountryWorldBoss_UpdateInfo) end function WorldBoss_Model.CheckHasEnterBoss(id) if id == 0 then return true end return private.hasEnterBossDict[id] or false end function WorldBoss_Model.SetHasEnterBoss(id) private.hasEnterBossDict[id] = true end --客户端倒计时结束切换状态 function private.ChangeWorldBossInfoState(bossID) local bossInfo = WorldBoss_Model.WorldBossInfoDic[bossID] or WorldBoss_Model.CountryWorldBossInfoDic[bossID] if bossInfo then bossInfo.TimerID = nil bossInfo.IsBossDead = false end EventSystem.Dispatch(EventID.UI_WorldBoss_UpdateInfo) EventSystem.Dispatch(EventID.UI_CountryWorldBoss_UpdateInfo) end function private.OnPlayerHeroAllBeKilled(lastDeadHero) repeat if BattleDataGetter.IsCountryEveningBossLevel() then --晚间boss要求不弹通知 break end local killerEntity = lastDeadHero.components.record.KillerEntity if not killerEntity or not killerEntity:IsHero() then --正常情况, 比如被boss砍死了 break end local deadPlayerInfo = BattleDataGetter.GetPlayerInfo(lastDeadHero:GetPlayerID()) if not deadPlayerInfo then logging.error(LTAG.ERROR, "HYW : 警告!世界Boss找不到英雄单位的playerInfo!无法上传击杀消息!") break end local mainBoss = BattleDataGetter.GetMainBoss() if not mainBoss then logging.error(LTAG.ERROR, "HYW : 警告!世界Boss里不存在活着的Boss单位!无法上传击杀消息!") break end local killerPlayerInfo = BattleDataGetter.GetPlayerInfo(killerEntity:GetPlayerID()) local msg = worldboss_info_pb.C2GUploadWorldBossKillInfo() msg.killedAcid = deadPlayerInfo.acid msg.killedGuildId = deadPlayerInfo.guildID msg.killedName = deadPlayerInfo.name msg.killedGuildName = deadPlayerInfo.guildName msg.killerAcid = killerPlayerInfo.acid msg.killerGuildName = killerPlayerInfo.guildName msg.killerName = killerPlayerInfo.name msg.frameId = BattleDataGetter.GetCurFrameIndex() msg.bossIDs = mainBoss:GetOriginCharacterData().MonsterNameIDS msg.bossType = BattleDataGetter.IsWorldBossLevel() and 1 or 2 NetManager.SendMessage(MessageEnums.MessageC2GUploadWorldBossKillInfo, msg) until true end -- boss死亡,通知服务器进行战斗结算 function private.SendWorldBossResult(msg) NetManager.SendMessage(MessageEnums.MessageC2GUploadWorldBossResult, msg) end WorldBoss_Model.BattleResult = {} -- 缓存战斗结果,使用完恢复默认值 --战斗结算 function private.G2CWorldBossResult(msgResp) if msgResp.ErrCode ~= 0 then --结算不正常 logging.error(LTAG.ERROR, "G2CWorldBossResult error", msgResp.ErrCode) else MDL.Level.TrySendBattleEvent() BIManager.DispatchBIClientEvent(BIManager.EventName.WorldBossFinish) if UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UISwitchHeroReviveView) then UIManager.CloseView(Const_UI_Lua.UIEnum.UISwitchHeroReviveView) end WorldBoss_Model.BattleResult = msgResp-- 缓存战斗结果,使用完恢复默认值 if BattleDataGetter.IsWorldBossLevel() then hasEnterNums = msgResp.rewardCountLeft officialPosNums = msgResp.officialFreeCount or 0 WorldBoss_Model.RewardCountLeft = CTL.Activities.GetLeftTimesByType(LuaConst.ActivityType.WorldBoss, hasEnterNums, officialPosNums) elseif BattleDataGetter.IsWarZoneWorldBossLevel() then MDL.CountryWorldBoss.SetHasEnterNums(msgResp.rewardCountLeft) MDL.CountryWorldBoss.SetOfficialPosNums(msgResp.officialFreeCount or 0) local rewardCountLeft = CTL.Activities.GetLeftTimesByType(LuaConst.ActivityType.CountryWorldBoss, MDL.CountryWorldBoss.GetHasEnterNums(), MDL.CountryWorldBoss.GetOfficialPosNums()) MDL.CountryWorldBoss.SetRewardCountLeft(rewardCountLeft) end private.RefreshRedPoint() MDL.CountryWorldBoss.RefreshRedPoint() end private.CurBossConfig = {} end function private.OnErrorConfirm() CameraController.Instance:SetGray(false) MDL.Level.SendRoleLeaveFuben() end function WorldBoss_Model.SaveNoticePref(bossID, state) local noticeList = PersistentData.PlayerData:Get(NoticePrefListKey) if noticeList then noticeList[bossID] = state else noticeList = {} noticeList[bossID] = state end PersistentData.PlayerData:Set(NoticePrefListKey, noticeList, true) end function WorldBoss_Model.GetNoticePref(bossID) local noticeList = PersistentData.PlayerData:Get(NoticePrefListKey) if noticeList then if noticeList[bossID] == nil then return false end return noticeList[bossID] end return false end -- 奖励次数用完后提醒开关 function WorldBoss_Model.SaveRemindPref(bossType, state) local prefKey = RemindPrefKey_WorldBoss if bossType == LuaConst.WorldBossType.WarZoneWorldBoss then prefKey = RemindPrefKey_WarZoneWorldBoss end PersistentData.PlayerData:Set(prefKey, state, true) end function WorldBoss_Model.GetRemindPref(bossType) local prefKey = RemindPrefKey_WorldBoss if bossType == LuaConst.WorldBossType.WarZoneWorldBoss then prefKey = RemindPrefKey_WarZoneWorldBoss end local value = PersistentData.PlayerData:Get(prefKey) if not value then WorldBoss_Model.SaveRemindPref(bossType, false) value = false end return value end function WorldBoss_Model.WorldBossSeekHelp(isBattle, helpType, killerName) local myEntity = BattleDataGetter.GetCurEntity() if not BattleDataGetter.IsWorldBossTutorialLevel() then if myEntity then local myGuildID = myEntity:GetGuildID() if myGuildID == nil or myGuildID == 0 or myGuildID == "" then CTL.Tips.AddTipsMsg(Const_IDS.IDS_WorldBoss_NoHelp1) return false end end end local msg = world_boss_pb.WorldBossSeekHelpReq() msg.isBattle = isBattle msg.helpType = helpType msg.killerName = killerName or "" if string.isNilOrEmpty(killerName) then msg.IsBoss = false else msg.IsBoss = not BattleDataGetter.GetKillerIsPlayer(myEntity) end NetManager.SendMessage(MessageEnums.MessageWorldBossSeekHelp, msg) NotSyncBattleSetter.OnWorldBossSeekHelp() --ugly 因为有引导假副本的需求,服务器又不走常规流程, 所以这里只能让客户端写这样的代码 return true end function private.SeekHelpResp(msgResp) if msgResp.Resp.Code == 0 then CTL.Tips.AddTipsMsg(Const_IDS.IDS_WorldBoss_SuccessfulHelp) CTL.Sound.PlayGameSound("UI_voice_system") end end function private.OnPushSeekHelpMsg(msgResp) local helpInfo = nil local findIndex = 0 local lenght = #private.seekHelpList for i = 1, lenght do local info = private.seekHelpList[i] if info.playerName == msgResp.playerName then findIndex = i helpInfo = info end end if helpInfo then helpInfo.bossCfgId = msgResp.bossCfgId helpInfo.GRoomID = msgResp.GRoomID helpInfo.playerName = msgResp.playerName helpInfo.acid = msgResp.Acid helpInfo.icon = msgResp.icon helpInfo.portraitId = msgResp.portraitId helpInfo.frameId = msgResp.frameId helpInfo.helpType = msgResp.helpType helpInfo.killerName = msgResp.killerName helpInfo.killerIsBoss = msgResp.killerIsBoss helpInfo.guildID = msgResp.GuildID helpInfo.guildName = msgResp.GuildName helpInfo.closeTime = UTL.Time.GetServerTimestamp() + TIME_IGNORE --忽略时间 table.remove(private.seekHelpList, findIndex) else helpInfo = { bossCfgId = msgResp.bossCfgId, --bossid portraitId = msgResp.portraitId, -- 邀请人头像 frameId = msgResp.frameId, -- 邀请人头像框 GRoomID = msgResp.GRoomID, --房间id playerName = msgResp.playerName, --邀请人名字 acid = msgResp.Acid, -- 邀请人acid helpType = msgResp.helpType, --求助类型,对应 WorldBoss_Model.HelpType killerName = msgResp.killerName, --求助类型为 Killed 的时候,需要附带击杀者的名字 killerIsBoss = msgResp.killerIsBoss, --击杀者是否是boss,用来判断是否需要本地化 guildID = msgResp.GuildID, guildName = msgResp.GuildName, closeTime = UTL.Time.GetServerTimestamp() + TIME_IGNORE, --忽略时间 } end table.insert(private.seekHelpList, 1, helpInfo) CTL.WorldBoss.ShowHelpRemind(#private.seekHelpList > 0) EventSystem.Dispatch(EventID.RefreshWorldBossHelp) end function WorldBoss_Model.ClearAllSeekHelp() table.clearArray(private.seekHelpList) EventSystem.Dispatch(EventID.RefreshWorldBossHelp) CTL.WorldBoss.ShowHelpRemind(false) end function WorldBoss_Model.GetSeekHelpList() --移除掉过期的信息 local curTime = UTL.Time.GetServerTimestamp() for i = #private.seekHelpList, 1, -1 do local helpInfo = private.seekHelpList[i] if curTime >= helpInfo.closeTime then table.remove(private.seekHelpList, i) end end return private.seekHelpList end function WorldBoss_Model.DeleteHelpList(acid) local seekHelpList = private.seekHelpList for i,v in ipairs(seekHelpList) do if v.acid == acid then table.remove(seekHelpList, i) break end end EventSystem.Dispatch(EventID.RefreshWorldBossHelp) if #seekHelpList <= 0 then CTL.WorldBoss.ShowHelpRemind(false) end end function WorldBoss_Model.SendGotoHelpMsg(bossCfgId, gRoomID, acid) WorldBoss_Model.EnterWorldBossRequest(bossCfgId, gRoomID, acid, WorldBoss_Model.EnterType.Assistant) WorldBoss_Model.DeleteHelpList(acid) end function WorldBoss_Model.SendGotoRivalMsg(bossCfgId, gRoomID, acid) if string.isNilOrEmpty(acid) then logging.error(LTAG.ERROR, "这里不应该为空,如果出现空值,请一定记录操作过程!!") return end WorldBoss_Model.EnterWorldBossRequest(bossCfgId, gRoomID, acid, WorldBoss_Model.EnterType.Rival) MDL.Rival.DeleteRivalTracking(acid) end function private.OnPushWorldBossTeamMemberCall(resp) logging.log(LTAG.LOG, "OnPushWorldBossTeamMemberCall", resp) --服务器判断是否直接进入。跟随的队员收到队长的推送则为true。注意队伍里的跟随状态已经变成不跟随了,所以不能用。 if resp.autoEnter then local bossConfig = DataSheetManager.WorldBoss:GetDataByID(resp.BossCfgID) local bossType = bossConfig.BossType if bossType == LuaConst.WorldBossType.WorldBoss then CTL.WorldBoss.TryToEnterWorldBoss(resp.BossCfgID, resp.GRoomID, "", WorldBoss_Model.EnterType.Follow) elseif bossType == LuaConst.WorldBossType.WarZoneWorldBoss then CTL.CountryWorldBoss.TryToEnterWorldBoss(resp.BossCfgID, resp.GRoomID, "", WorldBoss_Model.EnterType.Follow) end else CTL.WorldBoss.OpenInvitePanel(resp) end end function WorldBoss_Model.C2GRecordWorldBossHelpClose() local msg = worldboss_info_pb.C2GRecordWorldBossHelpClose() NetManager.SendMessage(MessageEnums.MessageC2GRecordWorldBossHelpClose, msg) end function WorldBoss_Model.IsPassGuideMission() return private.IsPassGuideMission end function WorldBoss_Model.GetBossConfigDataByLevelID(levelID) for _,boss in DataSheetManager.WorldBoss:GetEnumerator() do if levelID == boss.MissonDataID then return boss end end return nil end return WorldBoss_Model