2020-08-25 15:46:38 +08:00
|
|
|
|
EndLessMapManager = {};
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local this = EndLessMapManager
|
|
|
|
|
local endLessConfig = ConfigManager.GetConfig(ConfigName.EndlessMapConfig)
|
2021-05-14 19:11:40 +08:00
|
|
|
|
local gameSetting = ConfigManager.GetConfig(ConfigName.GameSetting)
|
|
|
|
|
local endlessHeroProp = ConfigManager.GetConfig(ConfigName.EndlessHeroProp)
|
|
|
|
|
local skillConfig = ConfigManager.GetConfig(ConfigName.SkillConfig)
|
|
|
|
|
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
|
|
|
|
local passiveSkillConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillConfig)
|
|
|
|
|
local passiveSkillLogicConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillLogicConfig)
|
|
|
|
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.limiteLevel = gameSetting[1].EndlessMinLevel
|
|
|
|
|
|
|
|
|
|
|
2021-05-18 11:44:17 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
function this.Initialize()
|
|
|
|
|
this.isCanNote = false -- 是否进入可标记状态
|
|
|
|
|
this.PointNoteDataList = {} -- 标记列表
|
|
|
|
|
this.hungery = false -- 没有行动力了
|
|
|
|
|
this.leftEnergy = 0 -- 剩余行动力
|
|
|
|
|
this.totalEnergy = 0 -- 总行动力
|
|
|
|
|
this.targetMapId = 0 -- 传送去的地图Id
|
|
|
|
|
this.justEnterMap = false -- 才刚进图伦家
|
|
|
|
|
this.srcMapId = 0 -- 传送时上一张地图的ID
|
|
|
|
|
this.curMapName = "" -- 当前地图名
|
|
|
|
|
this.mapFightTimes = 0 -- 当前地图战斗次数
|
|
|
|
|
this.energyCost = 0 -- 当前地图行动力消耗
|
|
|
|
|
this.isReset = false -- 是处于复位状态
|
|
|
|
|
this.openMapInfo = {} -- 地图的开放消息
|
|
|
|
|
this.isTrigger = false -- 检测在是否在触发事件
|
|
|
|
|
this.isUpdateOnClose = false -- 检测在MapPanel隐藏时是否更新过, 在面板关闭后初始化
|
|
|
|
|
this.freshPointData = {}
|
|
|
|
|
this.isAddPoint = false -- 是否新增一个刷新点
|
|
|
|
|
this.openMapId = 0 -- 开放的地图ID
|
|
|
|
|
this.worldLevel = 0 -- 开放的世界等级
|
|
|
|
|
this.isOpenedFullPanel = false -- 是否在退出地图前打开过全屏界面
|
|
|
|
|
-- 打开过编队界面
|
|
|
|
|
this.openedFormat = false
|
|
|
|
|
this.isSkipFight = 1 -- 服务器记录的是否跳过战斗
|
|
|
|
|
this.EndLessRoleDead = false -- 无尽副本角色进入死亡状态,走一步重置
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 在地图中更换编队后,更新上阵编队的最大血量值
|
|
|
|
|
function this.UpDateTeamMaxHp(info)
|
|
|
|
|
-- 不是无尽副本,直接返回
|
|
|
|
|
if CarbonManager.difficulty ~= CARBON_TYPE.ENDLESS then return end
|
|
|
|
|
-- 替换地图编队的最大血量
|
|
|
|
|
local mapTeam = {}
|
|
|
|
|
for i = 1, #info do
|
|
|
|
|
local roleId = info[i].heroId
|
|
|
|
|
local allProp = HeroManager.CalculateWarAllProVal(roleId)
|
|
|
|
|
allProp[2] = info[i].heroHp
|
|
|
|
|
allProp[3] = info[i].heroMaxHp
|
|
|
|
|
--Log(" 更换编队后的剩余血量 == " .. info[i].heroHp)
|
|
|
|
|
mapTeam[i] = {
|
|
|
|
|
heroId = roleId,
|
|
|
|
|
allProVal = allProp,
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
MapManager.formationList = mapTeam
|
2021-04-21 16:36:12 +08:00
|
|
|
|
--LogGreen("indication的编队长度:"..#mapTeam)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
CallBackOnPanelOpen(UIName.MapPanel, function ()
|
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Map.FormationHpChange)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 解析标记点的数据
|
|
|
|
|
function this.InitMapNoteData(signs)
|
2020-08-14 11:44:58 +08:00
|
|
|
|
LogPink("signs是:"..signs)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 不是无尽副本,直接返回
|
|
|
|
|
if CarbonManager.difficulty ~= CARBON_TYPE.ENDLESS then return end
|
|
|
|
|
-- 初始化
|
|
|
|
|
for i, v in ConfigPairs (endLessConfig) do
|
|
|
|
|
this.PointNoteDataList[v.Id] = {}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if #signs > 0 then
|
|
|
|
|
for i = 1, #signs do
|
|
|
|
|
local data = {}
|
|
|
|
|
data.notePos = signs[i].cellId
|
|
|
|
|
data.noteInfo = signs[i].info
|
|
|
|
|
data.mapId = signs[i].mapId
|
|
|
|
|
--Log("标记内容" .. data.noteInfo)
|
|
|
|
|
local u, v = Map_Pos2UV(data.notePos)
|
|
|
|
|
--Log("标记位置(" ..u .. ", " .. v .. ")")
|
2020-08-14 11:44:58 +08:00
|
|
|
|
-- this.PointNoteDataList[data.mapId][data.notePos] = data
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.PointNoteDataList[data.mapId][data.notePos] = data
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-08-14 11:44:58 +08:00
|
|
|
|
LogPink("#PointNoteDataList"..#this.PointNoteDataList)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.InitRefreshPoint(refreshInfo, func)
|
|
|
|
|
--Log("需要刷新点的数量是 == " .. #refreshInfo )
|
|
|
|
|
this.freshPointData = {}
|
|
|
|
|
for i = 1, #refreshInfo do
|
|
|
|
|
local data = refreshInfo[i]
|
|
|
|
|
if data.time > math.ceil(PlayerManager.serverTime) then
|
|
|
|
|
this.freshPointData[data.cellId] = data.time
|
|
|
|
|
--Log("需要等待" .. data.time - math.ceil(PlayerManager.serverTime) .. "秒后刷新")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if func then func() end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 登录初始化地图数据
|
|
|
|
|
function this.InitMapInfoData(mapInfo)
|
2021-01-09 14:20:06 +08:00
|
|
|
|
Log("开启的世界地图ID是 --=- " .. mapInfo.mapId)
|
|
|
|
|
Log("开启的世界等级是 === " .. mapInfo.worldLevel)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.openMapId = mapInfo.mapId -- 开放的地图ID
|
|
|
|
|
this.worldLevel = mapInfo.worldLevel -- 开放的世界等级
|
|
|
|
|
|
|
|
|
|
local score = 0
|
|
|
|
|
if not mapInfo.bloodScore or mapInfo.bloodScore < 0 then
|
|
|
|
|
score = 0
|
|
|
|
|
else
|
|
|
|
|
score = mapInfo.bloodScore
|
|
|
|
|
end
|
|
|
|
|
MatchDataManager.myScore = mapInfo.bloodScore -- 血战的初始积分
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
-- ================================== 妖灵师状态刷新 ========================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 刷新地图中的队伍数据
|
|
|
|
|
function this.RefershMapTeam()
|
2020-11-16 15:24:09 +08:00
|
|
|
|
if CarbonManager.difficulty == CARBON_TYPE.ENDLESS and MapManager.Mapping then
|
|
|
|
|
MapManager.formationList = this.RefreshTeamInfo()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-05-18 11:44:17 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
-- 无尽副本删除编队中某一个成员的数据
|
|
|
|
|
function this.DeleteDeadRole()
|
2021-04-09 12:26:35 +08:00
|
|
|
|
if CarbonManager.difficulty ~= CARBON_TYPE.ENDLESS then Log(Language[11225]) return end
|
2021-01-09 14:20:06 +08:00
|
|
|
|
Log("删除死掉的人!")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 死人后重组
|
|
|
|
|
local newMapTeam = {} -- 地图中的编队数据
|
|
|
|
|
local newFormation = {} -- 编队界面的编队数据
|
|
|
|
|
local curTeam = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_ENDLESS_MAP)
|
|
|
|
|
-- 编队界面的数据
|
|
|
|
|
newFormation.teamHeroInfos = {}
|
|
|
|
|
newFormation.teamPokemonInfos = {}
|
|
|
|
|
newFormation.teamId = FormationTypeDef.FORMATION_ENDLESS_MAP
|
|
|
|
|
newFormation.teamName = curTeam.teamName
|
|
|
|
|
newFormation.teamPokemonInfos = curTeam.teamPokemonInfos
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--Log("成员数量 -- " .. #curTeam.teamHeroInfos)
|
|
|
|
|
-- 成员数据
|
|
|
|
|
for i = 1, #curTeam.teamHeroInfos do
|
|
|
|
|
local roleData = curTeam.teamHeroInfos[i]
|
|
|
|
|
-- 如果队员没死翘翘了
|
|
|
|
|
local curRoleHp = this.GetHeroLeftBlood(roleData.heroId)
|
|
|
|
|
if curRoleHp > 0 then
|
|
|
|
|
-- 地图数据重组
|
|
|
|
|
local allProp = HeroManager.CalculateWarAllProVal(roleData.heroId)
|
|
|
|
|
allProp[2] = curRoleHp
|
|
|
|
|
newMapTeam[#newMapTeam + 1] = {
|
|
|
|
|
heroId = roleData.heroId,
|
|
|
|
|
allProVal = allProp,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- 编队界面数据重组
|
|
|
|
|
table.insert(newFormation.teamHeroInfos, roleData)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return newFormation, newMapTeam
|
|
|
|
|
end
|
2021-05-18 11:44:17 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
-- 判断队伍是否还有活着的人
|
|
|
|
|
function this.IsMapTeamAlive()
|
2021-04-21 16:36:12 +08:00
|
|
|
|
--LogGreen("编队人数:"..#MapManager.formationList)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
for i = 1, #MapManager.formationList do
|
|
|
|
|
if MapManager.formationList[i].allProVal[2] > 0 then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
2021-05-18 11:44:17 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
-- 刷新编队界面得到的编队以及地图中的编队数据, 只有打开编队界面才刷新地图编队
|
|
|
|
|
function this.RrefreshFormation()
|
|
|
|
|
if CarbonManager.difficulty == CARBON_TYPE.ENDLESS then
|
|
|
|
|
local teamId = FormationTypeDef.FORMATION_ENDLESS_MAP
|
|
|
|
|
local newFormation, newMapTeam = this.DeleteDeadRole()
|
|
|
|
|
FormationManager.formationList[teamId] = newFormation
|
2021-01-09 14:20:06 +08:00
|
|
|
|
Log("刷新一次地图编队数据")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
MapManager.formationList = newMapTeam
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- =============================================================================================
|
|
|
|
|
-- ==================== 地图标记 ===============================================================
|
|
|
|
|
-- 无尽副本是否进入了可标记状态
|
|
|
|
|
function this.IsCanNoteState()
|
|
|
|
|
local canNote = false
|
|
|
|
|
if CarbonManager.difficulty == CARBON_TYPE.ENDLESS then
|
|
|
|
|
if this.isCanNote then
|
|
|
|
|
canNote = true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return canNote
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 进入标记状态点击后保存点击选中的坐标值
|
|
|
|
|
function this.SetNotePos(u, v)
|
|
|
|
|
local selectedPos = Map_UV2Pos(u, v)
|
|
|
|
|
-- 没有标记过打开标记面板
|
|
|
|
|
local panelType = 1
|
|
|
|
|
panelType = this.IsPointNote(selectedPos) and 2 or 1
|
|
|
|
|
UIManager.OpenPanel(UIName.MapNotePopup, selectedPos, panelType)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 判断某一个点是否已经被标记
|
|
|
|
|
function this.IsPointNote(pos)
|
|
|
|
|
local isNote = false
|
|
|
|
|
if not this.PointNoteDataList[MapManager.curMapId][pos] or this.PointNoteDataList[MapManager.curMapId][pos].notePos == 0 then
|
|
|
|
|
isNote = false
|
|
|
|
|
else
|
|
|
|
|
isNote = true
|
|
|
|
|
end
|
|
|
|
|
return isNote
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 删除一个已经标记的点, 需要删除的点必定存在,不然判断方法就完蛋了
|
|
|
|
|
function this.DeleteNotePoint(pos, func)
|
|
|
|
|
local noteData = this.PointNoteDataList[MapManager.curMapId][pos]
|
|
|
|
|
local deletePos = pos
|
|
|
|
|
local mapId = MapManager.curMapId
|
|
|
|
|
local deleteInfo = noteData.noteInfo
|
|
|
|
|
local deteType = 2
|
|
|
|
|
|
|
|
|
|
NetManager.RequestNotePoint(mapId, deletePos, deleteInfo, deteType, function ()
|
|
|
|
|
if func then func() end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- ===========================================================================================
|
|
|
|
|
-- =================== 消耗行动力 ===================================================
|
|
|
|
|
-- 进入当前地图消耗行动力数值
|
|
|
|
|
function this.EnergyCostEnterMap(mapId)
|
|
|
|
|
-- 只有无尽副本执行
|
|
|
|
|
if CarbonManager.difficulty ~= CARBON_TYPE.ENDLESS then return end
|
|
|
|
|
local cost = 0
|
|
|
|
|
local curCost = endLessConfig[this.srcMapId].TeleportCost
|
|
|
|
|
local distCost = endLessConfig[mapId].TeleportCost
|
|
|
|
|
cost = math.abs(distCost - curCost)
|
|
|
|
|
return cost
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 角色进入鸡儿状态
|
|
|
|
|
function this.roleIsHungery()
|
|
|
|
|
local isHungery = false
|
|
|
|
|
if CarbonManager.difficulty == CARBON_TYPE.ENDLESS then
|
|
|
|
|
if this.hungery then
|
|
|
|
|
isHungery = true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return isHungery
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 判断鸡儿状态
|
|
|
|
|
function this.isHungery()
|
|
|
|
|
local curEnergy = EndLessMapManager.leftEnergy
|
|
|
|
|
if curEnergy <= 0 then
|
|
|
|
|
EndLessMapManager.hungery = true
|
|
|
|
|
else
|
|
|
|
|
EndLessMapManager.hungery = false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 是否有足够的行动力给你去浪
|
|
|
|
|
function this.IsCanTransport(mapId)
|
|
|
|
|
local canTransport = false
|
|
|
|
|
canTransport = this.leftEnergy >= this.EnergyCostEnterMap(mapId)
|
|
|
|
|
|
|
|
|
|
return canTransport
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 向服务器索要剩余行动力
|
|
|
|
|
function this.GetLeftEnergy(func)
|
|
|
|
|
if CarbonManager.difficulty ~= CARBON_TYPE.ENDLESS then return end
|
|
|
|
|
NetManager.ReqeustRefreshEnergy(func)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 返回行动力上限。跟VIP挂钩
|
|
|
|
|
function this.GetTotalEnergy()
|
|
|
|
|
return PrivilegeManager.GetPrivilegeNumber(20)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--判断当前的行动力是已经是上限
|
|
|
|
|
function this.EnergyEnough()
|
|
|
|
|
-- 地图里用显示的数据,地图外面用背包的数据
|
2020-11-16 15:24:09 +08:00
|
|
|
|
local curEnergy = BagManager.GetItemCountById(1)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local limitValue = this.GetTotalEnergy()
|
|
|
|
|
return curEnergy >= limitValue
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 返回剩余行动力
|
|
|
|
|
function this.GetLeftMapEnergy()
|
2020-11-16 15:24:09 +08:00
|
|
|
|
return BagManager.GetItemCountById(1)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- =================================================================================
|
|
|
|
|
-- ============= 其他杂项处理方法 =====================================================
|
|
|
|
|
-- 获取统计数据
|
|
|
|
|
function this.OutMapStats(msg)
|
|
|
|
|
if msg then
|
|
|
|
|
this.mapFightTimes = msg.fightCount
|
|
|
|
|
this.energyCost = msg.consumeExecution
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 通过传送门传送到想去的地图
|
2020-09-02 13:35:29 +08:00
|
|
|
|
-- function this.TranssportByMapId(mapId)
|
|
|
|
|
-- Game.GlobalEvent:DispatchEvent(GameEvent.Map.Out, mapId, 1)
|
|
|
|
|
-- end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
-- 获取开放的地图数据
|
|
|
|
|
function this.GetOpenMapInfo(openMapId)
|
|
|
|
|
for i = 1, #openMapId do
|
|
|
|
|
this.openMapInfo[openMapId[i]] = openMapId[i]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 判断无尽副本当前地图是否开放
|
|
|
|
|
function this.IsThisMapOpen(mapId)
|
|
|
|
|
local isOpen = false
|
|
|
|
|
if this.openMapInfo[mapId] and this.openMapInfo[mapId] > 0 then
|
|
|
|
|
Log("openMapInfo == " .. this.openMapInfo[mapId])
|
|
|
|
|
isOpen = true
|
|
|
|
|
else
|
|
|
|
|
isOpen = false
|
|
|
|
|
end
|
|
|
|
|
return isOpen
|
|
|
|
|
end
|
|
|
|
|
|
2020-08-27 13:59:14 +08:00
|
|
|
|
--红点检测
|
|
|
|
|
function this.EndlessRedCheck()
|
2020-08-28 16:35:08 +08:00
|
|
|
|
if this.GetLeftMapEnergy() >= 100 and ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.ENDLESS)then
|
2020-08-27 13:59:14 +08:00
|
|
|
|
return true
|
|
|
|
|
else
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
2021-05-14 19:11:40 +08:00
|
|
|
|
--------------------------------------------------------------------------------编队 神将-------------------------------------------------------------------------------
|
|
|
|
|
this.heroDataLists = {}
|
|
|
|
|
function this.InitAllEndlessHero(heroList,isClear)
|
2021-05-15 18:25:45 +08:00
|
|
|
|
if not this.heroDataLists then
|
2021-05-14 19:11:40 +08:00
|
|
|
|
this.heroDataLists = {}
|
|
|
|
|
end
|
|
|
|
|
for i = 1 ,#heroList do
|
|
|
|
|
this.InitSingleEndlessHero(heroList[i])
|
|
|
|
|
end
|
2021-05-18 11:44:17 +08:00
|
|
|
|
for k,v in pairs(this.heroDataLists) do
|
|
|
|
|
this.InitHeroHp(v)
|
|
|
|
|
end
|
2021-05-14 19:11:40 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.InitSingleEndlessHero(_msgHeroData)
|
|
|
|
|
local heroData = {}
|
|
|
|
|
heroData.heroBackData = _msgHeroData
|
|
|
|
|
heroData.dynamicId = _msgHeroData.id
|
|
|
|
|
heroData.id = _msgHeroData.heroId
|
|
|
|
|
heroData.star = _msgHeroData.star
|
|
|
|
|
heroData.lv = _msgHeroData.level
|
|
|
|
|
heroData.breakId = _msgHeroData.breakId
|
|
|
|
|
-- --LogGreen("heroData.id:"..heroData.id.." heroData.breakId:"..heroData.breakId)
|
|
|
|
|
heroData.upStarId = _msgHeroData.starBreakId
|
|
|
|
|
heroData.createTime = _msgHeroData.createTimelocal
|
|
|
|
|
heroData.lockState = _msgHeroData.lockState
|
|
|
|
|
heroData.createtype = _msgHeroData.createtype
|
|
|
|
|
heroData.changeId = _msgHeroData.changeId--置换id
|
|
|
|
|
heroData.heroConfig = heroConfig[_msgHeroData.heroId]
|
|
|
|
|
heroData.maxStar = heroData.heroConfig.MaxRank
|
|
|
|
|
heroData.equipIdList = _msgHeroData.equipIdList
|
|
|
|
|
for i = 1 , #heroData.equipIdList do
|
|
|
|
|
EquipManager.SetEquipUpHeroDid(heroData.equipIdList[i],heroData.dynamicId)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
heroData.jewels = _msgHeroData.jewels
|
|
|
|
|
this.InitBaoDatas(_msgHeroData.jewels,_msgHeroData.fourTotal,_msgHeroData.treeLevel)
|
|
|
|
|
for i = 1 , #heroData.jewels do
|
|
|
|
|
this.SetEquipTreasureUpHeroDid(heroData.jewels[i],heroData.dynamicId)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
heroData.talismanList = _msgHeroData.especialEquipLevel --法宝等级
|
|
|
|
|
heroData.soulPrintList = {}
|
|
|
|
|
if (#_msgHeroData.soulPos >= 1) then
|
|
|
|
|
local soulPrintList = {}
|
|
|
|
|
for i, v in ipairs(_msgHeroData.soulPos) do
|
|
|
|
|
local soulPrint = {equipId = v.equipId, position = v.position}
|
|
|
|
|
SoulPrintManager.AddSoulPrintUpHeroDynamicId(v.equipId,heroData.dynamicId)
|
|
|
|
|
table.insert(soulPrintList, soulPrint)
|
|
|
|
|
end
|
|
|
|
|
heroData.soulPrintList = soulPrintList
|
|
|
|
|
end
|
|
|
|
|
--乘减属性集合
|
|
|
|
|
heroData.MLSproList={}
|
|
|
|
|
heroData.formationList = {}--所在编队list
|
|
|
|
|
local actionPowerRormula = gameSetting[1].ActionPowerRormula
|
|
|
|
|
heroData.actionPower =
|
|
|
|
|
heroData.heroConfig.ActionPower +
|
|
|
|
|
math.floor(
|
|
|
|
|
(actionPowerRormula[1] * math.pow(heroData.lv, 3) + actionPowerRormula[2] * math.pow(heroData.lv, 2) +
|
|
|
|
|
actionPowerRormula[3] * heroData.lv +
|
|
|
|
|
actionPowerRormula[4])
|
|
|
|
|
)
|
|
|
|
|
heroData.skillIdList = this.UpdateSkillIdList(heroData)
|
|
|
|
|
heroData.passiveSkillList = this.UpdatePassiveHeroSkill(heroData)
|
|
|
|
|
|
|
|
|
|
heroData.hp = heroData.heroConfig.Hp
|
|
|
|
|
heroData.attack = heroData.heroConfig.Attack
|
|
|
|
|
heroData.pDef = heroData.heroConfig.PhysicalDefence
|
|
|
|
|
heroData.mDef = heroData.heroConfig.MagicDefence
|
|
|
|
|
heroData.speed = heroData.heroConfig.Speed
|
|
|
|
|
heroData.skinId = _msgHeroData.skinId
|
|
|
|
|
if heroData.skinId == 0 then
|
|
|
|
|
heroData.skinConfig = heroData.heroConfig
|
|
|
|
|
heroData.live = GetResourcePath(heroData.heroConfig.Live)
|
|
|
|
|
heroData.painting = GetResourcePath(heroData.heroConfig.Painting)
|
|
|
|
|
heroData.icon = GetResourcePath(heroData.heroConfig.Icon)
|
|
|
|
|
heroData.scale = heroData.heroConfig.Scale
|
|
|
|
|
heroData.position = heroData.heroConfig.Position
|
|
|
|
|
else
|
|
|
|
|
heroData.skinConfig = ConfigManager.GetConfigDataByKey(ConfigName.HeroSkin,"Type",heroData.skinId)
|
|
|
|
|
heroData.live = GetResourcePath(heroData.skinConfig.Live)
|
|
|
|
|
heroData.painting = GetResourcePath(heroData.skinConfig.Painting)
|
|
|
|
|
heroData.icon = GetResourcePath(heroData.skinConfig.Icon)
|
|
|
|
|
heroData.scale = heroData.skinConfig.Scale
|
|
|
|
|
heroData.position = heroData.skinConfig.Position
|
|
|
|
|
end
|
|
|
|
|
heroData.profession = heroData.heroConfig.Profession
|
|
|
|
|
heroData.ProfessionResourceId = heroData.heroConfig.ProfessionResourceId
|
|
|
|
|
if GetJobSpriteStrByJobNum(heroData.heroConfig.Profession) then
|
|
|
|
|
heroData.professionIcon = GetJobSpriteStrByJobNum(heroData.heroConfig.Profession)
|
|
|
|
|
else
|
|
|
|
|
heroData.professionIcon = GetJobSpriteStrByJobNum(1)
|
|
|
|
|
end
|
|
|
|
|
heroData.name = GetLanguageStrById(heroData.heroConfig.ReadingName)
|
|
|
|
|
heroData.property = heroData.heroConfig.PropertyName
|
|
|
|
|
heroData.sortId = #this.heroDataLists + 1
|
|
|
|
|
|
|
|
|
|
heroData.harmonyGongMing = _msgHeroData.createtype
|
|
|
|
|
this.heroDataLists[heroData.dynamicId] = heroData
|
|
|
|
|
heroData.warPower = HeroManager.CalculateHeroAllProValList(1, heroData.dynamicId, false)[HeroProType.WarPower]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--宝器
|
|
|
|
|
local jewelConfig = ConfigManager.GetConfig(ConfigName.JewelConfig)
|
|
|
|
|
function this.InitBaoDatas(_soulEquips,_fourTotal,_treeLevel)
|
|
|
|
|
if not this.allTreasures then
|
|
|
|
|
this.allTreasures = {}
|
|
|
|
|
end
|
|
|
|
|
if not _soulEquips then return end
|
|
|
|
|
for i = 1, #_soulEquips do
|
|
|
|
|
this.InitSingleTreasureData(_soulEquips[i],_fourTotal,_treeLevel)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--初始化单个宝物的数据
|
|
|
|
|
function this.InitSingleTreasureData(_singleData,_fourTotal,_treeLevel)
|
|
|
|
|
if not _singleData or not _singleData.equipId then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local single={}
|
|
|
|
|
local staticId=_singleData.equipId
|
|
|
|
|
local currJewel=jewelConfig[staticId]
|
|
|
|
|
single.id=staticId
|
|
|
|
|
single.idDyn=_singleData.id
|
|
|
|
|
single.lv=_singleData.exp
|
|
|
|
|
single.refineLv=_singleData.rebuildLevel
|
|
|
|
|
single.maxLv=currJewel.Max[1]
|
|
|
|
|
single.maxRefineLv=currJewel.Max[2]
|
|
|
|
|
single.upHeroDid=""
|
|
|
|
|
single.maxTreeLv = currJewel.GodHoodMaxlv
|
|
|
|
|
single.treeLv = _treeLevel
|
|
|
|
|
single.fourTotal = _fourTotal
|
|
|
|
|
local quantity=currJewel.Level
|
|
|
|
|
single.quantity=quantity
|
|
|
|
|
single.frame=GetQuantityImageByquality(quantity)
|
|
|
|
|
single.name=itemConfig[staticId].Name
|
|
|
|
|
single.itemConfig=itemConfig[staticId]
|
|
|
|
|
single.levelPool=currJewel.LevelupPool
|
|
|
|
|
single.proIcon=GetProStrImageByProNum(currJewel.Race)
|
|
|
|
|
single.refinePool=currJewel.RankupPool
|
|
|
|
|
single.equipType=currJewel.Location
|
|
|
|
|
if currJewel.Location==1 then
|
|
|
|
|
single.type=Language[10505]
|
|
|
|
|
else
|
|
|
|
|
single.type=Language[10506]
|
|
|
|
|
end
|
|
|
|
|
single.icon=GetResourcePath(itemConfig[staticId].ResourceID)
|
|
|
|
|
single.strongConfig=this.GetCurrTreasureLvConfig(1,currJewel.LevelupPool,_singleData.exp)
|
|
|
|
|
single.refineConfig=this.GetCurrTreasureLvConfig(2,currJewel.RankupPool,_singleData.rebuildLevel)
|
|
|
|
|
this.allTreasures[_singleData.id]=single
|
|
|
|
|
end
|
|
|
|
|
local jewerLevelUpConfig = ConfigManager.GetConfig(ConfigName.JewelRankupConfig)
|
|
|
|
|
--获取当前宝物升级数据
|
|
|
|
|
function this.GetCurrTreasureLvConfig(_type,_id,_lv)
|
|
|
|
|
for _, configInfo in ConfigPairs(jewerLevelUpConfig) do
|
|
|
|
|
if configInfo.Type==_type and configInfo.PoolID==_id and configInfo.Level==_lv then
|
|
|
|
|
return configInfo
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--根据动态id获取宝物
|
|
|
|
|
function this.GetSingleTreasureByIdDyn(_idDyn)
|
|
|
|
|
if not this.allTreasures[_idDyn] == nil then
|
|
|
|
|
return nil
|
|
|
|
|
end
|
|
|
|
|
return this.allTreasures[_idDyn]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--设置装备穿戴的英雄
|
|
|
|
|
function this.SetEquipTreasureUpHeroDid(_equipTreasureDid,_heroDid)
|
|
|
|
|
if this.allTreasures[_equipTreasureDid] then
|
|
|
|
|
this.allTreasures[_equipTreasureDid].upHeroDid=_heroDid
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--更新英雄主动技能
|
|
|
|
|
function this.UpdateSkillIdList(heroData)
|
|
|
|
|
local skillIdList = {}
|
|
|
|
|
--主动技
|
|
|
|
|
if heroData.heroConfig.OpenSkillRules then
|
|
|
|
|
for i = 1, #heroData.heroConfig.OpenSkillRules do
|
|
|
|
|
if heroData.heroConfig.OpenSkillRules[i][1] == heroData.star then
|
|
|
|
|
local heroSkill = {}
|
|
|
|
|
heroSkill.skillId = heroData.heroConfig.OpenSkillRules[i][2]
|
|
|
|
|
heroSkill.skillConfig = skillConfig[heroSkill.skillId]
|
|
|
|
|
table.insert(skillIdList, heroSkill)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return skillIdList
|
|
|
|
|
end
|
|
|
|
|
--更新英雄被动技能
|
|
|
|
|
function this.UpdatePassiveHeroSkill(heroData)
|
|
|
|
|
local passiveSkillList = {} --被动技
|
|
|
|
|
local OpenPassiveSkillRules = heroData.star == this.awakeNextStarIndex and heroData.heroConfig.Awaken or heroData.heroConfig.OpenPassiveSkillRules
|
|
|
|
|
if OpenPassiveSkillRules then
|
|
|
|
|
for i = 1, #OpenPassiveSkillRules do
|
|
|
|
|
if OpenPassiveSkillRules[i][1] == 1 then --突破
|
|
|
|
|
if heroData.breakId >= OpenPassiveSkillRules[i][2] then
|
|
|
|
|
local heroSkill = {}
|
|
|
|
|
heroSkill.skillId = OpenPassiveSkillRules[i][3]
|
|
|
|
|
heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId]
|
|
|
|
|
table.insert(passiveSkillList, heroSkill)
|
|
|
|
|
end
|
|
|
|
|
else --升星
|
|
|
|
|
if heroData.upStarId >= OpenPassiveSkillRules[i][2] then
|
|
|
|
|
local heroSkill = {}
|
|
|
|
|
heroSkill.skillId = OpenPassiveSkillRules[i][3]
|
|
|
|
|
heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId]
|
|
|
|
|
table.insert(passiveSkillList, heroSkill)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return passiveSkillList
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.SetHeroFormationList(heroDid,teamId,isAddOrDel)
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
2021-05-18 11:44:17 +08:00
|
|
|
|
function this.GetSingleCanUseHeroData(heroDid)
|
|
|
|
|
if not this.canUseHeroDatas then
|
|
|
|
|
this.GetCanUseHeroDatas()
|
|
|
|
|
end
|
|
|
|
|
if this.canUseHeroDatas[heroDid] then
|
|
|
|
|
return this.canUseHeroDatas[heroDid]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-05-15 18:25:45 +08:00
|
|
|
|
function this.GetSingleHeroData(heroDid)
|
|
|
|
|
if this.heroDataLists[heroDid] then
|
|
|
|
|
return this.heroDataLists[heroDid]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetCanUseHeroDatas()
|
|
|
|
|
if not this.canUseHeroDatas then
|
|
|
|
|
this.canUseHeroDatas = {}
|
|
|
|
|
end
|
|
|
|
|
for k,v in pairs(this.heroDataLists) do
|
|
|
|
|
if PlayerManager.GetHeroDataByStar(0,v.id) and not this.canUseHeroDatas[v.dynamicId] then
|
|
|
|
|
this.canUseHeroDatas[v.dynamicId] = v
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-05-14 19:11:40 +08:00
|
|
|
|
function this.GetHeroDataByProperty(_proId, limitLevel)
|
2021-05-15 18:25:45 +08:00
|
|
|
|
this.GetCanUseHeroDatas()
|
2021-05-14 19:11:40 +08:00
|
|
|
|
local heros = {}
|
|
|
|
|
local index = 1
|
2021-05-15 18:25:45 +08:00
|
|
|
|
if this.canUseHeroDatas then
|
|
|
|
|
for i, v in pairs(this.canUseHeroDatas) do
|
|
|
|
|
if v.property == _proId or _proId == 0 then
|
|
|
|
|
if v.lv >= limitLevel then
|
|
|
|
|
heros[index] = v
|
|
|
|
|
heros[index].exist = 1
|
|
|
|
|
index = index + 1
|
|
|
|
|
end
|
2021-05-14 19:11:40 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return heros
|
|
|
|
|
end
|
|
|
|
|
|
2021-05-15 18:25:45 +08:00
|
|
|
|
function this.GetHeroDataByProperty1(_proId, limitLevel,_heros)
|
|
|
|
|
local index = 0
|
|
|
|
|
for i, v in pairs(this.heroDataLists) do
|
|
|
|
|
local isExist = false
|
|
|
|
|
for j, k in pairs(this.canUseHeroDatas) do
|
|
|
|
|
if (v.property == _proId or _proId == 0) and k.id == v.id then
|
|
|
|
|
isExist = true
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if not isExist then
|
2021-05-18 11:44:17 +08:00
|
|
|
|
index = #_heros + 1
|
|
|
|
|
_heros[index] = v
|
|
|
|
|
_heros[index].exist = 0
|
2021-05-15 18:25:45 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2021-05-18 11:44:17 +08:00
|
|
|
|
return _heros
|
2021-05-15 18:25:45 +08:00
|
|
|
|
end
|
2021-05-18 11:44:17 +08:00
|
|
|
|
|
|
|
|
|
-- 所有妖灵师的血量数据
|
|
|
|
|
this.allHeroBlood = {}
|
|
|
|
|
function this.InitHeroHp(heroData)
|
|
|
|
|
if not this.allHeroBlood then
|
|
|
|
|
this.allHeroBlood = {}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local allEquipAddProVal= HeroManager.CalculateWarAllProVal(heroData.dynamicId)
|
|
|
|
|
local maxHp = allEquipAddProVal[3]
|
|
|
|
|
local hp = heroData.hp / 10000
|
|
|
|
|
local data = {}
|
|
|
|
|
data.percentHp = hp
|
|
|
|
|
data.curHp = math.ceil(hp * maxHp)
|
|
|
|
|
data.dynamicId = heroData.dynamicId
|
|
|
|
|
this.allHeroBlood[heroData.dynamicId] = data
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 换人后刷新队伍血量
|
|
|
|
|
function this.RefreshTeamInfo()
|
|
|
|
|
Log("换人后刷新队伍血量")
|
|
|
|
|
local mapTeam = {}
|
|
|
|
|
local curTeam = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_ENDLESS_MAP)
|
|
|
|
|
for i = 1, #curTeam.teamHeroInfos do
|
|
|
|
|
local roleData = curTeam.teamHeroInfos[i]
|
|
|
|
|
local allProp = HeroManager.CalculateWarAllProVal(roleData.heroId)
|
|
|
|
|
allProp[2] = this.allHeroBlood[roleData.heroId].curHp
|
|
|
|
|
mapTeam[i] = {
|
|
|
|
|
heroId = roleData.heroId,
|
|
|
|
|
allProVal = allProp,
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return mapTeam
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 无尽副本中得到某一个妖灵师的血量值, 传入动态ID
|
|
|
|
|
function this.GetHeroLeftBlood(heroId)
|
|
|
|
|
if CarbonManager.difficulty ~= CARBON_TYPE.ENDLESS then Log(Language[11224]) return end
|
|
|
|
|
if this.allHeroBlood[heroId] then
|
|
|
|
|
return this.allHeroBlood[heroId].curHp
|
|
|
|
|
else
|
|
|
|
|
Log("神将血量值不存在,默认是满血")
|
|
|
|
|
local allProp = HeroManager.CalculateWarAllProVal(heroId)
|
|
|
|
|
return allProp[3]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--编队界面有死亡猎妖师重组编队数据
|
|
|
|
|
function this.RoleListFormationNewMapTeam()
|
|
|
|
|
local newMapTeam = {} -- 地图中的编队数据
|
|
|
|
|
local curTeam = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_ENDLESS_MAP)
|
|
|
|
|
-- 成员数据
|
|
|
|
|
if curTeam.teamHeroInfos and #curTeam.teamHeroInfos > 0 then
|
|
|
|
|
for i = 1, #curTeam.teamHeroInfos do
|
|
|
|
|
local roleData = curTeam.teamHeroInfos[i]
|
|
|
|
|
local curRoleHp = 0
|
|
|
|
|
if this.allHeroBlood[roleData.heroId] then
|
|
|
|
|
curRoleHp = this.allHeroBlood[roleData.heroId].curHp
|
|
|
|
|
else
|
|
|
|
|
local allProp = HeroManager.CalculateWarAllProVal(roleData.heroId)
|
|
|
|
|
curRoleHp = allProp[3]
|
|
|
|
|
end
|
|
|
|
|
if curRoleHp > 0 then
|
|
|
|
|
local info = {}
|
|
|
|
|
info.position = #newMapTeam+1--curTeam.teamHeroInfos[i].position
|
|
|
|
|
info.heroId = roleData.heroId
|
|
|
|
|
table.insert(newMapTeam,info)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
FormationManager.RefreshFormation(FormationTypeDef.FORMATION_ENDLESS_MAP, newMapTeam, curTeam.teamPokemonInfos)
|
|
|
|
|
return newMapTeam
|
|
|
|
|
end
|
|
|
|
|
-- 角色战斗失败,删除相应的地图队伍
|
|
|
|
|
function this.DeleteMapTeam()
|
|
|
|
|
for i = 1, #MapManager.formationList do
|
|
|
|
|
MapManager.formationList[i].allProVal[2] = 0
|
|
|
|
|
local heroId = MapManager.formationList[i].heroId
|
|
|
|
|
this.allHeroBlood[heroId].curHp = 0
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 是否所有都死翘翘
|
|
|
|
|
function this.IsAllDead()
|
|
|
|
|
for i, v in pairs(this.allHeroBlood) do
|
|
|
|
|
if v.curHp > 0 then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return true
|
2021-05-15 18:25:45 +08:00
|
|
|
|
end
|
2021-05-14 19:11:40 +08:00
|
|
|
|
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
2020-06-23 18:36:24 +08:00
|
|
|
|
return this
|