2020-08-25 15:46:38 +08:00
|
|
|
|
MonsterCampManager = {};
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local this = MonsterCampManager
|
|
|
|
|
local monsterCampConfig = ConfigManager.GetConfig(ConfigName.FloodConfig)
|
|
|
|
|
local monsterGroupConfig = ConfigManager.GetConfig(ConfigName.MonsterGroup)
|
|
|
|
|
local monsterConfig = ConfigManager.GetConfig(ConfigName.MonsterConfig)
|
|
|
|
|
local monterViewConfig = ConfigManager.GetConfig(ConfigName.MonsterViewConfig)
|
|
|
|
|
local heroViewConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
|
|
|
|
local resConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
|
2020-12-14 09:54:50 +08:00
|
|
|
|
local CampTowerConfig = ConfigManager.GetConfig(ConfigName.CampTowerConfig)
|
2020-12-22 20:33:35 +08:00
|
|
|
|
local campTowerSetting = ConfigManager.GetConfig(ConfigName.CampTowerSetting)
|
2021-01-04 11:39:58 +08:00
|
|
|
|
local gameSetting = ConfigManager.GetConfig(ConfigName.GameSetting)
|
2020-12-14 09:54:50 +08:00
|
|
|
|
--四灵试炼数据
|
|
|
|
|
this.fourMonsterData = {}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
function this.Initialize()
|
|
|
|
|
this.monsterWave = 0 -- 当前妖兽波次
|
|
|
|
|
this.m_Jump = false -- 跳过战斗设置
|
2020-12-21 09:51:08 +08:00
|
|
|
|
----------------------------------------------------------------------四灵试炼------------------------------------------------------------------
|
2020-12-14 09:54:50 +08:00
|
|
|
|
local config = {}
|
|
|
|
|
for i = 1 ,4 do
|
|
|
|
|
this.fourMonsterData[i] = {}
|
2020-12-22 20:33:35 +08:00
|
|
|
|
this.fourMonsterData[i].freeTimeId = campTowerSetting[1].FlashTimesPrice[i][1]
|
|
|
|
|
this.fourMonsterData[i].buyTimeId = campTowerSetting[1].FlashTimesPrice[i][2]
|
|
|
|
|
this.fourMonsterData[i].teamId = campTowerSetting[1].Formation[i]
|
2020-12-21 09:51:08 +08:00
|
|
|
|
this.fourMonsterData[i].monsterWave = 0
|
|
|
|
|
--0 未开 1已开
|
2020-12-22 20:33:35 +08:00
|
|
|
|
this.fourMonsterData[i].openState = 1
|
2020-12-21 09:51:08 +08:00
|
|
|
|
this.fourMonsterData[i].freeTime = 0
|
|
|
|
|
this.fourMonsterData[i].buyTime = 0
|
2020-12-22 20:33:35 +08:00
|
|
|
|
this.fourMonsterData[i].canFightTime = 10
|
2020-12-21 09:51:08 +08:00
|
|
|
|
this.fourMonsterData[i].fourElementType = i
|
2020-12-14 09:54:50 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.InitFourMonsterData(msg)
|
2020-12-21 09:51:08 +08:00
|
|
|
|
for i = 1 , #msg.info do
|
|
|
|
|
LogGreen("type:"..msg.info[i].type.." currentFloor:"..msg.info[i].currentFloor.." msg.info[i].remainTimes:"..msg.info[i].remainTimes.." overTime:"..msg.info[i].overTime)
|
|
|
|
|
local index = msg.info[i].type
|
|
|
|
|
this.fourMonsterData[index].monsterWave = msg.info[i].currentFloor
|
|
|
|
|
this.fourMonsterData[index].canFightTime = msg.info[i].remainTimes
|
|
|
|
|
this.fourMonsterData[index].openState = msg.info[i].overTime
|
2020-12-14 09:54:50 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--设置扫荡剩余次数
|
|
|
|
|
function this.GetTimeTip(campId)
|
2020-12-22 20:33:35 +08:00
|
|
|
|
-- LogBlue("购买总次数:"..PrivilegeManager.GetPrivilegeNumber(this.fourMonsterData[campId].buyTimeId))
|
|
|
|
|
-- LogBlue("购买使用的次数:"..PrivilegeManager.GetPrivilegeUsedTimes(this.fourMonsterData[campId].buyTimeId))
|
|
|
|
|
-- LogBlue("免费总次数:"..PrivilegeManager.GetPrivilegeNumber(this.fourMonsterData[campId].freeTimeId))
|
|
|
|
|
-- LogBlue("免费使用次数:"..PrivilegeManager.GetPrivilegeUsedTimes(this.fourMonsterData[campId].freeTimeId))
|
2020-12-14 09:54:50 +08:00
|
|
|
|
this.fourMonsterData[campId].buyTime = PrivilegeManager.GetPrivilegeRemainValue(this.fourMonsterData[campId].buyTimeId)
|
2020-12-22 20:33:35 +08:00
|
|
|
|
--LogBlue("购买剩余次数:"..this.fourMonsterData[campId].buyTime)
|
2020-12-14 09:54:50 +08:00
|
|
|
|
this.fourMonsterData[campId].freeTime= PrivilegeManager.GetPrivilegeRemainValue(this.fourMonsterData[campId].freeTimeId) --免费次数
|
2020-12-22 20:33:35 +08:00
|
|
|
|
--LogBlue("免费剩余次数:"..this.fourMonsterData[campId].buyTime)
|
2020-12-14 09:54:50 +08:00
|
|
|
|
return this.fourMonsterData[campId].freeTime,this.fourMonsterData[campId].buyTime
|
|
|
|
|
end
|
|
|
|
|
|
2020-12-21 20:24:36 +08:00
|
|
|
|
function this.GetCost(campId)
|
|
|
|
|
local buyTimeId = this.fourMonsterData[campId].buyTimeId
|
|
|
|
|
local storeData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.StoreConfig, "StoreId", 7, "Limit", buyTimeId)
|
|
|
|
|
--商店表数据
|
|
|
|
|
local buyTimes = (PrivilegeManager.GetPrivilegeUsedTimes(buyTimeId) + 1) > PrivilegeManager.GetPrivilegeNumber(buyTimeId)
|
|
|
|
|
and PrivilegeManager.GetPrivilegeNumber(buyTimeId) or (PrivilegeManager.GetPrivilegeUsedTimes(buyTimeId) + 1)
|
|
|
|
|
return storeData.Id, storeData.Cost[1][1],storeData.Cost[2][buyTimes]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
2020-12-14 09:54:50 +08:00
|
|
|
|
--获取当前通过的总层数
|
|
|
|
|
function this.GetFourElementTotalWave()
|
|
|
|
|
local waves = 0
|
|
|
|
|
for k,v in pairs(this.fourMonsterData) do
|
2020-12-21 09:51:08 +08:00
|
|
|
|
waves = waves + v.monsterWave
|
2020-12-14 09:54:50 +08:00
|
|
|
|
end
|
|
|
|
|
return waves
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-12-21 09:51:08 +08:00
|
|
|
|
function this.GetCurFourElementMonsterInfo(index)
|
|
|
|
|
return this.fourMonsterData[index]
|
|
|
|
|
end
|
2020-12-22 20:33:35 +08:00
|
|
|
|
--得到从第1层到当前层的数据
|
2020-12-21 09:51:08 +08:00
|
|
|
|
function this.GetFourElementMonstersInfo(curType,curWave)
|
|
|
|
|
local monsterInfo = {}
|
|
|
|
|
local data = ConfigManager.GetConfigDataByDoubleKey(ConfigName.CampTowerConfig,"CampId",curType,"FloorId",curWave)
|
|
|
|
|
for i = 1, curWave + data.UpLimitWave do
|
|
|
|
|
local tempData = this.GetFourElementMonsterInfoByWave(curType,i)
|
|
|
|
|
if tempData then
|
|
|
|
|
table.insert(monsterInfo,tempData)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return monsterInfo
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetFourElementMonsterInfoByWave(curType,wave)
|
|
|
|
|
local tempConfig = ConfigManager.GetConfigDataByDoubleKey(ConfigName.CampTowerConfig,"CampId",curType,"FloorId",wave)
|
|
|
|
|
if not tempConfig then
|
|
|
|
|
return nil
|
|
|
|
|
end
|
|
|
|
|
local data = {}
|
2020-12-21 20:24:36 +08:00
|
|
|
|
data.id = tempConfig.Id
|
2020-12-21 09:51:08 +08:00
|
|
|
|
data.wave = tempConfig.FloorId
|
|
|
|
|
--战力
|
|
|
|
|
data.power = tempConfig.Force
|
|
|
|
|
|
|
|
|
|
data.firstReward = {}
|
|
|
|
|
--首通奖励
|
|
|
|
|
if tempConfig.FirstReward and #tempConfig.FirstReward > 0 then
|
|
|
|
|
for i = 1, #tempConfig.FirstReward do
|
|
|
|
|
table.insert(data.firstReward,{id = tempConfig.FirstReward[i][1],num = tempConfig.FirstReward[i][2]})
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
data.commonReward = {}
|
|
|
|
|
--首通奖励
|
|
|
|
|
if tempConfig.CommonReward and #tempConfig.CommonReward > 0 then
|
|
|
|
|
for i = 1, #tempConfig.CommonReward do
|
|
|
|
|
table.insert(data.commonReward,{id = tempConfig.CommonReward[i][1],num = tempConfig.CommonReward[i][2]})
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local monsterGroupId = tempConfig.Monster
|
|
|
|
|
-- 默认显示第一只怪
|
|
|
|
|
local id = monsterGroupConfig[monsterGroupId].Contents[1][1]
|
2020-12-22 20:33:35 +08:00
|
|
|
|
data.monster = monsterGroupConfig[monsterGroupId].Contents[1]
|
2020-12-21 09:51:08 +08:00
|
|
|
|
data.monsterConfig = monsterConfig[id]
|
|
|
|
|
data.herodata = this.SetSingleMonster(data.monsterConfig.MonsterId)
|
|
|
|
|
return data
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.SetSingleMonster(id)
|
|
|
|
|
local herodata = {}
|
|
|
|
|
local _configData = ConfigManager.GetConfigData(ConfigName.HeroConfig,id)
|
2021-01-04 11:39:58 +08:00
|
|
|
|
herodata.heroViewConfig = _configData
|
2020-12-21 09:51:08 +08:00
|
|
|
|
herodata.live = GetResourcePath(_configData.Live)
|
|
|
|
|
herodata.painting = GetResourcePath(_configData.Painting)
|
|
|
|
|
herodata.icon = GetResourcePath(_configData.Icon)
|
|
|
|
|
herodata.scale = _configData.Scale
|
|
|
|
|
herodata.position = _configData.Position
|
|
|
|
|
herodata.profession = _configData.Profession
|
|
|
|
|
herodata.ProfessionResourceId = _configData.ProfessionResourceId
|
|
|
|
|
if GetJobSpriteStrByJobNum(_configData.Profession) then
|
|
|
|
|
herodata.professionIcon = GetJobSpriteStrByJobNum(_configData.Profession)
|
|
|
|
|
else
|
|
|
|
|
herodata.professionIcon = GetJobSpriteStrByJobNum(1)
|
|
|
|
|
end
|
|
|
|
|
herodata.name = _configData.ReadingName
|
|
|
|
|
herodata.property = _configData.PropertyName
|
|
|
|
|
return herodata
|
|
|
|
|
end
|
|
|
|
|
|
2020-12-21 20:24:36 +08:00
|
|
|
|
function this.GetMonsterTeamInfo(monsterGroupId)
|
|
|
|
|
local bossTeamsInfo = {}
|
|
|
|
|
local bossIds = monsterGroupConfig[monsterGroupId].Contents[1]
|
|
|
|
|
for i = 1, #bossIds do
|
|
|
|
|
local monsterData = {}
|
|
|
|
|
if bossIds[i] > 0 then
|
|
|
|
|
monsterData.monsterConfig = monsterConfig[bossIds[i]]
|
|
|
|
|
monsterData.herodata = this.SetSingleMonster(monsterData.monsterConfig.MonsterId)
|
|
|
|
|
end
|
|
|
|
|
table.insert(bossTeamsInfo,monsterData)
|
2020-12-21 09:51:08 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-12-21 20:24:36 +08:00
|
|
|
|
|
|
|
|
|
--开始战斗
|
|
|
|
|
function this.ExecuteFightBattle(id,type,func,curType)
|
2021-02-03 14:29:22 +08:00
|
|
|
|
local fightId = ConfigManager.GetConfigDataByDoubleKey(ConfigName.CampTowerConfig,"FloorId",id,"CampId",curType).Id
|
|
|
|
|
NetManager.FourChallengeDoRequest(fightId,type,function(msg)
|
2021-02-03 18:40:26 +08:00
|
|
|
|
if type == 0 then
|
2020-12-21 20:24:36 +08:00
|
|
|
|
local fightData = BattleManager.GetBattleServerData(msg,0)
|
|
|
|
|
UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.DAILY_CHALLENGE,function(result)
|
|
|
|
|
if func then
|
|
|
|
|
func()
|
|
|
|
|
end
|
|
|
|
|
if result.result == 0 then
|
|
|
|
|
if this.fourMonsterData[curType].openState ~= 0 then
|
|
|
|
|
UIManager.OpenPanel(UIName.FourElementMonsterCampPanel,curType)
|
|
|
|
|
else
|
|
|
|
|
UIManager.OpenPanel(UIName.MonsterCampMainPanel)
|
|
|
|
|
end
|
|
|
|
|
elseif result.result == 1 then
|
|
|
|
|
this.fourMonsterData[curType].wave = id
|
|
|
|
|
this.fourMonsterData[curType].canFightTime = this.fourMonsterData[curType].canFightTime - 1
|
|
|
|
|
if this.fourMonsterData[curType].openState ~= 0 then
|
|
|
|
|
UIManager.OpenPanel(UIName.FourElementMonsterCampPanel,curType)
|
|
|
|
|
else
|
|
|
|
|
UIManager.OpenPanel(UIName.MonsterCampMainPanel)
|
|
|
|
|
end
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
else
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
|
|
|
|
|
if func then
|
|
|
|
|
func()
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
2021-01-04 11:39:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
------------------------------四灵试炼 助战---------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--创建一个英雄信息
|
|
|
|
|
function this.UpdateHeroDatas(_msgHeroData)
|
|
|
|
|
local heroData = {}
|
|
|
|
|
heroData.soulPrintList={}
|
|
|
|
|
heroData.heroBackData=_msgHeroData
|
|
|
|
|
heroData.dynamicId = _msgHeroData.id
|
|
|
|
|
local _id = _msgHeroData.heroId
|
|
|
|
|
heroData.id = _id
|
|
|
|
|
heroData.star = _msgHeroData.star
|
|
|
|
|
heroData.lv = _msgHeroData.level--30
|
|
|
|
|
heroData.breakId=_msgHeroData.breakId
|
|
|
|
|
heroData.upStarId=_msgHeroData.starBreakId
|
|
|
|
|
heroData.createTime=_msgHeroData.createTimelocal
|
|
|
|
|
heroData.lockState = _msgHeroData.lockState
|
|
|
|
|
heroData.createtype = _msgHeroData.createtype
|
|
|
|
|
local _configData = heroViewConfig[_id]
|
|
|
|
|
|
|
|
|
|
heroData.skinId = _msgHeroData.skinId or 0
|
|
|
|
|
if heroData.skinId == 0 then
|
|
|
|
|
heroData.skinConfig = _configData
|
|
|
|
|
heroData.live = GetResourcePath(_configData.Live)
|
|
|
|
|
heroData.painting = GetResourcePath(_configData.Painting)
|
|
|
|
|
heroData.icon = GetResourcePath(_configData.Icon)
|
|
|
|
|
heroData.scale = _configData.Scale
|
|
|
|
|
heroData.position = _configData.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.heroViewConfig=heroViewConfig[_id]
|
|
|
|
|
heroData.maxStar=_configData.MaxRank
|
|
|
|
|
--Log(heroData.heroViewConfig.ReadingName.." _msgHeroData.starBreakId ".._msgHeroData.starBreakId)
|
|
|
|
|
local actionPowerRormula= gameSetting[1].ActionPowerRormula
|
|
|
|
|
heroData.actionPower=heroData.heroViewConfig.ActionPower+math.floor(((actionPowerRormula[1] * math.pow(heroData.lv, 3) + actionPowerRormula[2] * math.pow(heroData.lv, 2) + actionPowerRormula[3] * heroData.lv + actionPowerRormula[4])))--_msgHeroData.actionPower
|
|
|
|
|
heroData.equipIdList=_msgHeroData.equipIdList
|
|
|
|
|
heroData.jewels=_msgHeroData.jewels
|
|
|
|
|
|
|
|
|
|
heroData.talismanList = _msgHeroData.especialEquipLevel --法宝等级
|
|
|
|
|
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.skillIdList={}--主动技
|
|
|
|
|
HeroManager.UpdateSkillIdList(heroData)
|
|
|
|
|
heroData.passiveSkillList = {}--被动技
|
|
|
|
|
HeroManager.UpdatePassiveHeroSkill(heroData)
|
|
|
|
|
heroData.hp = _configData.Hp
|
|
|
|
|
heroData.attack = _configData.Attack
|
|
|
|
|
heroData.pDef = _configData.PhysicalDefence
|
|
|
|
|
heroData.mDef = _configData.MagicDefence
|
|
|
|
|
heroData.speed = _configData.Speed
|
|
|
|
|
heroData.live = GetResourcePath(_configData.Live)
|
|
|
|
|
heroData.profession = _configData.Profession
|
|
|
|
|
heroData.ProfessionResourceId= _configData.ProfessionResourceId
|
|
|
|
|
if GetJobSpriteStrByJobNum(_configData.Profession) then
|
|
|
|
|
heroData.professionIcon = GetJobSpriteStrByJobNum(_configData.Profession)
|
|
|
|
|
else
|
|
|
|
|
heroData.professionIcon = GetJobSpriteStrByJobNum(1)
|
|
|
|
|
end
|
|
|
|
|
heroData.name = _configData.ReadingName
|
|
|
|
|
heroData.property = _configData.PropertyName
|
|
|
|
|
|
|
|
|
|
this.SetEquipUpHeroDid(heroData.equipIdList,heroData.dynamicId)
|
|
|
|
|
this.SetEquipTreasureUpHeroDid(heroData.jewels,heroData.dynamicId)
|
|
|
|
|
this.SetTalismanLv(heroData.dynamicId,heroData.talismanList)
|
|
|
|
|
heroData.warPower = HeroManager.CalculateHeroAllProValList(1, heroData, false)[HeroProType.WarPower]
|
|
|
|
|
return heroData
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-----获得好友助战信息列表
|
|
|
|
|
this.friendHelpHeros = {}
|
|
|
|
|
function this.GetFriendHelpHeros(trailType)
|
|
|
|
|
this.friendHelpHeros = {}
|
|
|
|
|
|
|
|
|
|
local x = function(msg)
|
|
|
|
|
for k,v in ipairs(msg.helpHeros) do
|
|
|
|
|
if not this.friendHelpHeros[v.trailType] then
|
|
|
|
|
this.friendHelpHeros[v.trailType] = {}
|
|
|
|
|
end
|
|
|
|
|
local tempdata = {}
|
|
|
|
|
tempdata.player = v
|
|
|
|
|
tempdata.hero = this.UpdateHeroDatas(v.hero)
|
|
|
|
|
table.insert(this.friendHelpHeros[v.trailType],tempdata)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--发消息获取信息 然后调用回调函数x
|
2021-02-03 18:40:26 +08:00
|
|
|
|
if trailType and trailType > 0 then
|
|
|
|
|
NetManager.HelpFightListRequest(trailType,x)
|
|
|
|
|
elseif not trailType then
|
|
|
|
|
for i = 1, 4 do
|
|
|
|
|
NetManager.HelpFightListRequest(i,x)
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-01-04 11:39:58 +08:00
|
|
|
|
if trailType and this.friendHelpHeros[trailType] then
|
|
|
|
|
return this.friendHelpHeros[trailType]
|
|
|
|
|
end
|
|
|
|
|
return {}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--设置好友帮助我的英雄 以试炼类型为键
|
|
|
|
|
this.friendHelpHero = {}
|
|
|
|
|
function this.SetFriendHelpHero(msg,trailType)
|
|
|
|
|
if not trailType then
|
|
|
|
|
this.friendHelpHero = {}
|
|
|
|
|
for k,v in ipairs(msg.helpHeros) do
|
|
|
|
|
if not this.friendHelpHero[v.trailType] then
|
|
|
|
|
this.friendHelpHero[v.trailType] = {}
|
|
|
|
|
end
|
|
|
|
|
this.friendHelpHero[v.trailType].player = v
|
|
|
|
|
this.friendHelpHero[v.trailType].hero = this.UpdateHeroDatas(v.hero)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if not this.friendHelpHero then
|
|
|
|
|
this.friendHelpHero = {}
|
|
|
|
|
end
|
|
|
|
|
if not this.friendHelpHero[trailType] then
|
|
|
|
|
this.friendHelpHero[trailType] = {}
|
|
|
|
|
end
|
|
|
|
|
if msg then
|
|
|
|
|
this.friendHelpHero[trailType].player = msg
|
|
|
|
|
this.friendHelpHero[trailType].hero = this.UpdateHeroDatas(msg.hero)
|
|
|
|
|
else
|
|
|
|
|
this.friendHelpHero[trailType] = nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--获取当前试炼我选取的好友的助战
|
|
|
|
|
function this.GetFriendHelpHero(trailType)
|
|
|
|
|
if this.friendHelpHero[trailType] then
|
|
|
|
|
return this.friendHelpHero[trailType]
|
|
|
|
|
end
|
|
|
|
|
return nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--设置助战
|
|
|
|
|
this.myHelpHeroData = {}
|
|
|
|
|
function this.SetMyHelpHeroData(trail,_data)
|
|
|
|
|
if not trail then
|
|
|
|
|
this.myHelpHeroData = {}
|
|
|
|
|
local x = function(msg)
|
|
|
|
|
for k,v in ipairs(msg.ids) do
|
|
|
|
|
if not this.myHelpHeroData[v.trailType] then
|
|
|
|
|
this.myHelpHeroData[v.trailType] = {}
|
|
|
|
|
end
|
|
|
|
|
this.myHelpHeroData[v.trailType] = HeroManager.GetSingleHeroData(v.hero.id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--发协议获取 调用x
|
|
|
|
|
else
|
|
|
|
|
if not this.myHelpHeroData then
|
|
|
|
|
this.myHelpHeroData = {}
|
|
|
|
|
end
|
|
|
|
|
if not this.myHelpHeroData[trail] then
|
|
|
|
|
this.myHelpHeroData[trail] = {}
|
|
|
|
|
end
|
|
|
|
|
this.myHelpHeroData[trail] = _data
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--获取我的助战
|
|
|
|
|
function this.GetFriendHelpHero(trailType)
|
|
|
|
|
if this.myHelpHeroData[trailType] then
|
|
|
|
|
return this.myHelpHeroData[trailType]
|
|
|
|
|
end
|
|
|
|
|
return nil
|
|
|
|
|
end
|
|
|
|
|
------------------------------四灵试炼 红点---------------------------------------
|
|
|
|
|
function this.CheckTrailRedPoint()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.CheckHelpFightRedPoint()
|
|
|
|
|
|
2021-01-07 19:24:04 +08:00
|
|
|
|
this.getRewardWave = {}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.SetRewardWave(waves)
|
|
|
|
|
if not this.getRewardWave then
|
|
|
|
|
this.getRewardWave = {}
|
|
|
|
|
end
|
|
|
|
|
for i = 1 ,#waves do
|
|
|
|
|
if not this.getRewardWave[waves[i]] then
|
|
|
|
|
this.getRewardWave[waves[i]] = waves[i]
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-01-04 11:39:58 +08:00
|
|
|
|
end
|
2020-12-21 09:51:08 +08:00
|
|
|
|
----------------------------------------------------------------------四灵试炼------------------------------------------------------------------
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 返回5个大虾的信息, 显示怪物的第一个,
|
|
|
|
|
function this.GetNextWaveMonsterInfo()
|
|
|
|
|
local curWave = this.monsterWave
|
|
|
|
|
local monsterInfo = {}
|
|
|
|
|
--遇到表格的结尾处,则停止
|
|
|
|
|
for i = curWave + 1, curWave + 5 do
|
|
|
|
|
if not monsterCampConfig[i] then break end
|
|
|
|
|
local data = {}
|
|
|
|
|
data.rewardShow = monsterCampConfig[i].RewardShow
|
|
|
|
|
local monsterGroupId = monsterCampConfig[i].Monster
|
|
|
|
|
-- 默认显示第一只怪
|
|
|
|
|
local id = monsterGroupConfig[monsterGroupId].Contents[1][1]
|
|
|
|
|
local monsterId = monsterConfig[id].MonsterId
|
|
|
|
|
local resId = 0
|
|
|
|
|
if monsterId > 10000 then -- 这是人类
|
|
|
|
|
resId = heroViewConfig[monsterId].Icon
|
|
|
|
|
else -- 这是妖精
|
|
|
|
|
resId = monterViewConfig[monsterId].MonsterIcon
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local resPath = GetResourcePath(resId)
|
|
|
|
|
local icon = Util.LoadSprite(resPath)
|
|
|
|
|
data.icon = icon
|
|
|
|
|
data.name = resConfig[resId].Desc
|
|
|
|
|
monsterInfo[i] = data
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return monsterInfo
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 返回当前怪物阵容信息
|
|
|
|
|
function this.GetCurMonsterInfo()
|
|
|
|
|
local curWave = this.monsterWave
|
|
|
|
|
local monsterInfo = {}
|
|
|
|
|
local mainMonsterInfo = {}
|
|
|
|
|
local data = {}
|
|
|
|
|
data.icon = {}
|
|
|
|
|
data.level={}
|
|
|
|
|
data.rewardShow = monsterCampConfig[curWave].RewardShow
|
|
|
|
|
local monsterGroupId = monsterCampConfig[curWave].Monster
|
|
|
|
|
|
|
|
|
|
local ids = monsterGroupConfig[monsterGroupId].Contents
|
|
|
|
|
for i = 1, #ids do
|
|
|
|
|
for j = 1, #ids[i] do
|
|
|
|
|
-- 所有怪信息
|
|
|
|
|
local monsterId = monsterConfig[ids[i][j]].MonsterId
|
|
|
|
|
local resId = 0
|
|
|
|
|
if monsterId > 10000 then -- 这是人类
|
|
|
|
|
resId = heroViewConfig[monsterId].Icon
|
|
|
|
|
else -- 这是妖精
|
|
|
|
|
resId = monterViewConfig[monsterId].MonsterIcon
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local resPath = GetResourcePath(resId)
|
|
|
|
|
local icon = Util.LoadSprite(resPath)
|
|
|
|
|
data.icon[#data.icon + 1] = icon
|
|
|
|
|
data.level[j]= monsterConfig[ids[i][j]].Level
|
|
|
|
|
-- 主怪信息
|
|
|
|
|
if i == 1 and j == 1 then
|
|
|
|
|
mainMonsterInfo.name = resConfig[resId].Desc
|
|
|
|
|
mainMonsterInfo.live2dPath = resConfig[resId].Name
|
|
|
|
|
mainMonsterInfo.monsterId = monsterId
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
monsterInfo = data
|
|
|
|
|
return monsterInfo, mainMonsterInfo
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 消耗道具上限值
|
|
|
|
|
function this.GetMaxCostItem()
|
|
|
|
|
return PrivilegeManager.GetPrivilegeNumber(23)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 是否需要回复
|
|
|
|
|
function this.IsNeedSupply()
|
|
|
|
|
return BagManager.GetItemCountById(53) < this.GetMaxCostItem()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--返回当前的怪物组Id
|
|
|
|
|
function this.GetCurWaveMonsterGroupId()
|
|
|
|
|
return monsterCampConfig[this.monsterWave].Monster
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 通过怪物ID返回头像
|
|
|
|
|
function this.GetIconByMonsterId(monsterId)
|
|
|
|
|
local resId = 0
|
|
|
|
|
local level = 0
|
|
|
|
|
local icon
|
|
|
|
|
local liveId = monsterConfig[monsterId].MonsterId
|
|
|
|
|
if liveId > 10000 then -- 这是人类
|
|
|
|
|
resId = heroViewConfig[liveId].Icon
|
|
|
|
|
else -- 这是妖精
|
|
|
|
|
resId = monterViewConfig[liveId].MonsterIcon
|
|
|
|
|
end
|
|
|
|
|
level = monsterConfig[monsterId].Level
|
|
|
|
|
icon =Util.LoadSprite(GetResourcePath(resId))
|
|
|
|
|
return icon, level
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 获取表的上限值
|
|
|
|
|
function this.GetMaxNum()
|
|
|
|
|
local max = 0
|
|
|
|
|
for k, v in ConfigPairs(monsterCampConfig) do
|
|
|
|
|
max = max > k and max or k
|
|
|
|
|
end
|
|
|
|
|
return max
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 跳过战斗设置
|
|
|
|
|
function this.GetBattleJump()
|
2020-06-13 11:47:13 +08:00
|
|
|
|
return false
|
|
|
|
|
-- if not this.CheckBattleJump() then
|
|
|
|
|
-- return false
|
|
|
|
|
-- end
|
|
|
|
|
-- return this.m_Jump
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.SetBattleJump(state)
|
|
|
|
|
this.m_Jump = state
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.CheckBattleJump()
|
|
|
|
|
local isOpen = PrivilegeManager.GetPrivilegeOpenStatus(PRIVILEGE_TYPE.MonsterCampJump)
|
|
|
|
|
return isOpen
|
|
|
|
|
end
|
|
|
|
|
|
2021-01-07 19:24:04 +08:00
|
|
|
|
-- 0 已经领取,1 可领取,2不能领取·
|
|
|
|
|
function this.GetTrialRewardState(id)
|
2021-01-12 19:21:20 +08:00
|
|
|
|
if id < this.monsterWave then
|
2021-01-07 19:24:04 +08:00
|
|
|
|
if this.getRewardWave[id] and this.getRewardWave[id] > 0 then
|
|
|
|
|
return 0
|
|
|
|
|
else
|
|
|
|
|
return 1
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return 2
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function this.SetRewardData()
|
|
|
|
|
local dataList = {}
|
|
|
|
|
for k,v in ConfigPairs(ConfigManager.GetConfig(ConfigName.FloodConfig)) do
|
|
|
|
|
if v.SpecialReward and #v.SpecialReward > 0 then
|
|
|
|
|
local data = {}
|
|
|
|
|
data.Id = v.Id
|
|
|
|
|
data.info = string.format("通过心魔试炼第%s波",v.Id)
|
|
|
|
|
data.BoxReward = v.SpecialReward
|
|
|
|
|
data.state = this.GetTrialRewardState(v.Id)
|
|
|
|
|
table.insert(dataList,data)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return dataList
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
2020-06-23 18:36:24 +08:00
|
|
|
|
return this
|