miduo_client/Assets/ManagedResources/~Lua/Modules/Guild/Transcript/GuildTranscriptManager.lua

173 lines
7.0 KiB
Lua
Raw Normal View History

2021-04-20 13:58:00 +08:00
GuildTranscriptManager = {};
2020-08-18 19:33:31 +08:00
local this = GuildTranscriptManager
2020-08-19 17:28:17 +08:00
local guildCheckpointConfig = ConfigManager.GetConfig(ConfigName.GuildCheckpointConfig)
local allChapterConfigData = {}
local curBoss = 1--当前bossId
local blood = 0--剩余血量万分比
local canSweep = 0--是否能扫荡今天是否挑战过这个boss
2020-08-22 19:08:50 +08:00
local isKillShowTip = false --当场战斗boss 是否击杀
2020-08-21 15:52:49 +08:00
local buffCount = 0--当前buff到多少索引
local buffTime = 0--buff结束时间
2020-08-20 20:05:38 +08:00
this.damage = 0
this.drop = nil--当场战斗掉落
2020-08-21 18:22:53 +08:00
this.shopGoodId = 10031--公会副本挑战价格
2021-03-23 15:25:00 +08:00
-- local refreshedBoss = {}
2020-08-31 17:02:58 +08:00
local endBossId = 0
2020-08-18 19:33:31 +08:00
function this.Initialize()
2020-08-19 17:28:17 +08:00
for _, configInfo in ConfigPairs(guildCheckpointConfig) do
table.insert(allChapterConfigData,configInfo)
2020-08-31 17:02:58 +08:00
if configInfo.Id > endBossId then
endBossId = configInfo.Id
end
2020-08-19 17:28:17 +08:00
end
end
function this.GetAllConFigData()
return allChapterConfigData
end
--请求当前副本章节
function this.GetGuildChallengeInfoRequest(fun)
NetManager.GetGuildChallengeInfoRequest(function (msg)
2020-08-20 20:05:38 +08:00
curBoss = msg.curBoss--当前bossId
blood = msg.blood--剩余血量万分比
canSweep = msg.canSweep--是否能扫荡今天是否挑战过这个boss
2020-08-21 15:52:49 +08:00
buffCount = msg.buffCount
buffTime = msg.buffTime
2020-08-26 15:10:33 +08:00
this.damage = msg.sweepDamage--上次挑战或扫荡的伤害
2021-03-23 15:25:00 +08:00
-- for i = 1, #msg.refreshedBoss do
-- refreshedBoss[msg.refreshedBoss[i]] = msg.refreshedBoss[i]
-- end
2020-08-26 15:10:33 +08:00
if msg.isRefresh == 1 then
2020-10-19 21:30:19 +08:00
LogPink("公会副本刷新次数····················msg.isRefresh "..msg.isRefresh)
2020-08-26 15:10:33 +08:00
PrivilegeManager.RemovePrivilege(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BATTLENUM,3013)
PrivilegeManager.RefreshStarPrivilege(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BATTLENUM)
PrivilegeManager.RefreshStarPrivilege(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BUY_BATTLENUM)
end
2020-08-31 17:02:58 +08:00
-- LogPink("curBoss "..curBoss.." blood "..blood.." canSweep "..canSweep.." buffCount "..buffCount.." buffTime "..buffTime.." sweepDamage "..msg.sweepDamage)
2020-08-19 17:28:17 +08:00
Game.GlobalEvent:DispatchEvent(GameEvent.Guild.RefreshGuildTranscript)
2020-08-21 15:52:49 +08:00
Game.GlobalEvent:DispatchEvent(GameEvent.Guild.RefreshGuildTranscriptBuff)
2020-08-19 17:28:17 +08:00
end)
end
--请求战斗
2020-08-22 19:08:50 +08:00
local attackTypeShotTime
2020-08-19 17:28:17 +08:00
function this.GuildChallengeRequest(attackType,callBack)
2020-08-22 19:08:50 +08:00
attackTypeShotTime = attackType
2020-08-20 20:05:38 +08:00
if attackType == 0 then
canSweep = 1
-- TODO: 没有战斗结果校验
2020-08-20 20:05:38 +08:00
NetManager.GuildChallengeRequest(this.GetCurBoss(),attackType,function (msg)
local fightData = BattleManager.GetBattleServerData(msg)
this.damage = msg.damage
this.drop = msg.drop
UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.GuildTranscript, callBack)
2020-08-22 18:03:43 +08:00
CheckRedPointStatus(RedPointType.Guild_Transcript)
2020-08-20 20:05:38 +08:00
end)
elseif attackType == 1 then--快速战斗 扫荡
NetManager.GuildChallengeRequest(this.GetCurBoss(),attackType,function (msg)
this.damage = msg.damage
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop, 1,function()
2020-08-21 18:22:53 +08:00
if callBack then
callBack()
end
2020-09-04 10:23:57 +08:00
end)
2020-08-22 18:03:43 +08:00
CheckRedPointStatus(RedPointType.Guild_Transcript)
2020-08-20 20:05:38 +08:00
end)
end
end
2020-08-22 19:08:50 +08:00
local oldBossId = 0
2020-08-20 20:05:38 +08:00
function this.RefreshGuildTranscriptInfo(msg)
2020-08-22 19:08:50 +08:00
oldBossId = curBoss
2020-08-20 20:05:38 +08:00
curBoss = msg.curBoss--当前bossId
blood = msg.blood--剩余血量万分比
2020-08-22 19:08:50 +08:00
isKillShowTip = false
2020-08-20 20:05:38 +08:00
if msg.isKill == 1 then
2020-08-22 19:08:50 +08:00
isKillShowTip = true
2020-08-31 17:19:14 +08:00
if attackTypeShotTime == 1 and endBossId ~= oldBossId then
2020-08-22 19:08:50 +08:00
local monsterData = this.GetMonsterConfigDataById(oldBossId)
2021-03-23 15:25:00 +08:00
PopupTipPanel.ShowTip( string.format(Language[11088],GetLanguageStrById(monsterData.ReadingName)))
2020-08-22 19:08:50 +08:00
end
2020-08-20 20:05:38 +08:00
end
2021-03-23 15:25:00 +08:00
-- LogRed("msg.isRefresh "..msg.isRefresh)
if msg.isRefresh == 1 then
-- LogPink("公会副本刷新次数····················msg.isRefresh "..msg.isRefresh)
PrivilegeManager.RemovePrivilege(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BATTLENUM,3013)
PrivilegeManager.RefreshStarPrivilege(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BATTLENUM)
PrivilegeManager.RefreshStarPrivilege(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BUY_BATTLENUM)
end
2020-08-20 20:05:38 +08:00
if oldBossId ~= curBoss then--前后ID不等认为是击杀
2022-05-24 15:12:44 +08:00
LogError("boss被击杀")
2020-08-20 20:05:38 +08:00
canSweep = 0
2022-05-24 15:12:44 +08:00
PrivilegeManager.RemovePrivilege(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BATTLENUM,3013)
PrivilegeManager.RefreshStarPrivilege(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BATTLENUM)
PrivilegeManager.RefreshStarPrivilege(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BUY_BATTLENUM)
2020-08-20 20:05:38 +08:00
end
Game.GlobalEvent:DispatchEvent(GameEvent.Guild.RefreshGuildTranscript)
end
2020-08-22 19:08:50 +08:00
function this.IsKillShowTip()
2020-08-31 17:19:14 +08:00
if isKillShowTip and attackTypeShotTime == 0 and endBossId ~= oldBossId then
2020-08-22 19:08:50 +08:00
local monsterData = this.GetMonsterConfigDataById(oldBossId)
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip( string.format(Language[11088],GetLanguageStrById(monsterData.ReadingName)) )
2020-08-22 19:08:50 +08:00
end
end
2020-08-21 15:52:49 +08:00
function this.RefreshGuildTranscriptBuffInfo(msg)
-- --LogGreen("msg.buffCount "..msg.buffCount.." msg.buffTime "..msg.buffTime)
2020-08-21 15:52:49 +08:00
buffCount = msg.buffCount
buffTime = msg.buffTime
Game.GlobalEvent:DispatchEvent(GameEvent.Guild.RefreshGuildTranscriptBuff)
end
2020-08-22 19:08:50 +08:00
function this.GetMonsterConfigDataById(chapterId)
local MonsterId = ConfigManager.GetConfigData(ConfigName.GuildCheckpointConfig,chapterId).MonsterId
local monsterConFig = nil
local monsterGrip = ConfigManager.GetConfigData(ConfigName.MonsterGroup,MonsterId)
if not monsterGrip then return nil end
local monsterId = 0
for i = 1, #monsterGrip.Contents do
if monsterId <= 0 then
for j = 1, #monsterGrip.Contents[i] do
if monsterGrip.Contents[i][j] > 0 then
monsterId = monsterGrip.Contents[i][j]
break
end
end
end
end
if monsterId <= 0 then return nil end
local monsterData = ConfigManager.GetConfigData(ConfigName.MonsterConfig,monsterId)
return monsterData
end
2020-08-20 20:05:38 +08:00
-- 获取剩余挑战次数 特权
function this.GetCanBattleCount()
return PrivilegeManager.GetPrivilegeRemainValue(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BATTLENUM)
end
-- 获取剩余挑战购买次数 特权
function this.GetCanBuyBattleCount()
return PrivilegeManager.GetPrivilegeRemainValue(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BUY_BATTLENUM)
end
function this.GetRedPointState()
2020-08-22 21:43:58 +08:00
if PlayerManager.familyId == 0 then return false end
2020-08-20 20:05:38 +08:00
return PrivilegeManager.GetPrivilegeRemainValue(PRIVILEGE_TYPE.GUILDTRANSCRIPT_BATTLENUM) > 0
2020-08-19 17:28:17 +08:00
end
function this.GetCurBoss()
return curBoss
end
function this.GetBlood()
if blood < 0 then
blood = 10000
end
2020-08-19 17:28:17 +08:00
return blood
end
function this.SetCanSweep1()
canSweep = 0
end
2020-08-19 17:28:17 +08:00
function this.GetCanSweep()
return canSweep
2020-08-18 19:33:31 +08:00
end
2020-08-21 15:52:49 +08:00
function this.GetbuffTime()
return buffTime
end
function this.GetbuffCount()
return buffCount
end
2020-08-18 19:33:31 +08:00
return this