diff --git a/Assets/LuaFramework/Scenes/Logo.unity b/Assets/LuaFramework/Scenes/Logo.unity index 1e2f0f9451..56cee70de6 100644 --- a/Assets/LuaFramework/Scenes/Logo.unity +++ b/Assets/LuaFramework/Scenes/Logo.unity @@ -323,3 +323,64 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1355492899 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 118256, guid: 99b0fede6f9ae7946b30748aa8bfc627, type: 3} + propertyPath: m_Name + value: UIRoot + objectReference: {fileID: 0} + - target: {fileID: 118256, guid: 99b0fede6f9ae7946b30748aa8bfc627, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4132084493212212, guid: 99b0fede6f9ae7946b30748aa8bfc627, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4132084493212212, guid: 99b0fede6f9ae7946b30748aa8bfc627, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4132084493212212, guid: 99b0fede6f9ae7946b30748aa8bfc627, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4132084493212212, guid: 99b0fede6f9ae7946b30748aa8bfc627, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4132084493212212, guid: 99b0fede6f9ae7946b30748aa8bfc627, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4132084493212212, guid: 99b0fede6f9ae7946b30748aa8bfc627, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4132084493212212, guid: 99b0fede6f9ae7946b30748aa8bfc627, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4132084493212212, guid: 99b0fede6f9ae7946b30748aa8bfc627, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 4132084493212212, guid: 99b0fede6f9ae7946b30748aa8bfc627, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4132084493212212, guid: 99b0fede6f9ae7946b30748aa8bfc627, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4132084493212212, guid: 99b0fede6f9ae7946b30748aa8bfc627, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 99b0fede6f9ae7946b30748aa8bfc627, type: 3} diff --git a/Assets/ManagedResources/Prefabs/UI/CompoundHero/CompoundHeroPanel.prefab b/Assets/ManagedResources/Prefabs/UI/CompoundHero/CompoundHeroPanel.prefab index 2862551f85..cdb5abc3a3 100644 --- a/Assets/ManagedResources/Prefabs/UI/CompoundHero/CompoundHeroPanel.prefab +++ b/Assets/ManagedResources/Prefabs/UI/CompoundHero/CompoundHeroPanel.prefab @@ -186,11 +186,11 @@ RectTransform: m_Father: {fileID: 3303532636229130391} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 910} - m_SizeDelta: {x: 1080, y: 100} - m_Pivot: {x: 0.5, y: 0.5} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 100} + m_Pivot: {x: 0.5, y: 1} --- !u!222 &1174201698 CanvasRenderer: m_ObjectHideFlags: 0 diff --git a/Assets/ManagedResources/Prefabs/UI/MonsterCamp/FourElementMonsterCampPanel.prefab b/Assets/ManagedResources/Prefabs/UI/MonsterCamp/FourElementMonsterCampPanel.prefab index 267189ed7c..af8610c0ba 100644 --- a/Assets/ManagedResources/Prefabs/UI/MonsterCamp/FourElementMonsterCampPanel.prefab +++ b/Assets/ManagedResources/Prefabs/UI/MonsterCamp/FourElementMonsterCampPanel.prefab @@ -37847,8 +37847,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 4, y: -139.84998} - m_SizeDelta: {x: 8, y: -381.15} + m_AnchoredPosition: {x: 4, y: -106.84} + m_SizeDelta: {x: 8, y: -258.84} m_Pivot: {x: 0.49999997, y: 1} --- !u!1 &4407161792127727149 GameObject: diff --git a/Assets/ManagedResources/Prefabs/UI/MonsterCamp/MonsterCampNewPanel.prefab b/Assets/ManagedResources/Prefabs/UI/MonsterCamp/MonsterCampNewPanel.prefab index 5743cfd609..9616fbff58 100644 --- a/Assets/ManagedResources/Prefabs/UI/MonsterCamp/MonsterCampNewPanel.prefab +++ b/Assets/ManagedResources/Prefabs/UI/MonsterCamp/MonsterCampNewPanel.prefab @@ -20380,7 +20380,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1553473826462271953} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: @@ -20391,7 +20391,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: -296, y: -101} + m_AnchoredPosition: {x: 90.80005, y: -136.1} m_SizeDelta: {x: 118.51, y: 39.66} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &3125372449007984917 @@ -20651,7 +20651,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 397, y: -74} + m_AnchoredPosition: {x: 397, y: -42} m_SizeDelta: {x: 213.2, y: 39.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &8636512230693676775 @@ -42066,7 +42066,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: -6} + m_AnchoredPosition: {x: 0, y: 26} m_SizeDelta: {x: 477.1, y: 256.8} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &4439071079444767798 @@ -42464,8 +42464,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.47334743} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0.27691, y: 20.71} - m_SizeDelta: {x: 154.01, y: 214.34} + m_AnchoredPosition: {x: 0.27691, y: 54.498383} + m_SizeDelta: {x: 154.01, y: 210.76323} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1164378876009827868 CanvasRenderer: @@ -42584,7 +42584,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0} - m_AnchoredPosition: {x: 214.23001, y: -9} + m_AnchoredPosition: {x: -172.57004, y: 90.100006} m_SizeDelta: {x: 372.44, y: 98.3} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &536547194854177452 @@ -43637,10 +43637,10 @@ RectTransform: m_Father: {fileID: 8479928411374727462} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 32} - m_SizeDelta: {x: 301.3, y: 298.5} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &2262106292759488903 CanvasRenderer: @@ -43872,7 +43872,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 24, y: -185} + m_AnchoredPosition: {x: 24, y: -153} m_SizeDelta: {x: 211.86, y: 74.17} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &4146579402217421203 @@ -45482,7 +45482,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: -250, y: -27} + m_AnchoredPosition: {x: 136.80005, y: -62.100006} m_SizeDelta: {x: 235, y: 101} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7451872374087037594 @@ -76818,7 +76818,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8933917794503559087} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: @@ -76829,7 +76829,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 1.4, y: -3} + m_AnchoredPosition: {x: 1.4, y: 29} m_SizeDelta: {x: 336.1, y: 329.75} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &4159403830736356184 @@ -78115,12 +78115,12 @@ PrefabInstance: - target: {fileID: 2535060995107670383, guid: e356d5948e4971f499cfe38db3551f59, type: 3} propertyPath: m_AnchoredPosition.x - value: 182 + value: 568.7999 objectReference: {fileID: 0} - target: {fileID: 2535060995107670383, guid: e356d5948e4971f499cfe38db3551f59, type: 3} propertyPath: m_AnchoredPosition.y - value: -153 + value: -188.1 objectReference: {fileID: 0} - target: {fileID: 2535060995107670383, guid: e356d5948e4971f499cfe38db3551f59, type: 3} diff --git a/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua b/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua index 88268e9f56..51f199ab61 100644 --- a/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua @@ -20,7 +20,7 @@ local EquipStrengthen = ConfigManager.GetConfig(ConfigName.EquipStrengthen) local EquipSignSetting = ConfigManager.GetConfig(ConfigName.EquipSignSetting) local EquipRankUp = ConfigManager.GetConfig(ConfigName.EquipRankUp) local heroDatas = {} -this.heroSortedDatas={}--排序后的英雄数据 +this.heroSortedDatas = {} --排序后的英雄数据 this.heroDataLists = {} this.heroLvEnd = {} --3星=60,4=200,5=250 星级对应等级上限 @@ -45,10 +45,10 @@ this.heroResolveLicence = {} --this.allHeroProVal = {}--团体加成 --this.specialProVal = {}--减乘 -this.awakeStarIndex = 10-- 前端写死觉醒星级标志 -this.awakeNextStarIndex = 11-- 前端写死觉醒星级标志 +this.awakeStarIndex = 10 -- 前端写死觉醒星级标志 +this.awakeNextStarIndex = 11 -- 前端写死觉醒星级标志 --存储英雄身上对应的星级 -local curAllStarBreakIdData = { +local curAllStarBreakIdData = { -- [1] = {[40]= 24}, -- [2] = {[40]= 22,[50]= 23} } @@ -67,7 +67,7 @@ function this.Initialize() } end this.SetAllStarBreakIdData() - + -- 初始化碎片和英雄的对应关系 this._ChipToHero = {} for id, data in ConfigPairs(heroConfig) do @@ -76,6 +76,7 @@ function this.Initialize() end end end + --初始化英雄数据 function this.InitHeroData(_msgHeroList) local hero_resolve_licence = string.split(ConfigManager.GetConfigData(ConfigName.SpecialConfig, 36).Value, "#") @@ -98,9 +99,9 @@ end function this.UpdateHeroDatas(_msgHeroData, isFindHandBook) local heroData = HeroData.new(_msgHeroData, isFindHandBook) heroData.soulPrintList = {} - heroData.godPrintList={} + heroData.godPrintList = {} --乘减属性集合 - heroData.MLSproList={} + heroData.MLSproList = {} heroData.heroBackData = _msgHeroData heroData.dynamicId = _msgHeroData.id @@ -111,14 +112,14 @@ function this.UpdateHeroDatas(_msgHeroData, isFindHandBook) heroData.breakId = _msgHeroData.breakId -- LogGreen("heroData.id:"..heroData.id.." _msgHeroData.starBreakId:".._msgHeroData.starBreakId) heroData.upStarId = _msgHeroData.starBreakId - heroData.skinId = _msgHeroData.skinId + heroData.skinId = _msgHeroData.skinId heroData.createTime = _msgHeroData.createTimelocal heroData.lockState = _msgHeroData.lockState heroData.createtype = _msgHeroData.createtype - heroData.changeId = _msgHeroData.changeId--置换id - heroData.changeProId= _msgHeroData.propertyId --英雄的阵营id + heroData.changeId = _msgHeroData.changeId --置换id + heroData.changeProId = _msgHeroData.propertyId --英雄的阵营id --LogError("changeproid=="..heroData.changeProId) - heroData.formationList = {}--所在编队list + heroData.formationList = {} --所在编队list --本地 or 援助 local _configData = heroConfig[_id] heroData.heroConfig = heroConfig[_id] @@ -136,22 +137,22 @@ function this.UpdateHeroDatas(_msgHeroData, isFindHandBook) --_msgHeroData.actionPower --英雄穿戴的装备 - -- LogPink("_msgHeroData.equipIdList "..#_msgHeroData.equipIdList..heroData.heroConfig.ReadingName) + -- LogPink("_msgHeroData.equipIdList "..#_msgHeroData.equipIdList..heroData.heroConfig.ReadingName) heroData.equipIdList = _msgHeroData.equipIdList heroData.jewels = _msgHeroData.jewels heroData.faxiang = _msgHeroData.faxiang - -- heroData.talismanList = _msgHeroData.especialEquipLevel --法宝等级 + -- heroData.talismanList = _msgHeroData.especialEquipLevel --法宝等级 heroData.baublesId = _msgHeroData.baublesId --法宝 heroData.sealIdList = _msgHeroData.sealIdList --紫府神印list --LogError("_msgHeroData.soulPos=="..#_msgHeroData.soulPos) - heroData.soulPrintList = this.SetSoulPrint(_msgHeroData.soulPos,heroData.dynamicId) - heroData.godPrintList = this.SetGodPrint(_msgHeroData.godSeals,heroData.dynamicId) - GiftManager.InitHeroGift(_msgHeroData.id,_msgHeroData.giftEquipIds) - heroData.giftIds=_msgHeroData.giftEquipIds + heroData.soulPrintList = this.SetSoulPrint(_msgHeroData.soulPos, heroData.dynamicId) + heroData.godPrintList = this.SetGodPrint(_msgHeroData.godSeals, heroData.dynamicId) + GiftManager.InitHeroGift(_msgHeroData.id, _msgHeroData.giftEquipIds) + heroData.giftIds = _msgHeroData.giftEquipIds --heroData.equipStrongList=this.GetEquipStrongData(_msgHeroData.equipStrong,_msgHeroData.equipAdvanceLv) --heroData.equipAdvanceLv =_msgHeroData.equipAdvanceLv heroData.skillIdList = {} - heroData.potential=this.SetPotentialData(_msgHeroData.potential,_msgHeroData.id) + heroData.potential = this.SetPotentialData(_msgHeroData.potential, _msgHeroData.id) --主动技 this.UpdateSkillIdList(heroData) heroData.passiveSkillList = {} @@ -170,7 +171,7 @@ function this.UpdateHeroDatas(_msgHeroData, isFindHandBook) heroData.scale = _configData.Scale heroData.position = _configData.Position else - heroData.skinConfig = ConfigManager.GetConfigDataByKey(ConfigName.HeroSkin,"Type",heroData.skinId) + 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) @@ -180,41 +181,41 @@ function this.UpdateHeroDatas(_msgHeroData, isFindHandBook) heroData.profession = _configData.Profession heroData.ProfessionResourceId = _configData.ProfessionResourceId if GetHeroPosStr(_configData.Profession) then - heroData.professionIcon = GetHeroPosStr(_configData.Profession)--GetJobSpriteStrByJobNum(_configData.Profession) + heroData.professionIcon = GetHeroPosStr(_configData.Profession) --GetJobSpriteStrByJobNum(_configData.Profession) else - heroData.professionIcon = GetHeroPosStr(1)--GetJobSpriteStrByJobNum(1) + heroData.professionIcon = GetHeroPosStr(1) --GetJobSpriteStrByJobNum(1) end heroData.name = GetLanguageStrById(_configData.ReadingName) heroData.property = heroData.changeProId heroData.sortId = #heroDatas + 1 ---↓↓↓↓↓↓↓↓↓↓↓摘星阁 - heroData.equipStrong={} + heroData.equipStrong = {} for i = 1, #_msgHeroData.equipStrong do - local _key=_msgHeroData.equipStrong[i].location - local _val=_msgHeroData.equipStrong[i].strongLv - heroData.equipStrong[_key]=_val + local _key = _msgHeroData.equipStrong[i].location + local _val = _msgHeroData.equipStrong[i].strongLv + heroData.equipStrong[_key] = _val end - heroData.equipAdvanceLv=_msgHeroData.equipAdvanceLv --摘星阁装备突破数据 - + heroData.equipAdvanceLv = _msgHeroData.equipAdvanceLv --摘星阁装备突破数据 + heroData.harmonyGongMing = _msgHeroData.createtype heroData.GetStar = function(index) local godSoulLv = GodSoulManager.GetGodSoulLv(heroData.dynamicId) if godSoulLv and godSoulLv > 0 then - return godSoulLv,3 + return godSoulLv, 3 elseif heroData.star >= 11 then - return heroData.star,3 - elseif heroData.star > 9 then - return heroData.star,2 + return heroData.star, 3 + elseif heroData.star > 9 then + return heroData.star, 2 end - return heroData.star,index + return heroData.star, index end table.insert(this.heroDataLists, heroData) heroDatas[heroData.dynamicId] = heroData this.SetEquipUpHeroDid(heroData.equipIdList, heroData.dynamicId) this.SetEquipTreasureUpHeroDid(heroData.jewels, heroData.dynamicId) - this.SetFaXiangUpHeroDid(heroData.faxiang,heroData.dynamicId) + this.SetFaXiangUpHeroDid(heroData.faxiang, heroData.dynamicId) this.SetTalismanLv(heroData.dynamicId, heroData.talismanList) --this.SetSoulPrintUpHeroDid(heroData.soulPrintList,heroData.dynamicId) isFindHandBook = isFindHandBook or true @@ -224,12 +225,12 @@ function this.UpdateHeroDatas(_msgHeroData, isFindHandBook) CheckRedPointStatus(RedPointType.LikeabilityRed) CheckRedPointStatus(RedPointType.EndlessPanel) end - heroData.warPower = 0--HeroPowerManager.GetHeroPower(heroData.dynamicId) + heroData.warPower = 0 --HeroPowerManager.GetHeroPower(heroData.dynamicId) --远征初始化血量 --ExpeditionManager.InitHeroHpValue(heroData) --特训数据 - heroData.HeroTraining=_msgHeroData.training - + heroData.HeroTraining = _msgHeroData.training + -- if not heroData.HeroTraining then -- heroData.HeroTraining={ -- heroId=heroData.dynamicId, @@ -248,39 +249,38 @@ function this.UpdateHeroDatas(_msgHeroData, isFindHandBook) GodSoulManager.BindHeroDatas(_msgHeroData) end - --设置英雄特训数据 -function this.SetHeroTraining(dyn,data) +function this.SetHeroTraining(dyn, data) if heroDatas[dyn] then - -- heroDatas[dyn].HeroTraining.trainingLv=data.HeroTraining.trainingLv - -- heroDatas[dyn].HeroTraining.attackExp=data.HeroTraining.attackExp - -- heroDatas[dyn].HeroTraining.defenseExp=data.HeroTraining.defenseExp - -- heroDatas[dyn].HeroTraining.hpExp=data.HeroTraining.hpExp - -- heroDatas[dyn].HeroTraining.unlockIds=data.HeroTraining.unlockIds - -- heroDatas[dyn].HeroTraining.isTraining=data.HeroTraining.isTraining - heroDatas[dyn].HeroTraining=data + -- heroDatas[dyn].HeroTraining.trainingLv=data.HeroTraining.trainingLv + -- heroDatas[dyn].HeroTraining.attackExp=data.HeroTraining.attackExp + -- heroDatas[dyn].HeroTraining.defenseExp=data.HeroTraining.defenseExp + -- heroDatas[dyn].HeroTraining.hpExp=data.HeroTraining.hpExp + -- heroDatas[dyn].HeroTraining.unlockIds=data.HeroTraining.unlockIds + -- heroDatas[dyn].HeroTraining.isTraining=data.HeroTraining.isTraining + heroDatas[dyn].HeroTraining = data end end + function this.GetHeroTrainPassiveSkill(_idDyn) - if heroDatas[_idDyn] then - local hero=heroDatas[_idDyn] - local trainLv=hero.HeroTraining.trainingLv - if trainLv>0 then - local list=ConfigManager.TryGetAllConfigsDataByKey(ConfigName.Train,"HeroID",hero.heroConfig.Id) - local skillId={} + local hero = heroDatas[_idDyn] + local trainLv = hero.HeroTraining.trainingLv + if trainLv > 0 then + local list = ConfigManager.TryGetAllConfigsDataByKey(ConfigName.Train, "HeroID", hero.heroConfig.Id) + local skillId = {} if list then - local unlockList=hero.HeroTraining.unlockIds + local unlockList = hero.HeroTraining.unlockIds for k, v in pairs(list) do - if CheckListIsContainValue1(unlockList,v.Id) and trainLv>=v.Level and v.PassiveSkill and #v.PassiveSkill>=1 and type(v.PassiveSkill[1])~="userdata" then - for i=1,#v.PassiveSkill do - table.insert(skillId,v.PassiveSkill[i]) + if CheckListIsContainValue1(unlockList, v.Id) and trainLv >= v.Level and v.PassiveSkill and #v.PassiveSkill >= 1 and type(v.PassiveSkill[1]) ~= "userdata" then + for i = 1, #v.PassiveSkill do + table.insert(skillId, v.PassiveSkill[i]) end end end return skillId -- for i, v in ConfigPairs(list) do - + -- end end end @@ -288,33 +288,32 @@ function this.GetHeroTrainPassiveSkill(_idDyn) return {} end - -function this.SetPotentialData(msg,dyn) - local list={} - for i =1,#msg do - local data=msg[i] - local lvData={} - lvData.lv=msg[i].upLv - lvData.giftLv=GiftManager.GetHeroPotencyLvById(dyn) --msg[i].giftLv - list[msg[i].type]=lvData - --LogError("type=============="..msg[i].type.." lv==="..lvData.lv.." giftlv==="..lvData.giftLv) +function this.SetPotentialData(msg, dyn) + local list = {} + for i = 1, #msg do + local data = msg[i] + local lvData = {} + lvData.lv = msg[i].upLv + lvData.giftLv = GiftManager.GetHeroPotencyLvById(dyn) --msg[i].giftLv + list[msg[i].type] = lvData + --LogError("type=============="..msg[i].type.." lv==="..lvData.lv.." giftlv==="..lvData.giftLv) end return list end -function this.SetPotentialDataByType(dyn,type,lv) - local list={} +function this.SetPotentialDataByType(dyn, type, lv) + local list = {} if heroDatas[dyn] and heroDatas[dyn].potential[type] then - heroDatas[dyn].potential[type].lv=lv + heroDatas[dyn].potential[type].lv = lv end end -function this.AddPotentialDataByType(dyn,type,lv) - local list={} +function this.AddPotentialDataByType(dyn, type, lv) + local list = {} if heroDatas[dyn] then - heroDatas[dyn].potential[type]={} - heroDatas[dyn].potential[type].lv=lv - heroDatas[dyn].potential[type].giftLv=GiftManager.GetHeroPotencyLvById(dyn) + heroDatas[dyn].potential[type] = {} + heroDatas[dyn].potential[type].lv = lv + heroDatas[dyn].potential[type].giftLv = GiftManager.GetHeroPotencyLvById(dyn) end end @@ -323,34 +322,31 @@ function this.ChangeAllHeroGiftLV() for i, v in pairs(heroDatas) do if v.potential then for key, value in pairs(v.potential) do - value.giftLv=GiftManager.GetHeroPotencyLvById(i) + value.giftLv = GiftManager.GetHeroPotencyLvById(i) end end end end --设置法灵 -function this.SetHeroBaublesId(dyn,_id) +function this.SetHeroBaublesId(dyn, _id) if heroDatas[dyn] then - heroDatas[dyn].baublesId=_id - HeroPropManager.SetDirtyByType(dyn,Hero_Prop_Type.Talisman) + heroDatas[dyn].baublesId = _id + HeroPropManager.SetDirtyByType(dyn, Hero_Prop_Type.Talisman) end - end - - --检测英雄潜能红点 function this.CheckHeroPotencyRedPoint(_did) - local isOpen= CheckFunctionOpen(FUNCTION_OPEN_TYPE.Potency) - if isOpen==false then + local isOpen = CheckFunctionOpen(FUNCTION_OPEN_TYPE.Potency) + if isOpen == false then return false end if heroDatas[_did] then if heroDatas[_did].potential then for k, v in pairs(heroDatas[_did].potential) do --LogError("k==========="..k) - local isRed=this.CheckPotencyRedPointByType(_did,k) + local isRed = this.CheckPotencyRedPointByType(_did, k) if isRed then return true end @@ -362,32 +358,32 @@ end --根据类型检测潜能红点 function this.CheckPotencyRedPointByType(_did, _type) - local isOpen= CheckFunctionOpen(FUNCTION_OPEN_TYPE.Potency) - if isOpen==false then + local isOpen = CheckFunctionOpen(FUNCTION_OPEN_TYPE.Potency) + if isOpen == false then return false end if heroDatas[_did] then if heroDatas[_did].potential[_type] then - local lv=heroDatas[_did].potential[_type].lv + local lv = heroDatas[_did].potential[_type].lv --LogError("_type=================".._type.." lv============="..lv) - local config=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.PotentialNew,"Type",_type,"Level",lv) - if config.Consume and #config.Consume>0 and tonumber(config.Consume[1][1])~=nil then - local isCan=true - for i=1,#config.Consume do - local id=config.Consume[i][1] - local num=config.Consume[i][2] - if BagManager.GetItemCountById(id) 0 and tonumber(config.Consume[1][1]) ~= nil then + local isCan = true + for i = 1, #config.Consume do + local id = config.Consume[i][1] + local num = config.Consume[i][2] + if BagManager.GetItemCountById(id) < num then + isCan = false + end + end + return isCan end end end return false end -function this.GetPotentialData(did) +function this.GetPotentialData(did) if heroDatas[did] then return heroDatas[did].potential end @@ -396,10 +392,10 @@ end function this.ResetHeroPotentialData(_did) if heroDatas[_did] then - heroDatas[_did].potential={} - heroDatas[_did].potential[1]={} - heroDatas[_did].potential[1].lv=1 - heroDatas[_did].potential[1].giftLv=TianShuMiJuanManger.GetAddPotentialLV() + heroDatas[_did].potential = {} + heroDatas[_did].potential[1] = {} + heroDatas[_did].potential[1].lv = 1 + heroDatas[_did].potential[1].giftLv = 1 --TianShuMiJuanManger.GetAddPotentialLV() end end @@ -419,8 +415,8 @@ function this.GetAllHeroList() return heroDatas end -function this.GetEquipStrongData(msg,level) - local list={} +function this.GetEquipStrongData(msg, level) + local list = {} if msg.infos and #msg.infos > 0 then for index, value in ipairs(msg.infos) do -- value.lvId = 1022 @@ -432,27 +428,27 @@ function this.GetEquipStrongData(msg,level) end end end - return list + return list end - -function this.ChangeSkinId(heroId,skinId) +function this.ChangeSkinId(heroId, skinId) heroDatas[heroId].skinId = skinId if skinId == 0 then heroDatas[heroId].skinConfig = heroConfig[heroDatas[heroId].id] else - heroDatas[heroId].skinConfig = ConfigManager.GetConfigDataByKey(ConfigName.HeroSkin,"Type",heroDatas[heroId].skinId) - end + heroDatas[heroId].skinConfig = ConfigManager.GetConfigDataByKey(ConfigName.HeroSkin, "Type", + heroDatas[heroId].skinId) + end heroDatas[heroId].live = GetResourcePath(heroDatas[heroId].skinConfig.Live) heroDatas[heroId].painting = GetResourcePath(heroDatas[heroId].skinConfig.Painting) heroDatas[heroId].icon = GetResourcePath(heroDatas[heroId].skinConfig.Icon) heroDatas[heroId].scale = heroDatas[heroId].skinConfig.Scale - heroDatas[heroId].position = heroDatas[heroId].skinConfig.Position + heroDatas[heroId].position = heroDatas[heroId].skinConfig.Position --设置战斗力脏数据 HeroPropManager.SetDirtyByType(heroId, Hero_Prop_Type.SkinAdd) end -function this.SetHeroFormationList(heroDid,teamId,isAddOrDel) +function this.SetHeroFormationList(heroDid, teamId, isAddOrDel) if heroDatas[heroDid] then -- LogRed("this.heroResolveLicence[teamId]:"..tostring(this.heroResolveLicence[teamId])) if isAddOrDel and this.heroResolveLicence[teamId] then @@ -485,6 +481,7 @@ function this.SetEquipUpHeroDid(_equipids, _heroDid) EquipManager.UpdateEquipData(_equipids, _heroDid) end end + function this.SetEquipTreasureUpHeroDid(_equipTreasureDids, _heroDid) for i = 1, #_equipTreasureDids do EquipTreasureManager.SetEquipTreasureUpHeroDid(_equipTreasureDids[i], _heroDid) @@ -497,23 +494,21 @@ function this.SetFaXiangUpHeroDid(_equipTreasureDids, _heroDid) end end - --设置法宝等级 function this.SetTalismanLv(did, lv) heroDatas[did].talismanList = lv end -function this.SetHeroPro(id,pro) +function this.SetHeroPro(id, pro) heroDatas[id].changeProId = pro heroDatas[id].property = pro end - -function this.SetSoulPrint(soulPos,did) +function this.SetSoulPrint(soulPos, did) local soulPrintList = {} if (#soulPos > 0) then for i, v in ipairs(soulPos) do - local soulPrint = {equipId = v.equipId, position = v.position} + local soulPrint = { equipId = v.equipId, position = v.position } SoulPrintManager.AddSoulPrintUpHeroDynamicId(v.equipId, did) table.insert(soulPrintList, soulPrint) end @@ -521,11 +516,11 @@ function this.SetSoulPrint(soulPos,did) return soulPrintList end -function this.SetGodPrint(soulPos,did) +function this.SetGodPrint(soulPos, did) local soulPrintList = {} if (#soulPos > 0) then for i, v in ipairs(soulPos) do - local soulPrint = {equipId = v.equipId, position = v.position} + local soulPrint = { equipId = v.equipId, position = v.position } GodPrintManager.AddSoulPrintUpHeroDynamicId(v.equipId, did) table.insert(soulPrintList, soulPrint) end @@ -536,7 +531,7 @@ end --一键卸下所有魂印 function this.SetSoulPrintNil(did) if heroDatas[did] then - for i = 1,#heroDatas[did].soulPrintList do + for i = 1, #heroDatas[did].soulPrintList do SoulPrintManager.DelSoulPrintUpHeroDynamicId(heroDatas[did].soulPrintList[i].equipId, did) end end @@ -546,14 +541,13 @@ end --一键卸下所有魂印 function this.SetGodPrintNil(did) if heroDatas[did] then - for i = 1,#heroDatas[did].godPrintList do + for i = 1, #heroDatas[did].godPrintList do GodPrintManager.DelSoulPrintUpHeroDynamicId(heroDatas[did].godPrintList[i].equipId, did) end end heroDatas[did].soulPrintList = {} end - function this.GetTalismanLv(did) if heroDatas[did] then return heroDatas[did].talismanList @@ -566,6 +560,7 @@ function this.SetSoulPrintUpHeroDid(soulPos, _heroDid) SoulPrintManager.SetSoulPrintUpHeroDid(soulPos, _heroDid) end end + --获取所有英雄信息 function this.GetAllHeroDatas(_lvLimit) local lvLimit = 0 @@ -575,7 +570,7 @@ function this.GetAllHeroDatas(_lvLimit) end local heros = {} for i, v in pairs(heroDatas) do - if v.lv >= lvLimit then-- or allUpZhenHeroList[v.dynamicId] then + if v.lv >= lvLimit then -- or allUpZhenHeroList[v.dynamicId] then table.insert(heros, v) end end @@ -589,11 +584,10 @@ function this.GetAllHeroDatas(_lvLimit) end --获取所有英雄信息 -function this.GetHeroDatasByNaturalAndProfession(_qua,_pro) - +function this.GetHeroDatasByNaturalAndProfession(_qua, _pro) local heros = {} for i, v in pairs(heroDatas) do - if v.heroConfig.Natural == _qua and v.heroConfig.PropertyName==_pro and CheckListIsContainValue1(HelpFightManager.upHeroList,v.dynamicId)==false then + if v.heroConfig.Natural == _qua and v.heroConfig.PropertyName == _pro and CheckListIsContainValue1(HelpFightManager.upHeroList, v.dynamicId) == false then table.insert(heros, v) end end @@ -601,18 +595,15 @@ function this.GetHeroDatasByNaturalAndProfession(_qua,_pro) heros, function(a, b) if a.star == b.star then - return a.lv>b.lv + return a.lv > b.lv else return a.star > b.star end - end ) return heros end - - --获取该静态id sortid最小的英雄信息 function this.GetHeroDataByHeroSIdAndMinSortId(_heroSId) local heroData = {} @@ -650,14 +641,14 @@ function this.GetHeroDataByHeroSIdAndMinSortId(_heroSId) end --获取该静态id 没有穿皮肤的 sortid最小的英雄信息 -function this.GetHeroDataByHeroSIdAndMinSortIdAndSkinId(_heroSId,_skinId) +function this.GetHeroDataByHeroSIdAndMinSortIdAndSkinId(_heroSId, _skinId) local heroData = {} local formationList = FormationManager.GetAllFormationHeroId() for i, v in pairs(formationList) do if heroDatas[i] then local curData = heroDatas[i] - if curData.id == _heroSId and curData.skinId ~= _skinId then + if curData.id == _heroSId and curData.skinId ~= _skinId then if heroData and heroData.id then if curData.sortId < heroData.sortId then heroData = curData @@ -682,11 +673,12 @@ function this.GetHeroDataByHeroSIdAndMinSortIdAndSkinId(_heroSId,_skinId) end end end - LogPink("heroData.dynamicId:"..heroData.dynamicId) + LogPink("heroData.dynamicId:" .. heroData.dynamicId) return heroData end + --获取所有英雄信息(分解 回溯用 ) -function this.GetAllHeroDataMsinusUpWar(_sortTypeId,type) --0全部 1-6属性 7-9 3、4、5星 +function this.GetAllHeroDataMsinusUpWar(_sortTypeId, type) --0全部 1-6属性 7-9 3、4、5星 local heros = {} local heros2 = {} for i, v in pairs(heroDatas) do @@ -717,15 +709,15 @@ function this.GetAllHeroDataMsinusUpWar(_sortTypeId,type) --0全部 1-6属性 7 end end heros[i].isHarmonyGongMing = 0 - if HarmonyManager.IsChangeColor(v.dynamicId) then + if HarmonyManager.IsChangeColor(v.dynamicId) then heros[i].isHarmonyGongMing = 1 end if HarmonyManager:IsEnvoy(v.dynamicId) then heros[i].isHarmonyGongMing = 2 end - heros[i].isTrain=0 + heros[i].isTrain = 0 if TrainBuildManager.CheckHeroIsTraining(v.dynamicId) then - heros[i].isTrain=1 + heros[i].isTrain = 1 end end end @@ -735,24 +727,25 @@ function this.GetAllHeroDataMsinusUpWar(_sortTypeId,type) --0全部 1-6属性 7 end --筛选 if heros and LengthOfTable(heros) > 0 then - for i, v in pairs(heros) do - if (v.lv > 1 and type == 1) or (v.lv > 0 and type == 2) or (v.talismanList > 1 and type == 3) then + for i, v in pairs(heros) do + if (v.lv > 1 and type == 1) or (v.lv > 0 and type == 2) or (v.talismanList > 1 and type == 3) then if _sortTypeId == 0 then table.insert(heros2, v) - -- elseif _sortTypeId >= 7 then - -- if v.star == _sortTypeId - 4 then - -- table.insert(heros2, v) - -- end + -- elseif _sortTypeId >= 7 then + -- if v.star == _sortTypeId - 4 then + -- table.insert(heros2, v) + -- end else if v.property == _sortTypeId then table.insert(heros2, v) end - end + end end end end return heros2 end + function this.GetHeroFormationStr(teamId) if this.heroResolveLicence[teamId] then if teamId < FormationTypeDef.FORMATION_ARENA_DEFEND then @@ -779,23 +772,24 @@ function this.GetHeroFormationStr(teamId) return Language[11103] elseif teamId == FormationTypeDef.EXPEDITION then return Language[10410] - -- 1001 + -- 1001 elseif teamId == FormationTypeDef.ARENA_TOM_MATCH then return Language[11104] elseif teamId == FormationTypeDef.JUMPSERVER_HIGHTLADDER then - return"该神将在罗浮争锋阵容中已上阵" + return "该神将在罗浮争锋阵容中已上阵" elseif teamId == FormationTypeDef.LuoFuZhengFeng1 then - return"该神将在罗浮争锋阵容中已上阵" + return "该神将在罗浮争锋阵容中已上阵" elseif teamId == FormationTypeDef.LuoFuZhengFeng2 then - return"该神将在罗浮争锋阵容中已上阵" + return "该神将在罗浮争锋阵容中已上阵" elseif teamId == FormationTypeDef.LuoFuZhengFeng3 then - return"该神将在罗浮争锋阵容中已上阵" + return "该神将在罗浮争锋阵容中已上阵" elseif teamId == FormationTypeDef.LuoFuZhengFeng4 then - return"该神将在罗浮争锋阵容中已上阵" + return "该神将在罗浮争锋阵容中已上阵" end end return "" end + function this.GetHeroFormationStr2(teamId) if this.heroResolveLicence[teamId] then if teamId < FormationTypeDef.FORMATION_ARENA_DEFEND then @@ -806,10 +800,10 @@ function this.GetHeroFormationStr2(teamId) return Language[11108], FormationTypeDef.FORMATION_ARENA_ATTACK elseif teamId == FormationTypeDef.FORMATION_ENDLESS_MAP then return Language[10692], FormationTypeDef.FORMATION_ENDLESS_MAP - -- elseif teamId == FormationTypeDef.FORMATION_GUILD_FIGHT_DEFEND then - -- return Language[10682], FormationTypeDef.FORMATION_GUILD_FIGHT_DEFEND - -- elseif teamId == FormationTypeDef.FORMATION_GUILD_FIGHT_ATTACK then - -- return Language[10683], FormationTypeDef.FORMATION_GUILD_FIGHT_ATTACK + -- elseif teamId == FormationTypeDef.FORMATION_GUILD_FIGHT_DEFEND then + -- return Language[10682], FormationTypeDef.FORMATION_GUILD_FIGHT_DEFEND + -- elseif teamId == FormationTypeDef.FORMATION_GUILD_FIGHT_ATTACK then + -- return Language[10683], FormationTypeDef.FORMATION_GUILD_FIGHT_ATTACK elseif teamId == FormationTypeDef.BLOODY_BATTLE_ATTACK then return Language[11109], FormationTypeDef.BLOODY_BATTLE_ATTACK elseif teamId == FormationTypeDef.EXPEDITION then @@ -830,6 +824,7 @@ function this.GetHeroFormationStr2(teamId) end return "" end + --删除本地英雄信息 function this.DeleteHeroDatas(heroDIds) for i = 1, #heroDIds do @@ -864,7 +859,7 @@ function this.DeleteHeroDatas(heroDIds) SoulPrintManager.DelSoulPrintUpHeroDynamicId(soulPrintList[j].equipId, heroDIds[i]) end end - + --清楚编队上的英雄 FormationManager.AllFormationDeleCurHeroId(heroDIds[i]) --清除英雄魂印上挂载的英雄did @@ -873,8 +868,8 @@ function this.DeleteHeroDatas(heroDIds) ExpeditionManager.DelHeroHpValue(heroDatas[heroDIds[i]]) GodSoulManager.DeleteHeroId(heroDIds[i]) --装备的法灵 - FaLingManager.SetEquipBelongHero(heroDatas[heroDIds[i]].baublesId,nil) - HeroManager.SetHeroBaublesId(heroDIds[i],"") + FaLingManager.SetEquipBelongHero(heroDatas[heroDIds[i]].baublesId, nil) + HeroManager.SetHeroBaublesId(heroDIds[i], "") TrainBuildManager.RemoveTrainHero(heroDIds[i]) --删除英雄 heroDatas[heroDIds[i]] = nil @@ -887,11 +882,11 @@ end --更新本地单个英雄基本信息 function this.UpdateSingleHeroDatas(heroDId, heroLv, heroStar, breakId, upStarId, isCallBackChangeWar) if heroDatas[heroDId] then - if heroLv then--鸿蒙阵上阵的等级是虚等级 升星不必赋值传nil 即可 + if heroLv then --鸿蒙阵上阵的等级是虚等级 升星不必赋值传nil 即可 heroDatas[heroDId].lv = heroLv end heroDatas[heroDId].star = heroStar - if breakId then--鸿蒙阵上阵的突破等级是虚等级 升星不必赋值传nil 即可 + if breakId then --鸿蒙阵上阵的突破等级是虚等级 升星不必赋值传nil 即可 heroDatas[heroDId].breakId = breakId end heroDatas[heroDId].upStarId = upStarId @@ -914,12 +909,14 @@ function this.UpdateSingleHeroDatas(heroDId, heroLv, heroStar, breakId, upStarId this.CompareWarPower(heroDId) end end + --更新本地单个英雄上锁 function this.UpdateSingleHeroLockState(heroDId, lockState) if heroDatas[heroDId] then heroDatas[heroDId].lockState = lockState end end + --对比战力并更新战力值 function this.CompareWarPower(heroDId) local oldWarPowerValue = heroDatas[heroDId].warPower @@ -929,11 +926,11 @@ function this.CompareWarPower(heroDId) if oldWarPowerValue ~= newWarPowerValue then if not UIManager.IsOpen(UIName.RoleUpStarSuccessPanel) and - not UIManager.IsOpen(UIName.RoleUpLvBreakSuccessPanel) - then + not UIManager.IsOpen(UIName.RoleUpLvBreakSuccessPanel) + then UIManager.OpenPanel( UIName.WarPowerChangeNotifyPanelV2, - {oldValue = oldWarPowerValue, newValue = newWarPowerValue} + { oldValue = oldWarPowerValue, newValue = newWarPowerValue } ) end end @@ -942,18 +939,18 @@ function this.CompareWarPower(heroDId) end --对比战力并更新战力值 -function this.CompareWarPower1(heroDId,oldWarPowerValue) +function this.CompareWarPower1(heroDId, oldWarPowerValue) local newWarPowerValue = HeroPowerManager.GetHeroPower(heroDId) heroDatas[heroDId].warPower = newWarPowerValue if oldWarPowerValue and newWarPowerValue then if oldWarPowerValue ~= newWarPowerValue then if not UIManager.IsOpen(UIName.RoleUpStarSuccessPanel) and - not UIManager.IsOpen(UIName.RoleUpLvBreakSuccessPanel) - then + not UIManager.IsOpen(UIName.RoleUpLvBreakSuccessPanel) + then UIManager.OpenPanel( UIName.WarPowerChangeNotifyPanelV2, - {oldValue = oldWarPowerValue, newValue = newWarPowerValue} + { oldValue = oldWarPowerValue, newValue = newWarPowerValue } ) end end @@ -961,8 +958,6 @@ function this.CompareWarPower1(heroDId,oldWarPowerValue) FormationManager.CheckHeroIdExist(heroDId) end - - --更新本地单个英雄技能信息 function this.UpdateSingleHeroSkillData(_heroDId) if heroDatas[_heroDId] then @@ -998,7 +993,8 @@ function this.UpdateSingleHeroSkillData(_heroDId) end heroData.passiveSkillList = {} --被动技 - local OpenPassiveSkillRules = heroData.star >= this.awakeNextStarIndex and heroData.heroConfig.Awaken or heroData.heroConfig.OpenPassiveSkillRules + 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] == heroData.star then @@ -1011,6 +1007,7 @@ function this.UpdateSingleHeroSkillData(_heroDId) end end end + --更新本地单个英雄法宝信息 function this.UpdateHeroSingleTalismanData(heroDId, heroTalismanDatas, type) --type--1 穿单件法宝 2 卸单件法宝 if heroDatas[heroDId] then @@ -1031,11 +1028,12 @@ function this.UpdateHeroSingleTalismanData(heroDId, heroTalismanDatas, type) --t end this.CompareWarPower(heroDId) end + --更新本地单个英雄魂印信息 function this.UpdateHeroSingleSoulPrint(heroDId, hasEquipSoulPrintId) local soulEquipPrintList = {} for i, v in pairs(hasEquipSoulPrintId[heroDId]) do - local soulPrint = {did = v.did, pos = v.pos} + local soulPrint = { did = v.did, pos = v.pos } table.insert(soulEquipPrintList, soulPrint) end heroDatas[heroDId].soulPrintList = soulEquipPrintList @@ -1046,14 +1044,13 @@ end function this.UpdateHeroSingleGodPrint(heroDId, hasEquipSoulPrintId) local soulEquipPrintList = {} for i, v in pairs(hasEquipSoulPrintId[heroDId]) do - local soulPrint = {did = v.did, pos = v.pos} + local soulPrint = { did = v.did, pos = v.pos } table.insert(soulEquipPrintList, soulPrint) end heroDatas[heroDId].godPrintList = soulEquipPrintList this.CompareWarPower(heroDId) end - --获取单个英雄数据 function this.GetSingleHeroData(heroDId) --LogGreen("heroDId"..tostring(heroDId)) @@ -1076,6 +1073,7 @@ function this.IsHaveHero(heroDId) end return false end + --获取当前升星信息 function this.GetHeroCurUpStarInfo(heroDId) local indexStar = 0 @@ -1092,7 +1090,8 @@ function this.GetHeroCurUpStarInfo(heroDId) if v.heroConfig.RankupConsumeMaterial[j][1] == indexStar then local heroUpStarMaterialsData = {} heroUpStarMaterialsData.upStarData = v.heroConfig.RankupConsumeMaterial[j] - heroUpStarMaterialsData.upStarMaterialsData =heroRankUpGroup[v.heroConfig.RankupConsumeMaterial[j][3]] + heroUpStarMaterialsData.upStarMaterialsData = heroRankUpGroup + [v.heroConfig.RankupConsumeMaterial[j][3]] table.insert(RankupConsumeMaterial, heroUpStarMaterialsData) end end @@ -1106,38 +1105,37 @@ function this.GetHeroCurUpStarInfo(heroDId) return RankupConsumeMaterial end - --获取当前升星信息 function this.GetHeroCurUpStarInfo2(heroDId) local indexStar = 0 local RankupConsumeMaterial = {} - local config=heroConfig[heroDId] - - if config then - if config.RankupConsumeMaterial then - for j = 1, #config.RankupConsumeMaterial do - if #config.RankupConsumeMaterial[j] > 1 then - if config.RankupConsumeMaterial[j][1] > v.star then - if indexStar == 0 then - indexStar = config.RankupConsumeMaterial[j][1] - end - if config.RankupConsumeMaterial[j][1] == indexStar then - local heroUpStarMaterialsData = {} - heroUpStarMaterialsData.upStarData = config.RankupConsumeMaterial[j] - heroUpStarMaterialsData.upStarMaterialsData =heroRankUpGroup[config.RankupConsumeMaterial[j][3]] - table.insert(RankupConsumeMaterial, heroUpStarMaterialsData) - end + local config = heroConfig[heroDId] + + if config then + if config.RankupConsumeMaterial then + for j = 1, #config.RankupConsumeMaterial do + if #config.RankupConsumeMaterial[j] > 1 then + if config.RankupConsumeMaterial[j][1] > v.star then + if indexStar == 0 then + indexStar = config.RankupConsumeMaterial[j][1] + end + if config.RankupConsumeMaterial[j][1] == indexStar then + local heroUpStarMaterialsData = {} + heroUpStarMaterialsData.upStarData = config.RankupConsumeMaterial[j] + heroUpStarMaterialsData.upStarMaterialsData = heroRankUpGroup + [config.RankupConsumeMaterial[j][3]] + table.insert(RankupConsumeMaterial, heroUpStarMaterialsData) end - else - return nil end + else + return nil end end end + end return RankupConsumeMaterial end - --检测卡库中的英雄是否有满足当前升星条件 function this.GetUpStarHeroListData(heroRankUpGroupId, heroData) local needHeroListData = {} @@ -1213,17 +1211,17 @@ function this.GetUpStarHeroListData(heroRankUpGroupId, heroData) end end end - table.sort(needHeroListData,function(a, b) - if a.id == b.id then - if a.lv == b.lv then - return a.id > b.id - else - return a.lv < b.lv - end - else + table.sort(needHeroListData, function(a, b) + if a.id == b.id then + if a.lv == b.lv then return a.id > b.id + else + return a.lv < b.lv end + else + return a.id > b.id end + end ) --前边以前添加英雄代码不动 local canSeleItemIds = {} @@ -1236,8 +1234,8 @@ function this.GetUpStarHeroListData(heroRankUpGroupId, heroData) for i = 1, haveNum do local v = {} v.id = itemId - -- LogError("items++") - table.insert(canSeleItemIds,itemId) + -- LogError("items++") + table.insert(canSeleItemIds, itemId) end end end @@ -1251,7 +1249,7 @@ function this.GetUpStarHeroListData(heroRankUpGroupId, heroData) for i = 1, haveNum do local v = {} v.id = itemId - table.insert(canSeleItemIds,itemId) + table.insert(canSeleItemIds, itemId) end end end @@ -1264,25 +1262,26 @@ function this.GetUpStarHeroListData(heroRankUpGroupId, heroData) needHeroListData2.state = 1 end --道具靠前 - if #canSeleItemIds > 0 then + if #canSeleItemIds > 0 then for i, v in ipairs(canSeleItemIds) do local vData = {} vData.id = v - vData.type = RoleUpStarMatType.item--1道具 2 英雄 需要传给后端 - vData.index = i--用于祭品选择界面 查看是否选中 + vData.type = RoleUpStarMatType.item --1道具 2 英雄 需要传给后端 + vData.index = i --用于祭品选择界面 查看是否选中 table.insert(needHeroListData2.heroList, vData) end end --英雄靠后 if #needHeroListData > 0 then for i, v in ipairs(needHeroListData) do - v.type = RoleUpStarMatType.hero--1道具 2 英雄 需要传给后端 + v.type = RoleUpStarMatType.hero --1道具 2 英雄 需要传给后端 table.insert(needHeroListData2.heroList, v) end end return needHeroListData2 end + --计算每个星级的英雄等级最终上限 function this.UpdateHeroLvEnd() --计算每个最终等级上限 @@ -1330,6 +1329,7 @@ function this.UpdateHeroLvEnd() -- end --end end + --计算英雄当前星级的等级上限 function this.GetCurHeroStarLvEnd(getValType, curHeroData, _breakId, _upStarId) local breakId = 0 @@ -1357,20 +1357,23 @@ function this.GetCurHeroStarLvEnd(getValType, curHeroData, _breakId, _upStarId) end end end + function this.UpdateHeroPower() for _, v in pairs(heroDatas) do v.warPower = HeroPowerManager.GetHeroPower(v.dynamicId) end end + function this.UpdateHeroPowerProfession() for _, v in pairs(heroDatas) do - if GuildSkillManager.UpdataHeroProList[v.heroConfig.Profession] then - LogGreen("v.dynamicId "..v.dynamicId) - v.warPower = HeroPowerManager.GetHeroPower(v.dynamicId) + if GuildSkillManager.UpdataHeroProList[v.heroConfig.Profession] then + LogGreen("v.dynamicId " .. v.dynamicId) + v.warPower = HeroPowerManager.GetHeroPower(v.dynamicId) --this.CalculateHeroAllProValList(1, v.dynamicId, false)[HeroProType.WarPower] end end end + --获取同一类型的技能 function this.GetTypeAllSkillData(_skillName) local allTypeSkillData = {} @@ -1381,6 +1384,7 @@ function this.GetTypeAllSkillData(_skillName) end return allTypeSkillData end + --获得英雄属性计算战斗力属性评分 function this.GetSingleProScoreVal() this.heroPropertyScore = {} @@ -1390,15 +1394,15 @@ function this.GetSingleProScoreVal() end --设置英雄特训属性 -function this.CaculateAttributeByTraining(dyn,data) +function this.CaculateAttributeByTraining(dyn, data) if heroDatas[dyn] then - -- heroDatas[dyn].HeroTraining.trainingLv=data.HeroTraining.trainingLv - -- heroDatas[dyn].HeroTraining.attackExp=data.HeroTraining.attackExp - -- heroDatas[dyn].HeroTraining.defenseExp=data.HeroTraining.defenseExp - -- heroDatas[dyn].HeroTraining.hpExp=data.HeroTraining.hpExp - -- heroDatas[dyn].HeroTraining.unlockIds=data.HeroTraining.unlockIds - -- heroDatas[dyn].HeroTraining.isTraining=data.HeroTraining.isTraining - heroDatas[dyn].HeroTraining=data + -- heroDatas[dyn].HeroTraining.trainingLv=data.HeroTraining.trainingLv + -- heroDatas[dyn].HeroTraining.attackExp=data.HeroTraining.attackExp + -- heroDatas[dyn].HeroTraining.defenseExp=data.HeroTraining.defenseExp + -- heroDatas[dyn].HeroTraining.hpExp=data.HeroTraining.hpExp + -- heroDatas[dyn].HeroTraining.unlockIds=data.HeroTraining.unlockIds + -- heroDatas[dyn].HeroTraining.isTraining=data.HeroTraining.isTraining + heroDatas[dyn].HeroTraining = data end end @@ -1446,14 +1450,13 @@ local function CalculateHeroUpEquipsProAddVal(_heroId) addAllProVal[curProId] = curProVal end end - end end end return addAllProVal end --计算所有法宝加成的属性值 -local function CalculateHeroUpTalismanProAddVal(_heroId, _breakId, _upStarId,teamCurPropertyName) +local function CalculateHeroUpTalismanProAddVal(_heroId, _breakId, _upStarId, teamCurPropertyName) local addAllProVal = {} local singleHeroProVal, lvProVal, allHeroProVal, specialProVal local curHeroData = HeroManager.GetSingleHeroData(_heroId) @@ -1465,19 +1468,19 @@ local function CalculateHeroUpTalismanProAddVal(_heroId, _breakId, _upStarId,tea if star >= curHeroData.heroConfig.EquipTalismana[1] then local curTalisman = ConfigManager.GetConfigData(ConfigName.HeroConfig, curHeroData.id).EquipTalismana if curTalisman and curTalisman[2] then - local lv=0 - local data=FaLingManager.GetEquipDataByDid(curHeroData.baublesId) + local lv = 0 + local data = FaLingManager.GetEquipDataByDid(curHeroData.baublesId) if data then - lv=data.lv + lv = data.lv end local talismanConFig = ConfigManager.TryGetConfigDataByDoubleKey( - ConfigName.EquipTalismana, - "TalismanaId", - curTalisman[2], - "Level", - lv - ) + ConfigName.EquipTalismana, + "TalismanaId", + curTalisman[2], + "Level", + lv + ) if talismanConFig then --主属性 for j = 1, #talismanConFig.Property do @@ -1540,7 +1543,6 @@ local function CalculateHeroUpTalismanProAddVal(_heroId, _breakId, _upStarId,tea end --英雄身上魂印属性计算 local function CalculateSoulPrintAddVal(_heroId) - -- local allSoulPrintAddWarPowerVal = 0 -- local curHeroData = HeroManager.GetSingleHeroData(_heroId) -- if curHeroData then @@ -1558,50 +1560,50 @@ local function CalculateSoulPrintAddVal(_heroId) local addAllProVal = {} - local singleHeroProVal,lvProVal,allHeroProVal,specialProVal + local singleHeroProVal, lvProVal, allHeroProVal, specialProVal local curHeroData = HeroManager.GetSingleHeroData(_heroId) if curHeroData then - if(table.nums(curHeroData.soulPrintList) >= 1) then - local curAllPassiveSkillIds = {} - for i = 1, #curHeroData.soulPrintList do - local cursoulPrintConfig = equipConfig[curHeroData.soulPrintList[i].equipId] - if cursoulPrintConfig then - --基础属性计算 - local soulPrintPropertyList = cursoulPrintConfig.Property - if soulPrintPropertyList and #soulPrintPropertyList > 0 then - for i,v in pairs(soulPrintPropertyList) do - if(addAllProVal[v[1]]) then - addAllProVal[v[1]]=v[2]+addAllProVal[v[1]] - else - addAllProVal[v[1]]=v[2] - end - end - end - --被动技能计算 - if cursoulPrintConfig.PassiveSkill and #cursoulPrintConfig.PassiveSkill > 0 then - for i = 1, #cursoulPrintConfig.PassiveSkill do - table.insert(curAllPassiveSkillIds,cursoulPrintConfig.PassiveSkill[i]) + if (table.nums(curHeroData.soulPrintList) >= 1) then + local curAllPassiveSkillIds = {} + for i = 1, #curHeroData.soulPrintList do + local cursoulPrintConfig = equipConfig[curHeroData.soulPrintList[i].equipId] + if cursoulPrintConfig then + --基础属性计算 + local soulPrintPropertyList = cursoulPrintConfig.Property + if soulPrintPropertyList and #soulPrintPropertyList > 0 then + for i, v in pairs(soulPrintPropertyList) do + if (addAllProVal[v[1]]) then + addAllProVal[v[1]] = v[2] + addAllProVal[v[1]] + else + addAllProVal[v[1]] = v[2] + end end end - end - end - singleHeroProVal,lvProVal,allHeroProVal,specialProVal = this.CalculatePassiveSkillsValList(WarPowerType.SoulPrint,curAllPassiveSkillIds) - end + --被动技能计算 + if cursoulPrintConfig.PassiveSkill and #cursoulPrintConfig.PassiveSkill > 0 then + for i = 1, #cursoulPrintConfig.PassiveSkill do + table.insert(curAllPassiveSkillIds, cursoulPrintConfig.PassiveSkill[i]) + end + end + end + end + singleHeroProVal, lvProVal, allHeroProVal, specialProVal = this.CalculatePassiveSkillsValList( + WarPowerType.SoulPrint, curAllPassiveSkillIds) + end end if singleHeroProVal and LengthOfTable(singleHeroProVal) > 0 then - for i,v in pairs(singleHeroProVal) do - if addAllProVal[i] then - addAllProVal[i] = addAllProVal[i] + v - else - addAllProVal[i] = v - end - end + for i, v in pairs(singleHeroProVal) do + if addAllProVal[i] then + addAllProVal[i] = addAllProVal[i] + v + else + addAllProVal[i] = v + end + end end - return addAllProVal,lvProVal,allHeroProVal,specialProVal + return addAllProVal, lvProVal, allHeroProVal, specialProVal end --英雄身上魂印属性计算 local function CalculateSoulPrintAddVal2(_heroId) - local allSoulPrintAddWarPowerVal = 0 local curHeroData = HeroManager.GetSingleHeroData(_heroId) if curHeroData then @@ -1660,29 +1662,29 @@ end --英雄身上宝器属性计算 local function CalculateEquipTreaSureAddVal(_heroId) local addAllProVal = {} - local minLv=0 - local mainRefineLv=0 + local minLv = 0 + local mainRefineLv = 0 local curHeroData = HeroManager.GetSingleHeroData(_heroId) - LogError("_heroId===========================".._heroId) + LogError("_heroId===========================" .. _heroId) if curHeroData then - LogError("#curHeroData.jewels > 0=="..#curHeroData.jewels) + LogError("#curHeroData.jewels > 0==" .. #curHeroData.jewels) if #curHeroData.jewels > 0 then for i = 1, #curHeroData.jewels do local did = curHeroData.jewels[i] local curEuipTreaSureData = EquipTreasureManager.GetSingleTreasureByIdDyn(did) or - ExpeditionManager.GetSingleTreasureByIdDyn(did) or + ExpeditionManager.GetSingleTreasureByIdDyn(did) or MonsterCampManager.GetSingleTreasureByIdDyn(did) - if curEuipTreaSureData==nil then - LogError("curEuipTreaSureData==nil") - end + if curEuipTreaSureData == nil then + LogError("curEuipTreaSureData==nil") + end if curEuipTreaSureData then local curEuipTreaSureConfig = jewelConfig[curEuipTreaSureData.id] for _, configInfo in ConfigPairs(jewelRankupConfig) do --强化的属性 if configInfo.PoolID == curEuipTreaSureConfig.LevelupPool and configInfo.Type == 1 and - configInfo.Level == curEuipTreaSureData.lv + configInfo.Level == curEuipTreaSureData.lv then for j = 1, #configInfo.Property do if addAllProVal[configInfo.Property[j][1]] then @@ -1696,7 +1698,7 @@ local function CalculateEquipTreaSureAddVal(_heroId) --精炼的属性 if configInfo.PoolID == curEuipTreaSureConfig.RankupPool and configInfo.Type == 2 and - configInfo.Level == curEuipTreaSureData.refineLv + configInfo.Level == curEuipTreaSureData.refineLv then for j = 1, #configInfo.Property do if addAllProVal[configInfo.Property[j][1]] then @@ -1724,10 +1726,10 @@ local function CalculateEquipTreaSureAddVal(_heroId) -- end -- end end - + if #curHeroData.jewels > 1 then --取 强化 精炼 最小值 - LogError("curEuipTreaSureData.lv=="..curEuipTreaSureData.lv) + LogError("curEuipTreaSureData.lv==" .. curEuipTreaSureData.lv) if minLv then if curEuipTreaSureData.lv < minLv then minLv = curEuipTreaSureData.lv @@ -1742,7 +1744,7 @@ local function CalculateEquipTreaSureAddVal(_heroId) else mainRefineLv = curEuipTreaSureData.refineLv end - LogError("curEuipTreaSureData.refineLv=="..curEuipTreaSureData.refineLv) + LogError("curEuipTreaSureData.refineLv==" .. curEuipTreaSureData.refineLv) end end end @@ -1755,8 +1757,8 @@ local function CalculateEquipTreaSureAddVal(_heroId) if lvjewelResonanceConfig then if curjewelResonanceConfig.Type == 1 and curjewelResonanceConfig.Level <= minLv and - curjewelResonanceConfig.Id > lvjewelResonanceConfig.Id - then + curjewelResonanceConfig.Id > lvjewelResonanceConfig.Id + then lvjewelResonanceConfig = curjewelResonanceConfig end else @@ -1767,8 +1769,8 @@ local function CalculateEquipTreaSureAddVal(_heroId) if refineLvjewelResonanceConfig then if curjewelResonanceConfig.Type == 2 and curjewelResonanceConfig.Level <= mainRefineLv and - curjewelResonanceConfig.Id > refineLvjewelResonanceConfig.Id - then + curjewelResonanceConfig.Id > refineLvjewelResonanceConfig.Id + then refineLvjewelResonanceConfig = curjewelResonanceConfig end else @@ -1811,7 +1813,7 @@ local function CalculateEquipTreaSureAddVal(_heroId) end --计算所有英雄被动技能的属性值 -local function CalculateHeroPassiveSkillProAddVal(_type, _heroId, _breakId, _upStarId,teamCurPropertyName) +local function CalculateHeroPassiveSkillProAddVal(_type, _heroId, _breakId, _upStarId, teamCurPropertyName) local singleHeroProVal, lvProVal, allHeroProVal, specialProVal local curHeroData = HeroManager.GetSingleHeroData(_heroId) if curHeroData then @@ -1824,7 +1826,8 @@ local function CalculateHeroPassiveSkillProAddVal(_type, _heroId, _breakId, _upS end --单体加成 --单体等级限制加成 --团体加成 --减乘 singleHeroProVal, lvProVal, allHeroProVal, specialProVal = - this.CalculatePassiveSkillsValList(WarPowerType.Hero, allOpenPassiveSkillIds,teamCurPropertyName,curHeroData) + this.CalculatePassiveSkillsValList(WarPowerType.Hero, allOpenPassiveSkillIds, teamCurPropertyName, + curHeroData) end return singleHeroProVal, lvProVal, allHeroProVal, specialProVal end @@ -1841,8 +1844,8 @@ function this.CalculateProVal(proValue, lvNum, breakId, upStarId, proId) end end end - local breakRankupPara = {0, 0, 0} - local upStarRankupPara = {0, 0, 0} + local breakRankupPara = { 0, 0, 0 } + local upStarRankupPara = { 0, 0, 0 } if heroRankUpConfig[breakId] then for i = 1, #heroRankUpConfig[breakId].RankupPara do if heroRankUpConfig[breakId].RankupPara[i][1] == proId then @@ -1933,7 +1936,7 @@ function this.CalculateProValMap(_heroDid, _proType) end --计算战斗力 -local function CalculateWarForce(powerVal) +local function CalculateWarForce(powerVal) local powerEndVal = 0 for i, v in pairs(powerVal) do if v > 0 then @@ -1951,9 +1954,9 @@ local function CalculateSingleModuleWarForce(powerVal) if curProConfig and curProConfig.TargetPropertyId > 0 then powerVal[curProConfig.TargetPropertyId] = math.floor( - powerVal[curProConfig.TargetPropertyId] + + powerVal[curProConfig.TargetPropertyId] + powerVal[curProConfig.TargetPropertyId] * powerVal[i] / 10000 - ) + ) end if curProConfig and curProConfig.Style == 2 then powerVal[i] = powerVal[i] / 10000 @@ -1980,7 +1983,7 @@ end --- --- -function this.CalculatePassiveSkillsValList(index, skillids,teamCurPropertyName,curHeroData) +function this.CalculatePassiveSkillsValList(index, skillids, teamCurPropertyName, curHeroData) for k, v in ConfigPairs(ConfigManager.GetConfig(ConfigName.PropertyConfig)) do this.allProVal[index].singleHeroProVal[k] = 0 this.allProVal[index].lvProVal[k] = 0 @@ -2058,19 +2061,21 @@ function this.CalculatePassiveSkillsValList(index, skillids,teamCurPropertyName, ) end elseif curSkillData.Type == 171 then - --目前没有 - --this.GetProAndValByFormula(lvProVal,curSkillData,specialProVal) + --目前没有 + --this.GetProAndValByFormula(lvProVal,curSkillData,specialProVal) end end else --LogError("被动技能在被动技能表PassiveSkillLogicConfig没有找到 " .. skillid) end end - return this.allProVal[index].singleHeroProVal, this.allProVal[index].lvProVal, this.allProVal[index].allHeroProVal, this.allProVal[ + return this.allProVal[index].singleHeroProVal, this.allProVal[index].lvProVal, this.allProVal[index].allHeroProVal, + this.allProVal[ index - ].specialProVal + ].specialProVal end -function this.GetProAndValByFormula(proTable, specialProVal, curProId, curProVal, curProlGs,heroPro) + +function this.GetProAndValByFormula(proTable, specialProVal, curProId, curProVal, curProlGs, heroPro) if curProlGs == 1 then --公式 (绝对值加a+b) local curProConfig = ConfigManager.GetConfigDataByKey(ConfigName.PropertyConfig, "PropertyIdInBattle", curProId) if propertyConfig[curProConfig.PropertyId].Style == 1 then @@ -2123,10 +2128,10 @@ function this.GetProAndValByFormula(proTable, specialProVal, curProId, curProVal --目前没有 --specialProVal local curProConfig = ConfigManager.GetConfigDataByKey(ConfigName.PropertyConfig, "PropertyIdInBattle", curProId) - local singleProInfo = {proId =curProConfig.PropertyId ,value = curProVal} + local singleProInfo = { proId = curProConfig.PropertyId, value = curProVal } if heroPro.MLSproList then - table.insert(heroPro.MLSproList,singleProInfo) - end + table.insert(heroPro.MLSproList, singleProInfo) + end else --171 无公式 local curProConfig = ConfigManager.GetConfigDataByKey(ConfigName.PropertyConfig, "PropertyIdInBattle", curProId) if propertyConfig[curProConfig.PropertyId].Style == 1 then @@ -2146,7 +2151,7 @@ function this.GetProAndValByFormula(proTable, specialProVal, curProId, curProVal end --团队加成 -function this.GetAllHeroTeamAddProVal(teamHeroInfos,curteamHeroDid) +function this.GetAllHeroTeamAddProVal(teamHeroInfos, curteamHeroDid) local teamProVal = {} --英雄 法宝 魂印 被动技能 local heroAllNum = 0 @@ -2154,11 +2159,15 @@ function this.GetAllHeroTeamAddProVal(teamHeroInfos,curteamHeroDid) if teamHeroInfos[i] then heroAllNum = heroAllNum + 1 local heroSkillSingleHeroProVal, heroSkillLvProVal, heroSkillAllHeroProVal, heroSkillSpecialProVal = - CalculateHeroPassiveSkillProAddVal(1, teamHeroInfos[i].heroId,nil,nil, curteamHeroDid and HeroManager.GetSingleHeroData(curteamHeroDid).changeProId or nil) + CalculateHeroPassiveSkillProAddVal(1, teamHeroInfos[i].heroId, nil, nil, + curteamHeroDid and HeroManager.GetSingleHeroData(curteamHeroDid).changeProId or nil) local falismanSingleHeroProVal, falismanLvProVal, falismanAllHeroProVal, falismanSpecialProVal = - CalculateHeroUpTalismanProAddVal(teamHeroInfos[i].heroId,nil,nil, curteamHeroDid and HeroManager.GetSingleHeroData(curteamHeroDid).changeProId or nil) - local soulPrinSingleHeroProVal,soulPrinLvProVal,soulPrinAllHeroProVal,soulPrinSpecialProVal = CalculateSoulPrintAddVal(teamHeroInfos[i].heroId) - local heroSkinSingleProVal, heroSkinAllHeroProVal = HeroSkinManager.CaculateSkinProVal(teamHeroInfos[i].heroId) + CalculateHeroUpTalismanProAddVal(teamHeroInfos[i].heroId, nil, nil, + curteamHeroDid and HeroManager.GetSingleHeroData(curteamHeroDid).changeProId or nil) + local soulPrinSingleHeroProVal, soulPrinLvProVal, soulPrinAllHeroProVal, soulPrinSpecialProVal = + CalculateSoulPrintAddVal(teamHeroInfos[i].heroId) + local heroSkinSingleProVal, heroSkinAllHeroProVal = HeroSkinManager.CaculateSkinProVal(teamHeroInfos[i] + .heroId) this.DoubleTableCompound(teamProVal, heroSkillAllHeroProVal) this.DoubleTableCompound(teamProVal, falismanAllHeroProVal) this.DoubleTableCompound(teamProVal, soulPrinAllHeroProVal) @@ -2171,11 +2180,11 @@ function this.GetAllHeroTeamAddProVal(teamHeroInfos,curteamHeroDid) --神兵编队加成 local weaponFormationAllHeroProVal = GodWeaponManager.GetWeaponFormationTeamAddPro(heroAllNum) this.DoubleTableCompound(teamProVal, weaponFormationAllHeroProVal) - --灵兽羁绊加成 - local pokemonFetterAddPro = PokemonManager.GetAllPokemonFetterAddPros() + --灵兽羁绊加成 + local pokemonFetterAddPro = PokemonManager.GetAllPokemonFetterAddPros() this.DoubleTableCompound(teamProVal, pokemonFetterAddPro) - --神兵羁绊加成 - local weaponFetterAddPro = GodWeaponManager.GetAllWeaponFetterAddPros() + --神兵羁绊加成 + local weaponFetterAddPro = GodWeaponManager.GetAllWeaponFetterAddPros() this.DoubleTableCompound(teamProVal, weaponFetterAddPro) --神将羁绊加成 local heroFetterAddPro = TianShuMiJuanManger.GetAllFetterAddProsBy(1) @@ -2194,7 +2203,8 @@ end --计算英雄身上所有属性加成(包括装备就、异妖的加成) --_type==1 计算当前英雄的所有属性 _type==2 根据_heroDid之后_breakId传过来的值进行计算 _isAllHeroProVal==true 团体加成综合 用字段_allHeroProVal -function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upStarId, _isAllHeroProVal, _allHeroProVal,formationHeroNum, formationId) +function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upStarId, _isAllHeroProVal, _allHeroProVal, + formationHeroNum, formationId) -- LogRed(" ------- ------------ 原战斗计算方式不应调用 ----------- -------") local curHeroData = this.GetSingleHeroData(_heroDid) or _heroDid local curLvNum = curHeroData.lv @@ -2213,7 +2223,8 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt LogRed_Prop("装备加成") LogRedTable_Prop(allAddProVal) --异妖配件的加成 - local allPokemonPeiJianAddPro = DiffMonsterManager.CalculateAllPokemonPeiJiAllProAddVal(curHeroData.heroConfig.Profession) + local allPokemonPeiJianAddPro = DiffMonsterManager.CalculateAllPokemonPeiJiAllProAddVal(curHeroData.heroConfig + .Profession) LogRed_Prop("异妖配件的加成") LogRedTable_Prop(allPokemonPeiJianAddPro) --科技树加成 @@ -2224,7 +2235,7 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt local guildSkillAllProAdd = GuildSkillManager.HeroCalculateGuildSkillWarForce(curHeroData.heroConfig.Profession) LogRed_Prop("公会技能加成") LogRedTable_Prop(guildSkillAllProAdd) - --四象心法加成 + --四象心法加成 local fourQuaderAllProAdd = PracticeManager.HeroCalculateFourQuaWarForce(curHeroData.heroConfig.Profession) LogRed_Prop("四象心法加成") LogRedTable_Prop(fourQuaderAllProAdd) @@ -2244,7 +2255,7 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt LogRedTable_Prop(heroSkillLvProVal) LogRed_Prop("英雄被动技的团体属性加成") LogRedTable_Prop(heroSkillAllHeroProVal) - + --法宝的属性加成 falismanProAdd local falismanSingleHeroProVal, falismanLvProVal, falismanAllHeroProVal, falismanSpecialProVal = {}, {}, {}, {} if _type == 1 then @@ -2261,7 +2272,8 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt LogRed_Prop("法宝的团体属性加成") LogRedTable_Prop(falismanAllHeroProVal) --魂印的属性加成 - local singleHeroSoulPrintProVal,lvSoulPrintProVal,allHeroSoulPrintProVal,specialSoulPrintProVal = CalculateSoulPrintAddVal(curHeroData.dynamicId) + local singleHeroSoulPrintProVal, lvSoulPrintProVal, allHeroSoulPrintProVal, specialSoulPrintProVal = + CalculateSoulPrintAddVal(curHeroData.dynamicId) LogRed_Prop("法术单体加成") LogRedTable_Prop(singleHeroSoulPrintProVal) LogRed_Prop("法术100+加成") @@ -2270,19 +2282,20 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt LogRedTable_Prop(allHeroSoulPrintProVal) LogRed_Prop("法术特殊加成") LogRedTable_Prop(specialSoulPrintProVal) - local allSoulPrintAddWarPowerVal = CalculateSoulPrintAddVal2(curHeroData.dynamicId) - LogRed_Prop("法术战斗力加成 "..allSoulPrintAddWarPowerVal) + local allSoulPrintAddWarPowerVal = CalculateSoulPrintAddVal2(curHeroData.dynamicId) + LogRed_Prop("法术战斗力加成 " .. allSoulPrintAddWarPowerVal) --宝器加成 宝器本身属性 + 宝器激活的强化共鸣 和 精炼共鸣 local equipTreasureAddPro = CalculateEquipTreaSureAddVal(curHeroData.dynamicId) LogRed_Prop("宝器加成") LogRedTable_Prop(equipTreasureAddPro) --玩家称号 皮肤 坐骑属性加成 - local playerDcorateAdd = PlayerManager.CalculatePlayerDcorateProAddVal() + local playerDcorateAdd = PlayerManager.CalculatePlayerDcorateProAddVal() LogRed_Prop("玩家称号 皮肤 坐骑属性加成") LogRedTable_Prop(playerDcorateAdd) --编队光环加成 - local teamAddPro = FormationManager.GetCurFormationElementAddByType(FormationTypeDef.FORMATION_NORMAL, curHeroData.dynamicId) + local teamAddPro = FormationManager.GetCurFormationElementAddByType(FormationTypeDef.FORMATION_NORMAL, + curHeroData.dynamicId) LogRed_Prop("编队光环加成") LogRedTable_Prop(teamAddPro) -- Vip加成 暂时注释 @@ -2293,7 +2306,7 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt local heroSkinSingleProVal, heroSkinAllHeroProVal = HeroSkinManager.CaculateSkinProVal(curHeroData) this.DoubleTableCompound(allAddProVal, heroSkinSingleProVal) this.DoubleTableCompound(allAddProVal, heroSkinAllHeroProVal) - + --灵兽 现在只在编队战力中计算 因为单个英雄可以上多个编队 local pokemonFormationAllHeroProVal = {} if formationId then @@ -2321,7 +2334,7 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt LogRed_Prop("灵兽羁绊 最终 加成 ") LogRedTable_Prop(pokemonFetterAddPro) --神兵羁绊 - local weaponFetterAddPro=GodWeaponManager.GetAllWeaponFetterAddPros() + local weaponFetterAddPro = GodWeaponManager.GetAllWeaponFetterAddPros() LogRed_Prop("神兵羁绊 最终 加成 ") LogRedTable_Prop(weaponFetterAddPro) --神将羁绊 @@ -2347,14 +2360,14 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt LogRed_Prop("修行加成") LogRedTable_Prop(practiceAddPro) --法相属性加成 - local faXiangAddPro=FaXiangManager.CalculateAllFaXiangAddPro(curHeroData) + local faXiangAddPro = FaXiangManager.CalculateAllFaXiangAddPro(curHeroData) --单体所有属性合并 this.DoubleTableCompound(allAddProVal, allPokemonPeiJianAddPro) this.DoubleTableCompound(allAddProVal, faXiangAddPro) this.DoubleTableCompound(allAddProVal, guildSkillAllProAdd) this.DoubleTableCompound(allAddProVal, fourQuaderAllProAdd) this.DoubleTableCompound(allAddProVal, falismanSingleHeroProVal) - this.DoubleTableCompound(allAddProVal,singleHeroSoulPrintProVal) + this.DoubleTableCompound(allAddProVal, singleHeroSoulPrintProVal) this.DoubleTableCompound(allAddProVal, playerDcorateAdd) this.DoubleTableCompound(allAddProVal, heroSkillSingleHeroProVal) this.DoubleTableCompound(allAddProVal, equipTreasureAddPro) @@ -2363,7 +2376,7 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt this.DoubleTableCompound(allAddProVal, heroSkinAllHeroProVal) --100等级所有属性合并 this.DoubleTableCompound(lvProVal, falismanLvProVal) - this.DoubleTableCompound(lvProVal,lvSoulPrintProVal) + this.DoubleTableCompound(lvProVal, lvSoulPrintProVal) this.DoubleTableCompound(lvProVal, heroSkillLvProVal) --团体所有属性合并 if not _isAllHeroProVal then @@ -2381,7 +2394,7 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt end --4公式特殊(减乘)所有属性加成 this.DoubleTableCompound(specialProVal, falismanSpecialProVal) - this.DoubleTableCompound(specialProVal,specialSoulPrintProVal) + this.DoubleTableCompound(specialProVal, specialSoulPrintProVal) this.DoubleTableCompound(specialProVal, heroSkillSpecialProVal) --100等级所有属性合并 local forNum = curLvNum - 100 @@ -2400,43 +2413,43 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt --allAddProVal[HeroProType.WarPower]=allEquipScore+CalculateWarForce( allAddProVal[HeroProType.Hp], allAddProVal[HeroProType.PhysicalDefence],allAddProVal[HeroProType.MagicDefence],allAddProVal[HeroProType.Attack],allAddProVal[HeroProType.CritFactor],allAddProVal[HeroProType.Hit],allAddProVal[HeroProType.Dodge],allAddProVal[HeroProType.DamageBocusFactor],allAddProVal[HeroProType.DamageReduceFactor],allAddProVal[HeroProType.Speed]) GrowProVal[HeroProType.Attack] = this.CalculateProVal( - curHeroData.attack, - curLvNum, - curHeroData.breakId, - curHeroData.upStarId, - HeroProType.Attack - ) + curHeroData.attack, + curLvNum, + curHeroData.breakId, + curHeroData.upStarId, + HeroProType.Attack + ) GrowProVal[HeroProType.Hp] = this.CalculateProVal(curHeroData.hp, curLvNum, curHeroData.breakId, curHeroData.upStarId, HeroProType.Hp) GrowProVal[HeroProType.PhysicalDefence] = this.CalculateProVal( - curHeroData.pDef, - curLvNum, - curHeroData.breakId, - curHeroData.upStarId, - HeroProType.PhysicalDefence - ) + curHeroData.pDef, + curLvNum, + curHeroData.breakId, + curHeroData.upStarId, + HeroProType.PhysicalDefence + ) GrowProVal[HeroProType.MagicDefence] = this.CalculateProVal( - curHeroData.mDef, - curLvNum, - curHeroData.breakId, - curHeroData.upStarId, - HeroProType.MagicDefence - ) + curHeroData.mDef, + curLvNum, + curHeroData.breakId, + curHeroData.upStarId, + HeroProType.MagicDefence + ) elseif _type == 2 then GrowProVal[HeroProType.Attack] = - this.CalculateProVal(curHeroData.attack, curLvNum, _breakId, _upStarId, HeroProType.Attack) + this.CalculateProVal(curHeroData.attack, curLvNum, _breakId, _upStarId, HeroProType.Attack) GrowProVal[HeroProType.Hp] = - this.CalculateProVal(curHeroData.hp, curLvNum, _breakId, _upStarId, HeroProType.Hp) + this.CalculateProVal(curHeroData.hp, curLvNum, _breakId, _upStarId, HeroProType.Hp) GrowProVal[HeroProType.PhysicalDefence] = this.CalculateProVal(curHeroData.pDef, curLvNum, _breakId, _upStarId, HeroProType.PhysicalDefence) GrowProVal[HeroProType.MagicDefence] = this.CalculateProVal(curHeroData.mDef, curLvNum, _breakId, _upStarId, HeroProType.MagicDefence) - --allAddProVal[HeroProType.Speed]=CalculateSpeedProVal(curHeroData.speed,_breakId,speedNum)+allAddProVal[HeroProType.Speed] - --allAddProVal[HeroProType.WarPower]=allEquipScore+CalculateWarForce( allAddProVal[HeroProType.Hp], allAddProVal[HeroProType.PhysicalDefence],allAddProVal[HeroProType.MagicDefence],allAddProVal[HeroProType.Attack],allAddProVal[HeroProType.CritFactor],allAddProVal[HeroProType.Hit],allAddProVal[HeroProType.Dodge],allAddProVal[HeroProType.DamageBocusFactor],allAddProVal[HeroProType.DamageReduceFactor],allAddProVal[HeroProType.Speed]) + --allAddProVal[HeroProType.Speed]=CalculateSpeedProVal(curHeroData.speed,_breakId,speedNum)+allAddProVal[HeroProType.Speed] + --allAddProVal[HeroProType.WarPower]=allEquipScore+CalculateWarForce( allAddProVal[HeroProType.Hp], allAddProVal[HeroProType.PhysicalDefence],allAddProVal[HeroProType.MagicDefence],allAddProVal[HeroProType.Attack],allAddProVal[HeroProType.CritFactor],allAddProVal[HeroProType.Hit],allAddProVal[HeroProType.Dodge],allAddProVal[HeroProType.DamageBocusFactor],allAddProVal[HeroProType.DamageReduceFactor],allAddProVal[HeroProType.Speed]) end - + LogRed_Prop("成长属性") LogRedTable_Prop(GrowProVal) this.DoubleTableCompound(allAddProVal, GrowProVal) @@ -2463,11 +2476,14 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt if curProConfig and allAddProVal[k] > 0 and curProConfig.TargetPropertyId > 0 then if k ~= 69 and k ~= 70 then allAddProVal[curProConfig.TargetPropertyId] = - propertyConfig[curProConfig.TargetPropertyId].Style == 1 and - math.floor(allAddProVal[curProConfig.TargetPropertyId] + allAddProVal[curProConfig.TargetPropertyId] * allAddProVal[k] / 10000) - or allAddProVal[curProConfig.TargetPropertyId] + allAddProVal[curProConfig.TargetPropertyId] * allAddProVal[k] / 10000 + propertyConfig[curProConfig.TargetPropertyId].Style == 1 and + math.floor(allAddProVal[curProConfig.TargetPropertyId] + + allAddProVal[curProConfig.TargetPropertyId] * allAddProVal[k] / 10000) + or allAddProVal[curProConfig.TargetPropertyId] + + allAddProVal[curProConfig.TargetPropertyId] * allAddProVal[k] / 10000 else - allAddProVal[curProConfig.TargetPropertyId] = allAddProVal[curProConfig.TargetPropertyId] + allAddProVal[k]/100 + allAddProVal[curProConfig.TargetPropertyId] = allAddProVal[curProConfig.TargetPropertyId] + + allAddProVal[k] / 100 end end --战斗里面 PropertyConfig里Style字段,2类型的统一需要除以100在战斗里面 @@ -2480,33 +2496,35 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt if curProConfig and allAddProVal[k] > 0 and isWar and curProConfig.IfFormula == 1 then allAddProVal[k] = math.floor(allAddProVal[k] * 0.1 / (curHeroData.lv + 10) / 10000) elseif curProConfig and allAddProVal[k] > 0 and isWar == false and curProConfig.IfFormula == 1 then - --allAddProVal[k]=math.floor(allAddProVal[k]*0.1/(curHeroData.lv+10)/100) + --allAddProVal[k]=math.floor(allAddProVal[k]*0.1/(curHeroData.lv+10)/100) end end LogRed_Prop("所有属性综合2") LogRedTable_Prop(allAddProVal) ---目前没有 王振兴加 最后计算个属性的乘减算 -if curHeroData.MLSproList and LengthOfTable(curHeroData.MLSproList)>0 then - for k, v in pairs(curHeroData.MLSproList) do - local mlsPro=curHeroData.MLSproList[k] - if allAddProVal[mlsPro.proId] then - local aaa=1-mlsPro.value - local value=math.floor(allAddProVal[mlsPro.proId] * (1-mlsPro.value)) - allAddProVal[mlsPro.proId]=value + --目前没有 王振兴加 最后计算个属性的乘减算 + if curHeroData.MLSproList and LengthOfTable(curHeroData.MLSproList) > 0 then + for k, v in pairs(curHeroData.MLSproList) do + local mlsPro = curHeroData.MLSproList[k] + if allAddProVal[mlsPro.proId] then + local aaa = 1 - mlsPro.value + local value = math.floor(allAddProVal[mlsPro.proId] * (1 - mlsPro.value)) + allAddProVal[mlsPro.proId] = value + end end end -end -curHeroData.MLSproList={} + curHeroData.MLSproList = {} --Log("allEquipScore "..allEquipScore) --最后计算英雄战斗力 if _type == 1 then --最后加魂印战力 加灵兽羁绊静态战力 allAddProVal[HeroProType.WarPower] = - allEquipScore + CalculateWarForce(allAddProVal) + allSoulPrintAddWarPowerVal-- + allPokemonFetterAddWarPowerVal + allEquipScore + CalculateWarForce(allAddProVal) + + allSoulPrintAddWarPowerVal -- + allPokemonFetterAddWarPowerVal elseif _type == 2 then allAddProVal[HeroProType.WarPower] = - allEquipScore + CalculateWarForce(allAddProVal) + allSoulPrintAddWarPowerVal-- + allPokemonFetterAddWarPowerVal - --最后加魂印战力 + allEquipScore + CalculateWarForce(allAddProVal) + + allSoulPrintAddWarPowerVal -- + allPokemonFetterAddWarPowerVal + --最后加魂印战力 end --for i, v in pairs(allAddProVal) do -- if v > 0 then @@ -2520,6 +2538,7 @@ curHeroData.MLSproList={} return allAddProVal end + function this.DoubleTableCompound(allProVal, addProVal) if addProVal and LengthOfTable(addProVal) > 0 then for k, v in pairs(addProVal) do @@ -2533,6 +2552,7 @@ function this.DoubleTableCompound(allProVal, addProVal) end end end + --计算英雄身上单个模块战斗力 --1 装备 2 异妖 3 戒灵 4 天赋树 5 魂印 6 法宝 7 英雄自身 function this.CalculateSingleModuleProPower(_type, _heroDid) @@ -2566,30 +2586,30 @@ function this.CalculateSingleModuleProPower(_type, _heroDid) local allAddProVal = {} allAddProVal[HeroProType.Attack] = this.CalculateProVal( - curHeroData.attack, - curLvNum, - curHeroData.breakId, - curHeroData.upStarId, - HeroProType.Attack - ) + curHeroData.attack, + curLvNum, + curHeroData.breakId, + curHeroData.upStarId, + HeroProType.Attack + ) allAddProVal[HeroProType.Hp] = this.CalculateProVal(curHeroData.hp, curLvNum, curHeroData.breakId, curHeroData.upStarId, HeroProType.Hp) allAddProVal[HeroProType.PhysicalDefence] = this.CalculateProVal( - curHeroData.pDef, - curLvNum, - curHeroData.breakId, - curHeroData.upStarId, - HeroProType.PhysicalDefence - ) + curHeroData.pDef, + curLvNum, + curHeroData.breakId, + curHeroData.upStarId, + HeroProType.PhysicalDefence + ) allAddProVal[HeroProType.MagicDefence] = this.CalculateProVal( - curHeroData.mDef, - curLvNum, - curHeroData.breakId, - curHeroData.upStarId, - HeroProType.MagicDefence - ) + curHeroData.mDef, + curLvNum, + curHeroData.breakId, + curHeroData.upStarId, + HeroProType.MagicDefence + ) --allAddProVal[HeroProType.Speed]=CalculateSpeedProVal(curHeroData.speed,curHeroData.breakId,speedNum) --if curHeroData.heroConfig.SecondaryFactor then -- for i = 1, #curHeroData.heroConfig.SecondaryFactor do @@ -2605,12 +2625,13 @@ function this.CalculateSingleModuleProPower(_type, _heroDid) end return 0 end + --计算英雄战斗属性 --目前一次顺序 >等级>生命>最大生命>攻击力>护甲>魔抗>速度>伤害加成系数(%)>伤害减免系数(%)>命中率(%)>闪避率(%)>暴击率(%)>暴击伤害系数(%)>治疗加成系数(%) -- >火系伤害加成系数(%)>火系伤害减免系数(%)>冰系伤害加成系数(%)>冰系伤害减免系数(%)>雷系伤害加成系数(%)>雷系伤害减免系数(%)>风系伤害加成系数(%) -- >风系伤害减免系数(%)>地系伤害加成系数(%)>地系伤害减免系数(%)>暗系伤害加成系数(%)>暗系伤害减免系数(%) function this.CalculateWarAllProVal(heroDid) - local allEquipAddProVal = HeroPropManager.GetHeroProp(heroDid)--HeroManager.CalculateHeroAllProValList(1, heroDid, true) + local allEquipAddProVal = HeroPropManager.GetHeroProp(heroDid) --HeroManager.CalculateHeroAllProValList(1, heroDid, true) local allProVal = {} --等级 table.insert(allProVal, 1, HeroManager.GetSingleHeroData(heroDid).lv) @@ -2674,6 +2695,7 @@ this.mapShotTimeItemData = {} function this.InitMapShotTimeHeroBagData(_mapHero) this.mapShotTimeItemData[#this.mapShotTimeItemData + 1] = _mapHero end + --通过职业筛选英雄 function this.GetHeroDataByProfession(_profession) local heros = {} @@ -2708,7 +2730,7 @@ function this.GetHeroDataByProperty(_property, _lvLimit) end --通过职业,阵营筛选英雄 -function this.GetHeroDataByPropertyAndProfession(_property, _profession,_star) +function this.GetHeroDataByPropertyAndProfession(_property, _profession, _star) local heros = {} local index = 1 for i, v in pairs(heroDatas) do @@ -2730,6 +2752,7 @@ function this.GetHeroDataByNatural(_natural) end return heros end + --检测单个英雄是否有可穿的法宝 function this.GetHeroIsUpTalisman(heroDid) if heroDatas[heroDid] then @@ -2753,14 +2776,14 @@ function this.GetHeroIsUpTalisman(heroDid) if GetAllTalismanData and #GetAllTalismanData > 0 then for i = 1, #GetAllTalismanData do if GetAllTalismanData[i].power > curTalismanData.power then - return {GetAllTalismanData[i]} + return { GetAllTalismanData[i] } end end end return {} else if GetAllTalismanData and #GetAllTalismanData > 0 then - return {GetAllTalismanData[1]} + return { GetAllTalismanData[1] } else return {} end @@ -2768,6 +2791,7 @@ function this.GetHeroIsUpTalisman(heroDid) end return {} end + --获取妖灵师技能最大等级 function this.GetHeroSkillMaxLevel(heroTId, type) local curHeroData = ConfigManager.GetConfigData(ConfigName.HeroConfig, heroTId) @@ -2812,6 +2836,7 @@ function this.GetReturnHeroDatas(_star) end return heros2 end + function this.GetCurHeroSidAndCurStarAllSkillDatas(sid, star) local allSkillDatas = {} local skillIndex = 1 @@ -2827,7 +2852,8 @@ function this.GetCurHeroSidAndCurStarAllSkillDatas(sid, star) end end end - local OpenPassiveSkillRules = star >= this.awakeNextStarIndex and curHeroConfig.Awaken or curHeroConfig.OpenPassiveSkillRules + local OpenPassiveSkillRules = star >= this.awakeNextStarIndex and curHeroConfig.Awaken or + curHeroConfig.OpenPassiveSkillRules if OpenPassiveSkillRules then for i = 1, #OpenPassiveSkillRules do if OpenPassiveSkillRules[i][1] == star then @@ -2842,22 +2868,22 @@ function this.GetCurHeroSidAndCurStarAllSkillDatas(sid, star) return allSkillDatas end -function this.GetCurHeroSidAndCurStarAllSkillDatas2(sid, star,star2) +function this.GetCurHeroSidAndCurStarAllSkillDatas2(sid, star, star2) local allSkillDatas = {} local skillIndex = 1 - local aaa=star + local aaa = star if star2 then - aaa=star2 + aaa = star2 end --LogError("aaa=="..aaa) local curHeroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, sid) - local heroRankUp = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.HeroRankupConfig,"Type",2,"OpenStar",aaa) + local heroRankUp = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.HeroRankupConfig, "Type", 2, "OpenStar", aaa) if curHeroConfig.OpenSkillRules then for i = 1, #curHeroConfig.OpenSkillRules do if curHeroConfig.OpenSkillRules[i][1] == aaa then local heroSkill = {} - heroSkill.isOpen=false - heroSkill.needStar=1 + heroSkill.isOpen = false + heroSkill.needStar = 1 heroSkill.skillId = curHeroConfig.OpenSkillRules[i][2] heroSkill.skillConfig = skillConfig[heroSkill.skillId] allSkillDatas[skillIndex] = heroSkill @@ -2865,38 +2891,38 @@ function this.GetCurHeroSidAndCurStarAllSkillDatas2(sid, star,star2) end end end - local OpenPassiveSkillRules = star >= this.awakeNextStarIndex and curHeroConfig.Awaken or curHeroConfig.OpenPassiveSkillRules + local OpenPassiveSkillRules = star >= this.awakeNextStarIndex and curHeroConfig.Awaken or + curHeroConfig.OpenPassiveSkillRules if OpenPassiveSkillRules and heroRankUp then - local list={} + local list = {} for i = 1, #OpenPassiveSkillRules do - if OpenPassiveSkillRules[i][1] <=heroRankUp.Id then + if OpenPassiveSkillRules[i][1] <= heroRankUp.Id then local heroSkill = {} heroSkill.skillId = OpenPassiveSkillRules[i][3] - local index=OpenPassiveSkillRules[i][2] + local index = OpenPassiveSkillRules[i][2] heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId] - if heroSkill.skillConfig and heroSkill.skillConfig.Icon and heroSkill.skillConfig.Icon~=0 then - if heroRankUpConfig[index].OpenStar>aaa then - heroSkill.isOpen=true + if heroSkill.skillConfig and heroSkill.skillConfig.Icon and heroSkill.skillConfig.Icon ~= 0 then + if heroRankUpConfig[index].OpenStar > aaa then + heroSkill.isOpen = true else - heroSkill.isOpen=false + heroSkill.isOpen = false end - heroSkill.needStar=heroRankUpConfig[index].OpenStar + heroSkill.needStar = heroRankUpConfig[index].OpenStar if list[index] then allSkillDatas[skillIndex] = heroSkill else allSkillDatas[skillIndex] = heroSkill skillIndex = skillIndex + 1 - list[index]=1 + list[index] = 1 end --LogError("index=="..index.." limitstar=="..heroRankUpConfig[index].OpenStar.." star=="..star) - end - end end end return allSkillDatas end + function this.GetCurHeroSkillDatasAndEquip(sid, star) local allSkillDatas = {} local skillIndex = 1 @@ -2915,15 +2941,15 @@ function this.GetCurHeroSkillDatasAndEquip(sid, star) --法宝 if curHeroConfig.EquipTalismana then local heroSkill = {} - local equip=curHeroConfig.EquipTalismana[2] - local equipConfig=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.EquipTalismana,"TalismanaId",equip,"Level",30) + local equip = curHeroConfig.EquipTalismana[2] + local equipConfig = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.EquipTalismana, "TalismanaId", equip, + "Level", 30) if equipConfig then heroSkill.skillId = equipConfig.OpenSkillRules[1] heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId] allSkillDatas[skillIndex] = heroSkill skillIndex = skillIndex + 1 end - end return allSkillDatas end @@ -2944,25 +2970,25 @@ function this.GetCurHeroAllSkillDatas(sid, star) end end end - - local passlist=curHeroConfig.OpenPassiveSkillRules + + local passlist = curHeroConfig.OpenPassiveSkillRules if passlist then - local ids={} - for i = 1, #passlist do - if passlist[i][2]==7 or passlist[i][2]==10 or passlist[i][2]==11 then - if not ids[passlist[i][2]] then - local heroSkill = {} - heroSkill.skillId = passlist[i][3] - heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId] - ids[passlist[i][2]]=1 - allSkillDatas[skillIndex] = heroSkill - skillIndex = skillIndex + 1 - end - end - end + local ids = {} + for i = 1, #passlist do + if passlist[i][2] == 7 or passlist[i][2] == 10 or passlist[i][2] == 11 then + if not ids[passlist[i][2]] then + local heroSkill = {} + heroSkill.skillId = passlist[i][3] + heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId] + ids[passlist[i][2]] = 1 + allSkillDatas[skillIndex] = heroSkill + skillIndex = skillIndex + 1 + end + end + end end - local OpenPassiveSkillRules = curHeroConfig.Awaken + local OpenPassiveSkillRules = curHeroConfig.Awaken if OpenPassiveSkillRules then for i = 1, #OpenPassiveSkillRules do if OpenPassiveSkillRules[i][2] == 27 then @@ -2994,33 +3020,29 @@ function this.GetCurHeroAllAwakeSkillDatas(sid, star) end end end - - local passlist=curHeroConfig.Awaken + + local passlist = curHeroConfig.Awaken if passlist then - local ids={} - for i = 1, #passlist do - if passlist[i][2]==7 or passlist[i][2]==10 or passlist[i][2]==11 or passlist[i][2]==27 then - if ids[passlist[i][2]]==nil then - ids[passlist[i][2]]=1 - local heroSkill = {} - heroSkill.skillId = passlist[i][3] - heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId] - allSkillDatas[skillIndex] = heroSkill - skillIndex = skillIndex + 1 - end - end - end + local ids = {} + for i = 1, #passlist do + if passlist[i][2] == 7 or passlist[i][2] == 10 or passlist[i][2] == 11 or passlist[i][2] == 27 then + if ids[passlist[i][2]] == nil then + ids[passlist[i][2]] = 1 + local heroSkill = {} + heroSkill.skillId = passlist[i][3] + heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId] + allSkillDatas[skillIndex] = heroSkill + skillIndex = skillIndex + 1 + end + end + end end return allSkillDatas end - - - function this.DetectionOpenFiveStarActivity(starUpGiftNum) -- Log(" ---- GameEvent.PatFace.PatFaceSend,14 ") PlayerManager.IsGetFiveStarHero = true - end -- 判断英雄是否有魂印功能 @@ -3035,6 +3057,7 @@ function this.IsHeroHaveSoulPrintFunc(heroId) end return false end + -- 判断英雄是否有法宝功能 function this.IsHeroHaveTalismanFunc(heroId) local unlock = ConfigManager.GetConfigData(ConfigName.GameSetting, 1).EquipTalismanaUnlock @@ -3059,6 +3082,7 @@ function this.GetFingTreasureAllHeroDatas() end return heros end + --回溯 和 献祭 返回item信息 local rewardGroup = ConfigManager.GetConfig(ConfigName.RewardGroup) function this.GetHeroReturnItems(selectHeroData, type) @@ -3075,50 +3099,51 @@ function this.GetHeroReturnItems(selectHeroData, type) end local pId if curHeroData.breakId == 0 then - pId=0 + pId = 0 else - pId= heroRankUpConfig[curHeroData.breakId].Phase[2] + pId = heroRankUpConfig[curHeroData.breakId].Phase[2] end local heroReturnConfig = ConfigManager.TryGetConfigDataByDoubleKey( - ConfigName.HeroReturn, - "HeroId", - curHeroData.id, - "Star", - pId - ) + ConfigName.HeroReturn, + "HeroId", + curHeroData.id, + "Star", + pId + ) local rewardShowStr1 = {} if not heroReturnConfig then - LogRed("pId:"..pId.." curHeroData.breakId:"..curHeroData.breakId.." curHeroData.id:"..curHeroData.id) + LogRed("pId:" .. + pId .. " curHeroData.breakId:" .. curHeroData.breakId .. " curHeroData.id:" .. curHeroData.id) else - ShowItemlist[heroReturnConfig.HeroId] = {heroReturnConfig.HeroId,1,curHeroData.star} - rewardShowStr1 = heroReturnConfig.RankupReturn - if rewardShowStr1 then - for k,v in ipairs(rewardShowStr1) do - if v[1] and v[2] then - if not ShowItemlist[v[1]] then - ShowItemlist[v[1]] = {v[1], v[2] * specificValue} - else - ShowItemlist[v[1]] = {v[1],ShowItemlist[v[1]][2] + v[2] * specificValue} + ShowItemlist[heroReturnConfig.HeroId] = { heroReturnConfig.HeroId, 1, curHeroData.star } + rewardShowStr1 = heroReturnConfig.RankupReturn + if rewardShowStr1 then + for k, v in ipairs(rewardShowStr1) do + if v[1] and v[2] then + if not ShowItemlist[v[1]] then + ShowItemlist[v[1]] = { v[1], v[2] * specificValue } + else + ShowItemlist[v[1]] = { v[1], ShowItemlist[v[1]][2] + v[2] * specificValue } + end end end end end - end rewardShowStr1 = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, v.lv).SumConsume if rewardShowStr1 then - for k,v in ipairs(rewardShowStr1) do + for k, v in ipairs(rewardShowStr1) do if not ShowItemlist[v[1]] then - ShowItemlist[v[1]] = {v[1], v[2] * specificValue} + ShowItemlist[v[1]] = { v[1], v[2] * specificValue } else - ShowItemlist[v[1]] = {v[1],ShowItemlist[v[1]][2] + v[2] * specificValue} + ShowItemlist[v[1]] = { v[1], ShowItemlist[v[1]][2] + v[2] * specificValue } end end end --this.GetHeroReturnItems2(ShowItemlist,allRewardData) end local dropList = {} - for n,m in pairs(ShowItemlist) do + for n, m in pairs(ShowItemlist) do local curReward = {} curReward.id = m[1] curReward.num = math.floor(m[2]) @@ -3128,7 +3153,6 @@ function this.GetHeroReturnItems(selectHeroData, type) end return dropList elseif type == GENERAL_POPUP_TYPE.ResolveDismantle then - --if type == GENERAL_POPUP_TYPE.ResolveDismantle or type== GENERAL_POPUP_TYPE.ResolveRecall then --献祭 local specificValue = tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig, 35).Value) / 10000 for i, v in pairs(selectHeroData) do @@ -3145,9 +3169,9 @@ function this.GetHeroReturnItems(selectHeroData, type) local pId if curHeroData.breakId == 0 then - pId=0 + pId = 0 else - pId= heroRankUpConfig[curHeroData.breakId].Phase[2] + pId = heroRankUpConfig[curHeroData.breakId].Phase[2] end if pId == 0 and curHeroData.upStarId == 0 then @@ -3156,33 +3180,37 @@ function this.GetHeroReturnItems(selectHeroData, type) local showItem = rewardGroup[rewardGroupId].ShowItem if showItem and LengthOfTable(showItem) > 0 then for i = 1, #showItem do - table.insert(ShowItemlist, {showItem[i][1], showItem[i][2]}) + table.insert(ShowItemlist, { showItem[i][1], showItem[i][2] }) end end end else if pId > 0 then - local heroRankUpConfig = ConfigManager.GetConfigDataByDoubleKey(ConfigName.HeroSacrifice,"Type",2,"Key",pId) + local heroRankUpConfig = ConfigManager.GetConfigDataByDoubleKey(ConfigName.HeroSacrifice, "Type", 2, + "Key", pId) if heroRankUpConfig then local sumConsume = heroRankUpConfig.Value for i = 1, #sumConsume do - table.insert(ShowItemlist, {sumConsume[i][1], sumConsume[i][2] * specificValue}) + table.insert(ShowItemlist, { sumConsume[i][1], sumConsume[i][2] * specificValue }) end else - LogRed("pId:"..pId.." curHeroData.breakId:"..curHeroData.breakId.." curHeroData.id:"..curHeroData.id) + LogRed("pId:" .. + pId .. " curHeroData.breakId:" .. curHeroData.breakId .. " curHeroData.id:" .. + curHeroData.id) end end if curHeroData.star > 1 then - local heroRankUpConfig = ConfigManager.GetConfigDataByDoubleKey(ConfigName.HeroSacrifice,"Type",1,"Key",curHeroData.star) + local heroRankUpConfig = ConfigManager.GetConfigDataByDoubleKey(ConfigName.HeroSacrifice, "Type", 1, + "Key", curHeroData.star) if heroRankUpConfig then local sumConsume = heroRankUpConfig.Value for i = 1, #sumConsume do - table.insert(ShowItemlist, {sumConsume[i][1], sumConsume[i][2] * specificValue}) + table.insert(ShowItemlist, { sumConsume[i][1], sumConsume[i][2] * specificValue }) end end else - LogRed("curHeroData.star :"..curHeroData.star) + LogRed("curHeroData.star :" .. curHeroData.star) end end local temp = {} @@ -3202,7 +3230,7 @@ function this.GetHeroReturnItems(selectHeroData, type) if rewardShowStr2 then for i = 1, #rewardShowStr2 do if rewardShowStr2[i] and rewardShowStr2[i][1] then - table.insert(ShowItemlist, {rewardShowStr2[i][1], rewardShowStr2[i][2] * specificValue}) + table.insert(ShowItemlist, { rewardShowStr2[i][1], rewardShowStr2[i][2] * specificValue }) end end end @@ -3246,16 +3274,17 @@ function this.GetHeroReturnItems(selectHeroData, type) if not curHeroData then return end - local pid = {} --配方id + local pid = {} --配方id for i = 1, #curHeroData.heroConfig.ReturnBook do if curHeroData.heroConfig.ReturnBook[i][1] == curHeroData.star then if not pid[curHeroData.heroConfig.ReturnBook[i][2]] then pid[curHeroData.heroConfig.ReturnBook[i][2]] = 0 end - pid[curHeroData.heroConfig.ReturnBook[i][2]] = pid[curHeroData.heroConfig.ReturnBook[i][2]] + curHeroData.heroConfig.ReturnBook[i][3] + pid[curHeroData.heroConfig.ReturnBook[i][2]] = pid[curHeroData.heroConfig.ReturnBook[i][2]] + + curHeroData.heroConfig.ReturnBook[i][3] end - end - for k,v in pairs(pid) do + end + for k, v in pairs(pid) do local tempRankConfig = heroRankUpGroup[k] if tempRankConfig.Issame == 1 then local curReward = {} @@ -3294,14 +3323,15 @@ function this.GetReturnItemsByType(selectHeroData) local curHeroData = heroDatas[i] local temp = {} if curHeroData.talismanList and curHeroData.talismanList > 1 then - local temp1 =tonumber(ConfigManager.GetConfigData(ConfigName.HeroConfig, curHeroData.id).EquipTalismana[2]) + local temp1 = tonumber(ConfigManager.GetConfigData(ConfigName.HeroConfig, curHeroData.id).EquipTalismana[2]) for i = 1, curHeroData.talismanList - 1 do - temp = ConfigManager.GetConfigDataByDoubleKey(ConfigName.EquipTalismana,"TalismanaId",temp1,"Level",i).RankupBasicMaterial - for i = 1,#temp do + temp = ConfigManager.GetConfigDataByDoubleKey(ConfigName.EquipTalismana, "TalismanaId", temp1, "Level", i) + .RankupBasicMaterial + for i = 1, #temp do if not ShowItemlist[temp[i][1]] then - ShowItemlist[temp[i][1]] = {temp[i][1], temp[i][2] * specificValue} + ShowItemlist[temp[i][1]] = { temp[i][1], temp[i][2] * specificValue } else - ShowItemlist[temp[i][1]] = {temp[i][1],ShowItemlist[temp[i][1]][2] + temp[i][2] * specificValue} + ShowItemlist[temp[i][1]] = { temp[i][1], ShowItemlist[temp[i][1]][2] + temp[i][2] * specificValue } end end end @@ -3340,10 +3370,12 @@ function this.UpdateSkillIdList(heroData) end end end + --更新英雄被动技能 function this.UpdatePassiveHeroSkill(heroData) heroData.passiveSkillList = {} --被动技 - local OpenPassiveSkillRules = heroData.star >= this.awakeNextStarIndex and heroData.heroConfig.Awaken or heroData.heroConfig.OpenPassiveSkillRules + 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 --突破 @@ -3364,17 +3396,19 @@ function this.UpdatePassiveHeroSkill(heroData) end end end + -----------新魂印开始 --增加魂印装备的英雄did function this.AddSoulPrintUpHeroDynamicId(heroDid, soulPrintSid, soulPrintPos) if heroDatas[heroDid] then - local singleSoulPrint = {equipId = soulPrintSid, position = soulPrintPos} + local singleSoulPrint = { equipId = soulPrintSid, position = soulPrintPos } table.insert(heroDatas[heroDid].soulPrintList, singleSoulPrint) SoulPrintManager.AddSoulPrintUpHeroDynamicId(soulPrintSid, heroDid) --设置战斗力脏数据 HeroPropManager.SetDirtyByType(heroDid, Hero_Prop_Type.SoulPrint) end end + --删除魂印装备的英雄did function this.DelSoulPrintUpHeroDynamicId(heroDid, soulPrintSid) if heroDatas[heroDid] then @@ -3388,53 +3422,55 @@ function this.DelSoulPrintUpHeroDynamicId(heroDid, soulPrintSid) end end end + ------------新魂印结束 --添加神印 function this.AddGodPrintUpHeroDynamicId(heroDid, soulPrintSid, soulPrintPos) if heroDatas[heroDid] then - local singleSoulPrint = {equipId = soulPrintSid, position = soulPrintPos} + local singleSoulPrint = { equipId = soulPrintSid, position = soulPrintPos } table.insert(heroDatas[heroDid].godPrintList, singleSoulPrint) GodPrintManager.AddSoulPrintUpHeroDynamicId(soulPrintSid, heroDid) --设置战斗力脏数据 HeroPropManager.SetDirtyByType(heroDid, Hero_Prop_Type.GodPrint) end end -function this.ChangeGodPrint(heroDId,_pos,printId) + +function this.ChangeGodPrint(heroDId, _pos, printId) if heroDatas[heroDId] and heroDatas[heroDId].godPrintList then - local gods=heroDatas[heroDId].godPrintList - for i = 1, #gods do - if gods[i].position==_pos then - gods[i].equipId=printId - end - end + local gods = heroDatas[heroDId].godPrintList + for i = 1, #gods do + if gods[i].position == _pos then + gods[i].equipId = printId + end + end end end -function this.ChangeGodPrint(heroDId,_pos,printId) +function this.ChangeGodPrint(heroDId, _pos, printId) if heroDatas[heroDId] and heroDatas[heroDId].godPrintList then - local gods=heroDatas[heroDId].godPrintList - for i = 1, #gods do - if gods[i].position==_pos then - gods[i].equipId=printId - end - end + local gods = heroDatas[heroDId].godPrintList + for i = 1, #gods do + if gods[i].position == _pos then + gods[i].equipId = printId + end + end end end + --根据id获取穿戴神印的位置 -function this.GetHeroGodPrintPosByID(heroDId,printId) +function this.GetHeroGodPrintPosByID(heroDId, printId) if heroDatas[heroDId] and heroDatas[heroDId].godPrintList then - local gods=heroDatas[heroDId].godPrintList - for i = 1, #gods do - if gods[i].equipId==printId then - return gods[i].position - end - end - return 0 + local gods = heroDatas[heroDId].godPrintList + for i = 1, #gods do + if gods[i].equipId == printId then + return gods[i].position + end + end + return 0 end end - --删除神印装备的英雄did function this.DelGodPrintUpHeroDynamicId(heroDid, soulPrintSid) if heroDatas[heroDid] then @@ -3449,7 +3485,6 @@ function this.DelGodPrintUpHeroDynamicId(heroDid, soulPrintSid) end end - --天赋技能(被动技能) function this.GetAllPassiveSkillIds(heroConfig, breakId, upStarId) local allPassiveSkillIds = {} @@ -3460,8 +3495,9 @@ function this.GetAllPassiveSkillIds(heroConfig, breakId, upStarId) local compoundNum = 0 local compoundOPenNum = 0 local OpenPassiveSkillRules = nil - OpenPassiveSkillRules =(upStarId and upStarId ~=0 and heroRankUpConfig[upStarId] and heroRankUpConfig[upStarId].OpenStar >= this.awakeNextStarIndex) and heroConfig.Awaken or heroConfig.OpenPassiveSkillRules - OpenPassiveSkillRules=GetPassiveByMaxStar(heroConfig,OpenPassiveSkillRules) + OpenPassiveSkillRules = (upStarId and upStarId ~= 0 and heroRankUpConfig[upStarId] and heroRankUpConfig[upStarId].OpenStar >= this.awakeNextStarIndex) and + heroConfig.Awaken or heroConfig.OpenPassiveSkillRules + OpenPassiveSkillRules = GetPassiveByMaxStar(heroConfig, OpenPassiveSkillRules) if OpenPassiveSkillRules then for i = 1, #OpenPassiveSkillRules do if OpenPassiveSkillRules[i][1] == 1 then --突破 @@ -3470,19 +3506,19 @@ function this.GetAllPassiveSkillIds(heroConfig, breakId, upStarId) table.insert(allPassiveSkillIds, OpenPassiveSkillRules[i][3]) if allOpenPassiveSkillIdcompound[OpenPassiveSkillRules[i][2]] then allOpenPassiveSkillIdcompound[OpenPassiveSkillRules[i][2]] = - allOpenPassiveSkillIdcompound[OpenPassiveSkillRules[i][2]] + 1 + allOpenPassiveSkillIdcompound[OpenPassiveSkillRules[i][2]] + 1 else allOpenPassiveSkillIdcompound[OpenPassiveSkillRules[i][2]] = 1 end end else --升星 allUpStarOpenData[heroRankUpConfig[OpenPassiveSkillRules[i][2]].Phase[2]] = - OpenPassiveSkillRules[i] + OpenPassiveSkillRules[i] if upStarId >= OpenPassiveSkillRules[i][2] then table.insert(allPassiveSkillIds, OpenPassiveSkillRules[i][3]) if allOpenPassiveSkillIdcompound[OpenPassiveSkillRules[i][2]] then allOpenPassiveSkillIdcompound[OpenPassiveSkillRules[i][2]] = - allOpenPassiveSkillIdcompound[OpenPassiveSkillRules[i][2]] + 1 + allOpenPassiveSkillIdcompound[OpenPassiveSkillRules[i][2]] + 1 else allOpenPassiveSkillIdcompound[OpenPassiveSkillRules[i][2]] = 1 end @@ -3490,7 +3526,7 @@ function this.GetAllPassiveSkillIds(heroConfig, breakId, upStarId) end if allPassiveSkillIdcompound[OpenPassiveSkillRules[i][2]] then allPassiveSkillIdcompound[OpenPassiveSkillRules[i][2]] = - allPassiveSkillIdcompound[OpenPassiveSkillRules[i][2]] + 1 + allPassiveSkillIdcompound[OpenPassiveSkillRules[i][2]] + 1 else allPassiveSkillIdcompound[OpenPassiveSkillRules[i][2]] = 1 end @@ -3509,6 +3545,7 @@ function this.GetAllPassiveSkillIds(heroConfig, breakId, upStarId) end return allPassiveSkillIds, compoundOPenNum, compoundNum, allUpStarOpenData end + --战中英雄被动技获取 function this.GetHeroAllPassiveSkillIds(curHeroData) local allPassiveSkillIds = {} @@ -3517,7 +3554,8 @@ function this.GetHeroAllPassiveSkillIds(curHeroData) end --英雄天赋被动技 if curHeroData.heroConfig.OpenPassiveSkillRules then - local openPassiveSkillRules = curHeroData.star >= this.awakeNextStarIndex and curHeroData.heroConfig.Awaken or curHeroData.heroConfig.OpenPassiveSkillRules + local openPassiveSkillRules = curHeroData.star >= this.awakeNextStarIndex and curHeroData.heroConfig.Awaken or + curHeroData.heroConfig.OpenPassiveSkillRules for i = 1, #openPassiveSkillRules do local skillType = openPassiveSkillRules[i][1] local skillRanUpId = openPassiveSkillRules[i][2] @@ -3539,12 +3577,12 @@ function this.GetHeroAllPassiveSkillIds(curHeroData) if curTalisman and curTalisman[2] then local talismanConFig = ConfigManager.GetConfigDataByDoubleKey( - ConfigName.EquipTalismana, - "TalismanaId", - curTalisman[2], - "Level", - curHeroData.talismanList - ) + ConfigName.EquipTalismana, + "TalismanaId", + curTalisman[2], + "Level", + curHeroData.talismanList + ) if talismanConFig then --当前法宝全部天赋数据(天赋可能为空) local dowerAllData = @@ -3579,6 +3617,7 @@ function this.GetHeroAllPassiveSkillIds(curHeroData) end return allPassiveSkillIds end + --获取当前类型英雄是否存在 function this.GetCurHeroIsHaveBySid(heroSId) for i, v in pairs(heroDatas) do @@ -3608,7 +3647,7 @@ function this.GetFormationHeroRedPoint() for i, v in pairs(teamHero) do local curHeroData = HeroManager.GetSingleHeroData(i) local isCanUpEquipTreasure - local config = ConfigManager.GetConfigData(ConfigName.SpecialConfig,40) + local config = ConfigManager.GetConfigData(ConfigName.SpecialConfig, 40) if config then local limits = string.split(config.Value, "|") if limits then @@ -3628,31 +3667,32 @@ function this.GetFormationHeroRedPoint() end if this.GetCurHeroUpLvOrUpStarSData(curHeroData) or this.LvUpBtnRedPoint(curHeroData) or - this.IsShowUpStarRedPoint(curHeroData) or - this.IsShowFlyUpRedPoint(curHeroData) or - #this.GetHeroIsUpEquip(curHeroData.dynamicId) > 0 or - this.GetIsShowSoulPrintRedPoint(curHeroData) or - this.GetIsShowTalismanRedPoint(curHeroData) or - this.GetIsShowGodPrintRedPoint(curHeroData) or - (isCanUpEquipTreasure and #HeroManager.GetHeroIsUpTreasure(curHeroData.dynamicId,0) > 0) or - HeroManager.CheckIsUpTreasure(curHeroData.jewels[1],0) or - HeroManager.CheckIsUpTreasure(curHeroData.jewels[2],0) or - GiftManager.CheckRoleRedPointById(curHeroData.dynamicId) or - HeroManager.CheckHeroPotencyRedPoint(curHeroData.dynamicId) or - GodSoulManager.CheckRedPointGodSoul(curHeroData) or - HeroManager.RefreshRedShow(curHeroData) + this.IsShowUpStarRedPoint(curHeroData) or + this.IsShowFlyUpRedPoint(curHeroData) or + #this.GetHeroIsUpEquip(curHeroData.dynamicId) > 0 or + this.GetIsShowSoulPrintRedPoint(curHeroData) or + this.GetIsShowTalismanRedPoint(curHeroData) or + this.GetIsShowGodPrintRedPoint(curHeroData) or + (isCanUpEquipTreasure and #HeroManager.GetHeroIsUpTreasure(curHeroData.dynamicId, 0) > 0) or + HeroManager.CheckIsUpTreasure(curHeroData.jewels[1], 0) or + HeroManager.CheckIsUpTreasure(curHeroData.jewels[2], 0) or + GiftManager.CheckRoleRedPointById(curHeroData.dynamicId) or + HeroManager.CheckHeroPotencyRedPoint(curHeroData.dynamicId) or + GodSoulManager.CheckRedPointGodSoul(curHeroData) or + HeroManager.RefreshRedShow(curHeroData) then return true end end return SacredTreeManager.CheckRedPoint() end + --化虚坛红点判断 function this.GetAllHeroCompoundRedPoint() if ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.COMPOUND_HERO) then for i, v in pairs(heroDatas) do - if v.star == 4 or v.star == 5 then - if this.IsShowUpStarRedPoint(v,true) then + if v.star == 4 or v.star == 5 then + if this.IsShowUpStarRedPoint(v, true) then return true end end @@ -3660,10 +3700,11 @@ function this.GetAllHeroCompoundRedPoint() end return false end + --单个英雄所有红点判断 function this.GetCurHeroIsShowRedPoint(curHeroData) local isCanUpEquipTreasure - local config = ConfigManager.GetConfigData(ConfigName.SpecialConfig,40) + local config = ConfigManager.GetConfigData(ConfigName.SpecialConfig, 40) if config then local limits = string.split(config.Value, "|") if limits then @@ -3687,16 +3728,17 @@ function this.GetCurHeroIsShowRedPoint(curHeroData) #this.GetHeroIsUpEquip(curHeroData.dynamicId) > 0 or this.GetIsShowSoulPrintRedPoint(curHeroData) or this.GetIsShowTalismanRedPoint(curHeroData) or - this.GetIsShowGodPrintRedPoint(curHeroData) or - (#this.GetHeroIsUpTreasure(curHeroData.dynamicId,0) > 0 and isCanUpEquipTreasure) or - HeroManager.CheckIsUpTreasure(curHeroData.jewels[1],0) or - HeroManager.CheckIsUpTreasure(curHeroData.jewels[2],0) or + this.GetIsShowGodPrintRedPoint(curHeroData) or + (#this.GetHeroIsUpTreasure(curHeroData.dynamicId, 0) > 0 and isCanUpEquipTreasure) or + HeroManager.CheckIsUpTreasure(curHeroData.jewels[1], 0) or + HeroManager.CheckIsUpTreasure(curHeroData.jewels[2], 0) or GodSoulManager.CheckRedPointGodSoul(curHeroData) or GiftManager.CheckRoleRedPointById(curHeroData.dynamicId) or HeroManager.CheckHeroPotencyRedPoint(curHeroData.dynamicId) or - HeroManager.IsShowFlyUpRedPoint(curHeroData) or + HeroManager.IsShowFlyUpRedPoint(curHeroData) or HeroManager.RefreshRedShow(curHeroData) end + --获取当前英雄的下一突破 和 升星 静态数据 function this.GetCurHeroUpLvOrUpStarSData(curHeroData) isHeroUpTuPo = false @@ -3704,8 +3746,8 @@ function this.GetCurHeroUpLvOrUpStarSData(curHeroData) upTuPoRankUpConfig = {} upStarRankUpConfig = {} for i, v in ConfigPairs(heroRankUpConfig) do - if v.Star == curHeroData.heroConfig.Star then --初始星级相等 - if v.Show == 1 then -- 1 突破 + if v.Star == curHeroData.heroConfig.Star then --初始星级相等 + if v.Show == 1 then -- 1 突破 if v.Id ~= curHeroData.breakId and curHeroData.lv == v.LimitLevel then --and curHeroData.star == v.LimitStar --Log("突破 "..v.Id) isHeroUpTuPo = true @@ -3722,18 +3764,20 @@ function this.GetCurHeroUpLvOrUpStarSData(curHeroData) end end end + --获取某一个星级的所有英雄 function this.GetAllNumStarData(star) local heros = {} local heros2 = FormationManager.GetAllFormationHeroId() for i, v in pairs(heroDatas) do - if v.star==star and heros2[i]==nil then - table.insert(heros, v) + if v.star == star and heros2[i] == nil then + table.insert(heros, v) end end - + return heros end + --单个英雄升级红点 function this.LvUpBtnRedPoint(curHeroData) HeroManager.GetCurHeroUpLvOrUpStarSData(curHeroData) @@ -3759,14 +3803,13 @@ function this.LvUpBtnRedPoint(curHeroData) --如果此时需要进阶 每次都要跳转 if isHeroUpStar and upStarRankUpConfig and curTuPoRankUpConfig and curTuPoRankUpConfig.JudgeClass == 1 and - curHeroData.lv >= curTuPoRankUpConfig.OpenLevel - then --当前突破全部完成 + curHeroData.lv >= curTuPoRankUpConfig.OpenLevel + then --当前突破全部完成 if curStarRankUpConfig then --进阶过处理 if curHeroData.lv == curStarRankUpConfig.OpenLevel then return false else if isUpLvMaterials and (not HarmonyManager.IsChangeColor(curHeroData.dynamicId)) then - return true else return false @@ -3777,7 +3820,6 @@ function this.LvUpBtnRedPoint(curHeroData) end else if isUpLvMaterials and (not HarmonyManager.IsChangeColor(curHeroData.dynamicId)) then - return true else return false @@ -3785,15 +3827,16 @@ function this.LvUpBtnRedPoint(curHeroData) end return false end + --单个英雄升星红点 -function this.IsShowUpStarRedPoint(curHeroData,isNoDeleFormation)--isNoDeleFormation 可选传参数 材料筛选是否去除上阵英雄 +function this.IsShowUpStarRedPoint(curHeroData, isNoDeleFormation) --isNoDeleFormation 可选传参数 材料筛选是否去除上阵英雄 HeroManager.GetCurHeroUpLvOrUpStarSData(curHeroData) -- if curHeroData.lv >= HeroManager.heroLvEnd[curHeroData.heroConfig.Id] then -- return false -- --培养已满 -- end - local curUpStarData= HeroManager.GetHeroCurUpStarInfo(curHeroData.dynamicId) - if curUpStarData and #curUpStarData>0 then + local curUpStarData = HeroManager.GetHeroCurUpStarInfo(curHeroData.dynamicId) + if curUpStarData and #curUpStarData > 0 then else --培养已满 return false @@ -3801,14 +3844,14 @@ function this.IsShowUpStarRedPoint(curHeroData,isNoDeleFormation)--isNoDeleForma if upStarRankUpConfig and upStarRankUpConfig.LimitLevel then if curHeroData.lv < upStarRankUpConfig.LimitLevel then return false - --等级不够 + --等级不够 end else --不能升星 return false end - if upStarRankUpConfig and HarmonyManager.GetSingleAdditions(HarmonyAddType.AddLv) < upStarRankUpConfig.LimitHongmengLevel then -- 鸿蒙阵神将共鸣等级 + if upStarRankUpConfig and HarmonyManager.GetSingleAdditions(HarmonyAddType.AddLv) < upStarRankUpConfig.LimitHongmengLevel then -- 鸿蒙阵神将共鸣等级 return false end @@ -3818,7 +3861,7 @@ function this.IsShowUpStarRedPoint(curHeroData,isNoDeleFormation)--isNoDeleForma if ConsumeMaterial[i][2] > 0 then if BagManager.GetItemCountById(ConsumeMaterial[i][1]) < ConsumeMaterial[i][2] then return false - --材料不足 + --材料不足 end end end @@ -3841,9 +3884,9 @@ function this.IsShowUpStarRedPoint(curHeroData,isNoDeleFormation)--isNoDeleForma #curSelectHeroList < curSelectUpStarData.upStarData[4] and not upStarConsumeMaterial[upStarHeroListData.heroList[j].dynamicId] and not HarmonyManager.IsChangeColor(upStarHeroListData.heroList[j].dynamicId) and - not (HarmonyManager:IsEnvoy(upStarHeroListData.heroList[j].dynamicId) and HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv) and HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv).heroTid == 0)) - or upStarHeroListData.heroList[j].type == RoleUpStarMatType.item - then + not (HarmonyManager:IsEnvoy(upStarHeroListData.heroList[j].dynamicId) and HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv) and HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv).heroTid == 0)) + or upStarHeroListData.heroList[j].type == RoleUpStarMatType.item + then table.insert(curSelectHeroList, upStarHeroListData.heroList[j]) end end @@ -3853,7 +3896,7 @@ function this.IsShowUpStarRedPoint(curHeroData,isNoDeleFormation)--isNoDeleForma for _i, v in pairs(curSelectHeroList) do if v.dynamicId then upStarConsumeMaterial[v.dynamicId] = v.dynamicId - end + end end end --end @@ -3868,31 +3911,29 @@ function this.IsShowUpStarRedPoint(curHeroData,isNoDeleFormation)--isNoDeleForma return true end - - --单个英雄升星红点 -function this.IsShowFlyUpRedPoint(curHeroData,isNoDeleFormation)--isNoDeleFormation 可选传参数 材料筛选是否去除上阵英雄 +function this.IsShowFlyUpRedPoint(curHeroData, isNoDeleFormation) --isNoDeleFormation 可选传参数 材料筛选是否去除上阵英雄 HeroManager.GetCurHeroUpLvOrUpStarSData(curHeroData) -- if curHeroData.lv >= HeroManager.heroLvEnd[curHeroData.heroConfig.Id] then -- return false -- --培养已满 -- end - local curUpStarData= HeroManager.GetHeroCurUpStarInfo(curHeroData.dynamicId) + local curUpStarData = HeroManager.GetHeroCurUpStarInfo(curHeroData.dynamicId) - local upStarRankUpConfig = nil + local upStarRankUpConfig = nil local heroRankUpConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig) for i, v in ConfigPairs(heroRankUpConfig) do - if v.Star==curHeroData.heroConfig.Star then--初始星级相等 - if v.Show==2 then -- 2 升星 - if v.Id ~= curHeroData.upStarId and curHeroData.star == v.LimitStar then + if v.Star == curHeroData.heroConfig.Star then --初始星级相等 + if v.Show == 2 then -- 2 升星 + if v.Id ~= curHeroData.upStarId and curHeroData.star == v.LimitStar then --Log("升星 "..v.Id) - upStarRankUpConfig=v + upStarRankUpConfig = v end end end end - if curUpStarData and #curUpStarData>0 then + if curUpStarData and #curUpStarData > 0 then else --培养已满 return false @@ -3900,7 +3941,7 @@ function this.IsShowFlyUpRedPoint(curHeroData,isNoDeleFormation)--isNoDeleFormat if upStarRankUpConfig and upStarRankUpConfig.LimitLevel then if curHeroData.lv < upStarRankUpConfig.LimitLevel then return false - --等级不够 + --等级不够 end else --不能升星 @@ -3915,7 +3956,7 @@ function this.IsShowFlyUpRedPoint(curHeroData,isNoDeleFormation)--isNoDeleFormat if ConsumeMaterial[i][2] > 0 then if BagManager.GetItemCountById(ConsumeMaterial[i][1]) < ConsumeMaterial[i][2] then return false - --材料不足 + --材料不足 end end end @@ -3927,14 +3968,15 @@ function this.IsShowFlyUpRedPoint(curHeroData,isNoDeleFormation)--isNoDeleFormat for i = 1, #curUpStarData do local curSelectUpStarData = curUpStarData[i] upStarMaterialIsAll[curSelectUpStarData.upStarData[2]] = 2 - if curSelectUpStarData.upStarMaterialsData.Id==184 then - local itemId=curSelectUpStarData.upStarMaterialsData.IsId - local num=curSelectUpStarData.upStarData[4] - if BagManager.GetItemCountById(itemId)>=num then + if curSelectUpStarData.upStarMaterialsData.Id == 184 then + local itemId = curSelectUpStarData.upStarMaterialsData.IsId + local num = curSelectUpStarData.upStarData[4] + if BagManager.GetItemCountById(itemId) >= num then upStarMaterialIsAll[curSelectUpStarData.upStarData[2]] = 1 - end + end else - local upStarHeroListData =HeroManager.GetUpStarHeroListData(curSelectUpStarData.upStarMaterialsData.Id, curHeroData) + local upStarHeroListData = HeroManager.GetUpStarHeroListData(curSelectUpStarData.upStarMaterialsData.Id, + curHeroData) local curSelectHeroList = {} if #upStarHeroListData.heroList >= curSelectUpStarData.upStarData[4] then for j = 1, #upStarHeroListData.heroList do @@ -3943,9 +3985,9 @@ function this.IsShowFlyUpRedPoint(curHeroData,isNoDeleFormation)--isNoDeleFormat #curSelectHeroList < curSelectUpStarData.upStarData[4] and not upStarConsumeMaterial[upStarHeroListData.heroList[j].dynamicId] and not HarmonyManager.IsChangeColor(upStarHeroListData.heroList[j].dynamicId) and - not (HarmonyManager:IsEnvoy(upStarHeroListData.heroList[j].dynamicId) and HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv) and HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv).heroTid == 0)) - or upStarHeroListData.heroList[j].type == RoleUpStarMatType.item - then + not (HarmonyManager:IsEnvoy(upStarHeroListData.heroList[j].dynamicId) and HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv) and HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv).heroTid == 0)) + or upStarHeroListData.heroList[j].type == RoleUpStarMatType.item + then table.insert(curSelectHeroList, upStarHeroListData.heroList[j]) end end @@ -3955,11 +3997,10 @@ function this.IsShowFlyUpRedPoint(curHeroData,isNoDeleFormation)--isNoDeleFormat for _i, v in pairs(curSelectHeroList) do if v.dynamicId then upStarConsumeMaterial[v.dynamicId] = v.dynamicId - end + end end end end - end end -- 消耗位置材料状态 @@ -3971,11 +4012,6 @@ function this.IsShowFlyUpRedPoint(curHeroData,isNoDeleFormation)--isNoDeleFormat return true end - - - - - --单个英雄装备红点 --检测单个英雄是否有可穿的装备 function this.GetHeroIsUpEquip(heroDid) if heroDatas[heroDid] then @@ -3993,12 +4029,12 @@ function this.GetHeroIsUpEquip(heroDid) if heroData.equipIdList and #heroData.equipIdList > 0 then for i = 1, #heroData.equipIdList do if not heroData.equipIdList[i] then - + else local curEquipConFigData = EquipManager.GetSingleHeroSingleEquipData(heroData.equipIdList[i], heroDid) if not curEquipConFigData then - LogBlue("-------------------------"..heroData.equipIdList[i] .. " " .. heroDid) + LogBlue("-------------------------" .. heroData.equipIdList[i] .. " " .. heroDid) else lackEquips[curEquipConFigData.equipConfig.Position].id = heroData.equipIdList[i] lackEquips[curEquipConFigData.equipConfig.Position].warPower = @@ -4022,7 +4058,7 @@ function this.GetHeroIsUpEquip(heroDid) lackEquips[pos].id = v.id lackEquips[pos].warPower = EquipManager.CalculateWarForce(v.id) else - local nextEquipWarPower = EquipManager.CalculateWarForce(v.id) + local nextEquipWarPower = EquipManager.CalculateWarForce(v.id) if nextEquipWarPower > lackEquips[pos].warPower then lackEquips[pos].id = v.id lackEquips[pos].warPower = EquipManager.CalculateWarForce(v.id) @@ -4054,8 +4090,9 @@ function this.GetHeroIsUpEquip(heroDid) end return {} end + --宝物 -function this.GetHeroIsUpTreasure(heroDid,pos) +function this.GetHeroIsUpTreasure(heroDid, pos) if heroDatas[heroDid] then local heroData = heroDatas[heroDid] local lackEquips = {} @@ -4075,7 +4112,7 @@ function this.GetHeroIsUpTreasure(heroDid,pos) local curEquipConFigData = EquipTreasureManager.GetSingleTreasureByIdDyn(heroData.jewels[i]) if not curEquipConFigData then - LogBlue("-------------------------"..heroData.jewels[i] .. " " .. heroDid) + LogBlue("-------------------------" .. heroData.jewels[i] .. " " .. heroDid) else lackEquips[curEquipConFigData.equipType].id = heroData.jewels[i] lackEquips[curEquipConFigData.equipType].warPower = @@ -4084,28 +4121,28 @@ function this.GetHeroIsUpTreasure(heroDid,pos) end end end - local pro=heroData.changeProId - if heroData.changeProId==5 then - pro=0 + local pro = heroData.changeProId + if heroData.changeProId == 5 then + pro = 0 end - local allEquipTreasures = EquipTreasureManager.GetAllTreasuresByLocation(pos,pro) + local allEquipTreasures = EquipTreasureManager.GetAllTreasuresByLocation(pos, pro) for k, v in ipairs(allEquipTreasures) do --比较战力 高战力的装备add - if lackEquips[v.equipType].id == "0" then + if lackEquips[v.equipType].id == "0" then + lackEquips[v.equipType].id = v.idDyn + lackEquips[v.equipType].warPower = EquipTreasureManager.CalculateWarForce(v.idDyn) + else + local nextEquipWarPower = EquipTreasureManager.CalculateWarForce(v.idDyn) + if nextEquipWarPower > lackEquips[v.equipType].warPower then lackEquips[v.equipType].id = v.idDyn lackEquips[v.equipType].warPower = EquipTreasureManager.CalculateWarForce(v.idDyn) - else - local nextEquipWarPower = EquipTreasureManager.CalculateWarForce(v.idDyn) - if nextEquipWarPower > lackEquips[v.equipType].warPower then - lackEquips[v.equipType].id = v.idDyn - lackEquips[v.equipType].warPower = EquipTreasureManager.CalculateWarForce(v.idDyn) - end end + end end --去掉与自己本身自带的重合装备 local allUpEquipDidTabs = {} - for k,v in pairs(lackEquips) do + for k, v in pairs(lackEquips) do if v.id ~= "0" then local isAdd = true for j = 1, #heroData.jewels do @@ -4126,9 +4163,6 @@ function this.GetHeroIsUpTreasure(heroDid,pos) return {} end - - - --单个英雄魂印红点 --获取魂印环形布局数据 didMaxLen最大槽位数量 didLen可装备槽位数量 didLv最大动态等级 maxLv配置最大等级 function this.GetSoulPrintLoopUIMaxData(_heroData) @@ -4139,19 +4173,19 @@ function this.GetSoulPrintLoopUIMaxData(_heroData) local maxLv = 0 for k, v in ConfigPairs(EquipSignSetting) do if v.OpenRules then - if v.OpenRules[1]==1 then + if v.OpenRules[1] == 1 then if PlayerManager.level >= v.OpenRules[2] then table.insert(_d, v.SlotPosition) end - elseif v.OpenRules[1]==2 then - if _heroData.star>=v.OpenRules[2] then + elseif v.OpenRules[1] == 2 then + if _heroData.star >= v.OpenRules[2] then table.insert(_d, v.SlotPosition) end end - maxLv=v.Id + maxLv = v.Id end end - + --当前动态最大等级 local didLv = 0 --最大槽位数量 @@ -4165,33 +4199,30 @@ function this.GetSoulPrintLoopUIMaxData(_heroData) end didLv = EquipSignSetting[didMaxLen].SlotPosition didLen = #_d - + return didMaxLen, didLen, didLv, maxLv end - --单个英雄魂印红点 --获取魂印环形布局数据 didMaxLen最大槽位数量 didLen可装备槽位数量 didLv最大动态等级 maxLv配置最大等级 function this.GetGodPrintLoopUIMaxData(star) local d = string.split(ConfigManager.GetConfigData(ConfigName.SpecialConfig, 149).Value, "#") - local allNum=0 - local openNum=0 + local allNum = 0 + local openNum = 0 if d then - allNum=#d - for i = 1, allNum do - local curStar=tonumber(d[i]) - if curStar<=star then - openNum=openNum+1 - end - end + allNum = #d + for i = 1, allNum do + local curStar = tonumber(d[i]) + if curStar <= star then + openNum = openNum + 1 + end + end end - return allNum,openNum + return allNum, openNum end - - function this.GetIsShowSoulPrintRedPoint(curHeroData) local soulPrintIsOpen = SoulPrintManager.GetSoulPrintIsOpen(curHeroData) if not soulPrintIsOpen then @@ -4209,10 +4240,10 @@ function this.GetIsShowSoulPrintRedPoint(curHeroData) end local allBagSoulPrintData = BagManager.GetBagItemDataByItemType(ItemBaseType.SoulPrint) for i = 1, #allBagSoulPrintData do - LogError("allBagSoulPrintData[i].id=="..allBagSoulPrintData[i].id) + LogError("allBagSoulPrintData[i].id==" .. allBagSoulPrintData[i].id) if not allUpSoulPrint[allBagSoulPrintData[i].id] and equipConfig[allBagSoulPrintData[i].id].Range[1] == 0 then return true - --有空位可以穿戴 + --有空位可以穿戴 end local isHaveCurHeroid = false for j = 1, #equipConfig[allBagSoulPrintData[i].id].Range do @@ -4223,7 +4254,7 @@ function this.GetIsShowSoulPrintRedPoint(curHeroData) end if not allUpSoulPrint[allBagSoulPrintData[i].id] and isHaveCurHeroid then return true - --有空位可以穿戴 + --有空位可以穿戴 end end return false @@ -4237,9 +4268,9 @@ function this.GetIsShowGodPrintRedPoint(curHeroData) if curHeroData.godPrintList and #curHeroData.godPrintList >= 3 then return false --空位置 已装满 end - local allNum,openNum=this.GetGodPrintLoopUIMaxData(curHeroData.star) + local allNum, openNum = this.GetGodPrintLoopUIMaxData(curHeroData.star) --LogError("openNum=="..openNum.." curHeroData.star=="..curHeroData.star) - if openNum~=0 and #curHeroData.godPrintList==openNum then + if openNum ~= 0 and #curHeroData.godPrintList == openNum then return false end local allUpSoulPrint = {} @@ -4251,31 +4282,31 @@ function this.GetIsShowGodPrintRedPoint(curHeroData) local allBagSoulPrintData = BagManager.GetBagItemDataByItemType(ItemBaseType.GodPrint) for i = 1, #allBagSoulPrintData do if not allUpSoulPrint[allBagSoulPrintData[i].id] then - return this.CheckHeroIsCanAddGodPrint(equipConfig[allBagSoulPrintData[i].id].ProfessionLimit,curHeroData) + return this.CheckHeroIsCanAddGodPrint(equipConfig[allBagSoulPrintData[i].id].ProfessionLimit, curHeroData) end - end return false end + --检测适用佩戴神将 -function this.CheckHeroIsCanAddGodPrint(index,herodata) - local isCan=false - if index==0 then - isCan=true - elseif index==1 then - isCan=herodata.heroConfig.Profession==1 - elseif index==2 then - isCan=herodata.heroConfig.Profession==2 - elseif index==3 then - isCan=herodata.heroConfig.Profession==3 - elseif index==4 then - isCan=herodata.heroConfig.Profession==4 - elseif index==5 then - isCan=herodata.heroConfig.Job==1 - elseif index==6 then - isCan=herodata.heroConfig.Job==2 - elseif index==7 then - isCan=(herodata.heroConfig.Profession==2 or herodata.heroConfig.Profession==3 ) +function this.CheckHeroIsCanAddGodPrint(index, herodata) + local isCan = false + if index == 0 then + isCan = true + elseif index == 1 then + isCan = herodata.heroConfig.Profession == 1 + elseif index == 2 then + isCan = herodata.heroConfig.Profession == 2 + elseif index == 3 then + isCan = herodata.heroConfig.Profession == 3 + elseif index == 4 then + isCan = herodata.heroConfig.Profession == 4 + elseif index == 5 then + isCan = herodata.heroConfig.Job == 1 + elseif index == 6 then + isCan = herodata.heroConfig.Job == 2 + elseif index == 7 then + isCan = (herodata.heroConfig.Profession == 2 or herodata.heroConfig.Profession == 3) end return isCan end @@ -4291,77 +4322,74 @@ function this.GetIsShowTalismanRedPoint(curHeroData) if not isOpen then LogError("++++++++++++++++++++++++++++++++++++++++++++++no open") return false - --功能未开启 + --功能未开启 end --如果英雄没装备法宝 - if curHeroData.baublesId==nil or curHeroData.baublesId=="" then - local list=FaLingManager.GetAllEquipDataNoBless() - if #list>0 then - LogError("有法宝可以穿戴----------------------------------------------") - return true - else - return false - end + if curHeroData.baublesId == nil or curHeroData.baublesId == "" then + local list = FaLingManager.GetAllEquipDataNoBless() + if #list > 0 then + LogError("有法宝可以穿戴----------------------------------------------") + return true + else + return false + end else - --如果有法宝 - local isStrong=FaLingManager.CheckEquipStrongRedPoint(curHeroData.baublesId) - if isStrong then - return true - end - local isBless=FaLingManager.CheckEquipBlessRedPoint(curHeroData.baublesId) - if isBless then - return true - end + --如果有法宝 + local isStrong = FaLingManager.CheckEquipStrongRedPoint(curHeroData.baublesId) + if isStrong then + return true + end + local isBless = FaLingManager.CheckEquipBlessRedPoint(curHeroData.baublesId) + if isBless then + return true + end end return false - - end --改变英雄礼物 -function this.ChangeHeroGift(_dyn,list) - if heroDatas[_dyn] then - heroDatas[_dyn].giftIds=list +function this.ChangeHeroGift(_dyn, list) + if heroDatas[_dyn] then + heroDatas[_dyn].giftIds = list for k, v in pairs(heroDatas[_dyn].potential) do - v.giftLv= GiftManager.GetHeroPotencyLvById(_dyn) + v.giftLv = GiftManager.GetHeroPotencyLvById(_dyn) end end end + --根据类型获取英雄潜能加成 -function this.GetHeroPotencyAddByType(_dyn,_type) - if heroDatas[_dyn] and heroDatas[_dyn].potential and heroDatas[_dyn].potential[_type] then - local poten=heroDatas[_dyn].potential[_type] - local allLv=poten.lv+poten.giftLv --+TianShuMiJuanManger.GetAddPotentialLV() +function this.GetHeroPotencyAddByType(_dyn, _type) + if heroDatas[_dyn] and heroDatas[_dyn].potential and heroDatas[_dyn].potential[_type] then + local poten = heroDatas[_dyn].potential[_type] + local allLv = poten.lv + poten.giftLv --+TianShuMiJuanManger.GetAddPotentialLV() --LogError("poten.lv====="..poten.lv.." poten.giftLv=="..poten.giftLv.." TianShuMiJuanManger.GetAddPotentialLV()=="..TianShuMiJuanManger.GetAddPotentialLV()) - local config=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.PotentialNew,"Type",_type,"Level",allLv) + local config = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.PotentialNew, "Type", _type, "Level", allLv) if config then - local pro=config.Attribute/10000 + local pro = config.Attribute / 10000 return pro end end return 0 end - -function this.GetHeroPotencyAddByTypeAndPotencyData(_data,_type) - if _data and _type and _data[_type] then - local aaa=_data[_type] - local allLv=aaa.lv+aaa.giftLv--+TianShuMiJuanManger.GetAddPotentialLV() - local config=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.PotentialNew,"Type",_type,"Level",allLv) +function this.GetHeroPotencyAddByTypeAndPotencyData(_data, _type) + if _data and _type and _data[_type] then + local aaa = _data[_type] + local allLv = aaa.lv + aaa.giftLv --+TianShuMiJuanManger.GetAddPotentialLV() + local config = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.PotentialNew, "Type", _type, "Level", allLv) if config then - local pro=config.Attribute/10000 + local pro = config.Attribute / 10000 return pro end end return 0 end - function this.ResetHero(dynamicloadId) if heroDatas[dynamicloadId] then heroDatas[dynamicloadId].lv = 1 heroDatas[dynamicloadId].breakId = 0 - heroDatas[dynamicloadId].warPower = HeroPowerManager.GetHeroPower(heroDatas[dynamicloadId].dynamicId) + heroDatas[dynamicloadId].warPower = HeroPowerManager.GetHeroPower(heroDatas[dynamicloadId].dynamicId) --this.CalculateHeroAllProValList(1, heroDatas[dynamicloadId].dynamicId, false)[HeroProType.WarPower] end FormationManager.ResolvDownBattleCurHeroId(dynamicloadId) @@ -4371,7 +4399,7 @@ function this.ResetHeroStar(dynamicloadId) if heroDatas[dynamicloadId] then heroDatas[dynamicloadId].star = 5 heroDatas[dynamicloadId].upStarId = 0 - heroDatas[dynamicloadId].warPower = HeroPowerManager.GetHeroPower(heroDatas[dynamicloadId].dynamicId) + heroDatas[dynamicloadId].warPower = HeroPowerManager.GetHeroPower(heroDatas[dynamicloadId].dynamicId) --this.CalculateHeroAllProValList(1, heroDatas[dynamicloadId].dynamicId, false)[HeroProType.WarPower] end end @@ -4383,7 +4411,7 @@ function this.ByCompoundHeroGetAllHeros() local text = "" for i, v in pairs(heroDatas) do text = "" - if v.star == 4 or v.star == 5 or v.star == 3 then--四星 五星 才能加 3星 是狗粮 + if v.star == 4 or v.star == 5 or v.star == 3 then --四星 五星 才能加 3星 是狗粮 for n, w in pairs(FormationManager.formationList) do for m = 1, #w.teamHeroInfos do if v.dynamicId == w.teamHeroInfos[m].heroId then @@ -4392,18 +4420,18 @@ function this.ByCompoundHeroGetAllHeros() if not text or text == "" then text = isFormationStr else - text = text .. "、"..isFormationStr - end + text = text .. "、" .. isFormationStr + end end end end end v.isFormation = text - table.insert(upSortHeroList,v) - table.insert(downSoryHeroList,v) + table.insert(upSortHeroList, v) + table.insert(downSoryHeroList, v) end end - table.sort(downSoryHeroList, function(a,b) + table.sort(downSoryHeroList, function(a, b) if a.star == b.star then if a.lv == b.lv then return a.heroConfig.Id < b.heroConfig.Id @@ -4414,7 +4442,7 @@ function this.ByCompoundHeroGetAllHeros() return a.star > b.star end end) - table.sort(upSortHeroList, function(a,b) + table.sort(upSortHeroList, function(a, b) if a.star == b.star then if a.lv == b.lv then return a.heroConfig.Id > b.heroConfig.Id @@ -4425,18 +4453,19 @@ function this.ByCompoundHeroGetAllHeros() return a.star < b.star end end) - return upSortHeroList,downSoryHeroList + return upSortHeroList, downSoryHeroList end + --神将置换 function this.ByReplaceHeroGetAllHeros() local sortHeroList = {} for i, v in pairs(heroDatas) do - if v.star == 4 or v.star == 5 then--四星 五星 + if v.star == 4 or v.star == 5 then --四星 五星 v.isFormation = "" - table.insert(sortHeroList,v) + table.insert(sortHeroList, v) end end - table.sort(sortHeroList, function(a,b) + table.sort(sortHeroList, function(a, b) if a.star == b.star then if a.lv == b.lv then return a.heroConfig.Id > b.heroConfig.Id @@ -4449,15 +4478,15 @@ function this.ByReplaceHeroGetAllHeros() end) return sortHeroList end + --修改神将changeId (1是增加/修改 0是恢复默认值0) -function this.ResetHeroChangeId(dynamicloadId,changeId) +function this.ResetHeroChangeId(dynamicloadId, changeId) if heroDatas[dynamicloadId] then if changeId then heroDatas[dynamicloadId].changeId = changeId else heroDatas[dynamicloadId].changeId = 0 end - end end @@ -4479,10 +4508,10 @@ function this.CheckRepeatTreasure(func) this._WearCount[jId] = this._WearCount[jId] + 1 -- 判断最终穿戴的人(根据战斗力判断) if not this._TreasureToTarget[jId] then - this._TreasureToTarget[jId] = {id = heroData.dynamicId, power = heroData.warPower} + this._TreasureToTarget[jId] = { id = heroData.dynamicId, power = heroData.warPower } end if this._TreasureToTarget[jId].power < heroData.warPower then - this._TreasureToTarget[jId] = {id = heroData.dynamicId, power = heroData.warPower} + this._TreasureToTarget[jId] = { id = heroData.dynamicId, power = heroData.warPower } end else -- 没有这件装备 @@ -4500,25 +4529,25 @@ end -- 卸下重复和没有的装备 function this.UnloadRepeatTreasure(func) - this._CheckIndex = this._CheckIndex + 1 + this._CheckIndex = this._CheckIndex + 1 if this._CheckIndex > #this.heroDataLists then if func then func() end - return + return end -- 计算需要卸载的装备 local unloadList = {} local heroData = this.heroDataLists[this._CheckIndex] if heroData and heroData.jewels and #heroData.jewels > 0 then for _, jId in ipairs(heroData.jewels) do - if this._NoTreasure[jId] == 1 -- 没有这件装备 - or this._WearCount[jId] > 1 then-- 重复 + if this._NoTreasure[jId] == 1 -- 没有这件装备 + or this._WearCount[jId] > 1 then -- 重复 table.insert(unloadList, jId) end end end -- 卸载 - if #unloadList > 0 then - NetManager.EquipUnLoadOptRequest(heroData.dynamicId, unloadList, 2, function () + if #unloadList > 0 then + NetManager.EquipUnLoadOptRequest(heroData.dynamicId, unloadList, 2, function() for i = 1, #unloadList do EquipTreasureManager.SetTreasureUpOrDown(unloadList[i], "") this.RemoveTreasure(heroData.dynamicId, unloadList[i]) @@ -4535,9 +4564,9 @@ function this.EquipRepeatTreasure(func) local _EquipIndex = 0 local _MaxIndex = 0 for jId, heroData in pairs(this._TreasureToTarget) do - if this._WearCount[jId] > 1 then -- 重复 + if this._WearCount[jId] > 1 then -- 重复 _MaxIndex = _MaxIndex + 1 - NetManager.EquipWearRequest(heroData.id, {jId}, 2, function () + NetManager.EquipWearRequest(heroData.id, { jId }, 2, function() _EquipIndex = _EquipIndex + 1 EquipTreasureManager.SetTreasureUpOrDown(jId, heroData.id) this.WearTreasure(heroData.id, jId) @@ -4559,7 +4588,7 @@ function this.WearTreasure(dId, jId, index) if index and index >= 1 and index <= 2 then table.remove(heroDatas[dId].jewels, index) table.insert(heroDatas[dId].jewels, index, jId) - return + return end if #heroDatas[dId].jewels < 2 then table.insert(heroDatas[dId].jewels, jId) @@ -4567,7 +4596,7 @@ function this.WearTreasure(dId, jId, index) end function this.RemoveTreasure(dId, jId) - local removeIndex + local removeIndex for i = 1, #heroDatas[dId].jewels do if heroDatas[dId].jewels[i] == jId then removeIndex = i @@ -4578,41 +4607,39 @@ function this.RemoveTreasure(dId, jId) end end - function this.ClearHeroAllJewels(did) if heroDatas[did] then - heroDatas[did].jewels={} + heroDatas[did].jewels = {} end end --根据界面数据加载动态立绘 function this.LoadHerolive(_heroData, _objPoint) --TODO:动态加载立绘 - local t=_heroData.painting - + local t = _heroData.painting + local testLive = poolManager:LoadLive(t, _objPoint.transform, - Vector3.one * _heroData.scale, Vector3.New(_heroData.position[1], _heroData.position[2], 0)) + Vector3.one * _heroData.scale, Vector3.New(_heroData.position[1], _heroData.position[2], 0)) local SkeletonGraphic = testLive:GetComponent("SkeletonGraphic") - local clip="idle" - + local clip = "idle" + local idle = function() SkeletonGraphic.AnimationState:SetAnimation(0, clip, true) end SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete + idle - poolManager:SetLiveClearCall(_heroData.live, testLive, function () + poolManager:SetLiveClearCall(_heroData.live, testLive, function() SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete - idle end) return testLive end - --根据界面数据加载动态立绘 function this.LoadHerolive1(data, _objPoint) --TODO:动态加载立绘 local testLive = poolManager:LoadLive(GetResourcePath(data.Painting), _objPoint.transform, - Vector3.one * data.Scale, Vector3.New(data.Position[1], data.Position[2], 0)) + Vector3.one * data.Scale, Vector3.New(data.Position[1], data.Position[2], 0)) local SkeletonGraphic = testLive:GetComponent("SkeletonGraphic") local idle = function() SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true) end SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete + idle - poolManager:SetLiveClearCall(GetResourcePath(data.Live), testLive, function () + poolManager:SetLiveClearCall(GetResourcePath(data.Live), testLive, function() SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete - idle end) return testLive @@ -4627,39 +4654,40 @@ function this.SortHeroDatas(_heroDatas) --上阵最优先,星级优先,同星级等级优先,同星级同等级按sortId排序。排序时降序排序。 table.sort(_heroDatas, function(a, b) if (teamHero[a.dynamicId] and teamHero[b.dynamicId]) or - (not teamHero[a.dynamicId] and not teamHero[b.dynamicId]) + (not teamHero[a.dynamicId] and not teamHero[b.dynamicId]) then - if a.heroConfig.Natural ==b.heroConfig.Natural then - local aGodLv = GodSoulManager.GetGodSoulLv(a.dynamicId) - local bGodLv = GodSoulManager.GetGodSoulLv(b.dynamicId) - if aGodLv == bGodLv then - if a.star == b.star then - if a.lv == b.lv then - return a.heroConfig.Id < b.heroConfig.Id - else - return a.lv > b.lv - end + if a.heroConfig.Natural == b.heroConfig.Natural then + local aGodLv = GodSoulManager.GetGodSoulLv(a.dynamicId) + local bGodLv = GodSoulManager.GetGodSoulLv(b.dynamicId) + if aGodLv == bGodLv then + if a.star == b.star then + if a.lv == b.lv then + return a.heroConfig.Id < b.heroConfig.Id else - return a.star > b.star + return a.lv > b.lv end else - return aGodLv > bGodLv + return a.star > b.star end else - return a.heroConfig.Natural > b.heroConfig.Natural + return aGodLv > bGodLv end + else + return a.heroConfig.Natural > b.heroConfig.Natural + end else return teamHero[a.dynamicId] and not teamHero[b.dynamicId] end end) end + --脱下皮肤 -function this.ChangeDownSkinId(heroSId,skinId) - for k,v in pairs(heroDatas) do +function this.ChangeDownSkinId(heroSId, skinId) + for k, v in pairs(heroDatas) do if v.id == heroSId and v.skinId == skinId then - NetManager.ChangeHeroSkin(v.dynamicId,0,function() end) + NetManager.ChangeHeroSkin(v.dynamicId, 0, function() end) v.skinId = 0 - v.skinConfig = heroConfig[v.id] + v.skinConfig = heroConfig[v.id] v.live = GetResourcePath(v.skinConfig.Live) v.painting = GetResourcePath(v.skinConfig.Painting) v.icon = GetResourcePath(v.skinConfig.Icon) @@ -4670,15 +4698,16 @@ function this.ChangeDownSkinId(heroSId,skinId) Game.GlobalEvent:DispatchEvent(GameEvent.Role.UpdateSkin) end -function this.GetAllHerosByStar(curStar) +function this.GetAllHerosByStar(curStar) local heros = {} for i, v in pairs(heroDatas) do if v.star == curStar then - table.insert(heros,v) + table.insert(heros, v) end end return heros end + --判断是否是十一星神将 function this.IsElevenStar(v) -- body @@ -4687,18 +4716,19 @@ function this.IsElevenStar(v) else return false end - end + --判断是否是十天赋神将 IsTenTalent function this.IsTenTalent(v) -- body --print(v," ")--,heroConfig[v].MaxRank) - if heroConfig[v].MaxRank >= this.awakeStarIndex then - return true - else + if heroConfig[v].MaxRank >= this.awakeStarIndex then + return true + else return false - end + end end + --套装新属性计算 --{{Star,{4#61#100}},{},{} local equipSuiteConfig = ConfigManager.GetConfig(ConfigName.EquipSuiteConfig) @@ -4708,8 +4738,8 @@ function this.GetCurHeroEquipSuitPros(equipIdList) for i = 1, #equipIdList do --套装加成 local curEquip = EquipManager.GetSingleEquipData(equipIdList[i]) - if equipSuiteConfig[curEquip.equipConfig.Star] then--有套装 - table.insert(curEquipLists,curEquip) + if equipSuiteConfig[curEquip.equipConfig.Star] then --有套装 + table.insert(curEquipLists, curEquip) end end @@ -4722,7 +4752,7 @@ function this.GetCurHeroEquipSuitPros(equipIdList) local configInfo = equipSuiteConfig[curEquipLists[i].equipConfig.Star] if configInfo and num > 1 then -- LogPink("curEquipLists[i].equipConfig.Star "..curEquipLists[i].equipConfig.Star.." "..num) - local curequipSuit = {configInfo.Id, configInfo.SuiteValue[num - 1]} + local curequipSuit = { configInfo.Id, configInfo.SuiteValue[num - 1] } table.insert(equipSuit, 1, curequipSuit) end num = num - 1 @@ -4732,6 +4762,7 @@ function this.GetCurHeroEquipSuitPros(equipIdList) -- end return equipSuit end + -- 获取白金套装属性 function this.GetCurHeroBaiJinEquipSuitPros(equipIdList) local equipSuit = {} @@ -4739,8 +4770,8 @@ function this.GetCurHeroBaiJinEquipSuitPros(equipIdList) for i = 1, #equipIdList do --套装加成 local curEquip = EquipManager.GetSingleEquipData(equipIdList[i]) - if equipSuiteConfig[curEquip.equipConfig.Star] then--有套装 - table.insert(curEquipLists,curEquip) + if equipSuiteConfig[curEquip.equipConfig.Star] then --有套装 + table.insert(curEquipLists, curEquip) end end @@ -4753,11 +4784,11 @@ function this.GetCurHeroBaiJinEquipSuitPros(equipIdList) local configInfo = equipSuiteConfig[curEquipLists[i].equipConfig.Star] if configInfo and configInfo.SuiteSkill then local len = #configInfo.SuiteSkill - for x = len , 1, -1 do + for x = len, 1, -1 do local skill = configInfo.SuiteSkill[x] if skill[1] == num then -- LogPink("curEquipLists[i].equipConfig.Star "..configInfo.Id.." "..num) - local curequipSuit = {configInfo.Id, skill} + local curequipSuit = { configInfo.Id, skill } table.insert(equipSuit, 1, curequipSuit) break end @@ -4770,6 +4801,7 @@ function this.GetCurHeroBaiJinEquipSuitPros(equipIdList) -- end return equipSuit end + --设置英雄皮肤脏数据 function this.SetHerosSkinWarPowerState() for i, v in pairs(heroDatas) do @@ -4780,11 +4812,11 @@ function this.SetHerosSkinWarPowerState() end end -function this.SetAllStarBreakIdData() +function this.SetAllStarBreakIdData() for key, configInfo in ConfigPairs(ConfigManager.GetConfig(ConfigName.HeroRankupConfig)) do if configInfo.Type == 1 then if curAllStarBreakIdData[configInfo.Star] then - curAllStarBreakIdData[configInfo.Star][configInfo.LimitLevel] = key + curAllStarBreakIdData[configInfo.Star][configInfo.LimitLevel] = key else curAllStarBreakIdData[configInfo.Star] = {} curAllStarBreakIdData[configInfo.Star][configInfo.LimitLevel] = key @@ -4792,9 +4824,10 @@ function this.SetAllStarBreakIdData() end end end -function this.GetAllStarBreakIdData(sid,lv) - local curHeroConFig = heroConfig[sid] - local endBreakId = 0 + +function this.GetAllStarBreakIdData(sid, lv) + local curHeroConFig = heroConfig[sid] + local endBreakId = 0 for key, value in pairs(curAllStarBreakIdData[curHeroConFig.Star]) do if lv > key and endBreakId < value then endBreakId = value @@ -4805,7 +4838,7 @@ end function this.UpdateSingleHeroWarPower(dynamicId) if dynamicId and heroDatas[dynamicId] then - HeroPropManager.SetHeroDirty(dynamicId)--SetDirtyByType(dynamicId, Hero_Prop_Type.Base) + HeroPropManager.SetHeroDirty(dynamicId) --SetDirtyByType(dynamicId, Hero_Prop_Type.Base) -- heroDatas[dynamicId].warPower = this.CalculateHeroAllProValList(1, dynamicId, false)[HeroProType.WarPower] -- LogGreen(heroDatas[dynamicId].heroConfig.ReadingName.." "..heroDatas[dynamicId].lv.." warPower ".. heroDatas[dynamicId].warPower) end @@ -4817,7 +4850,7 @@ function this.GetEquipedEquipList() for _, heroData in ipairs(this.heroDataLists) do for i = 1, #heroData.equipIdList do local data = heroData.equipIdList[i] - table.insert(EquipedEquipList,data) + table.insert(EquipedEquipList, data) end end return EquipedEquipList @@ -4841,29 +4874,31 @@ function this.GetHeroIdListByEquipId(_id) for i = 1, #heroData.equipIdList do if _id == tonumber(heroData.equipIdList[i]) then -- return heroData.name - table.insert(heroList,heroData.name) + table.insert(heroList, heroData.name) end end end return heroList end -function this.CheckIsUpTreasure(Did,index) +function this.CheckIsUpTreasure(Did, index) if not Did then return false end - local curEquipData = EquipTreasureManager.GetSingleEquipTreasreData(Did) or MonsterCampManager.GetSingleTreasureByIdDyn(Did) or ExpeditionManager.GetSingleTreasureByIdDyn(Did) or GoodFriendManager.GetSingleTreasureByIdDyn(Did) - local isMax,isMatEnough,items + local curEquipData = EquipTreasureManager.GetSingleEquipTreasreData(Did) or + MonsterCampManager.GetSingleTreasureByIdDyn(Did) or ExpeditionManager.GetSingleTreasureByIdDyn(Did) or + GoodFriendManager.GetSingleTreasureByIdDyn(Did) + local isMax, isMatEnough, items local indexType = curEquipData.equipType == 1 and HarmonyAddType.HunSoulPrint or HarmonyAddType.LingSoulPrint if index == 1 then isMax = curEquipData.lv == curEquipData.maxLv - items,isMatEnough = this.GetCostItems(curEquipData,curEquipData.strongConfig) - isMatEnough = isMatEnough and - --not (HarmonyManager.IsInfo(curEquipData.upHeroDid) and HarmonyManager.GetSingleAdditions(indexType) ~= -1) - not (HarmonyManager.IsInfo(curEquipData.upHeroDid)) + items, isMatEnough = this.GetCostItems(curEquipData, curEquipData.strongConfig) + isMatEnough = isMatEnough and + --not (HarmonyManager.IsInfo(curEquipData.upHeroDid) and HarmonyManager.GetSingleAdditions(indexType) ~= -1) + not (HarmonyManager.IsInfo(curEquipData.upHeroDid)) elseif index == 2 then isMax = curEquipData.refineLv == curEquipData.maxRefineLv - items,isMatEnough = this.GetCostItems(curEquipData,curEquipData.refineConfig) + items, isMatEnough = this.GetCostItems(curEquipData, curEquipData.refineConfig) elseif index == 3 then return false -- isMax=curEquipData.treeLv>=curEquipData.maxTreeLv @@ -4874,27 +4909,27 @@ function this.CheckIsUpTreasure(Did,index) -- isMatEnough=BagManager.GetItemCountById(lvUpCost[1])>=lvUpCost[2] else --红点修改 - isMax = (curEquipData.lv == curEquipData.maxLv) and (curEquipData.refineLv==curEquipData.maxRefineLv) --and (curEquipData.treeLv>=curEquipData.maxTreeLv) - items,isMatEnough = this.GetCostItems(curEquipData,curEquipData.refineConfig) + isMax = (curEquipData.lv == curEquipData.maxLv) and + (curEquipData.refineLv == curEquipData.maxRefineLv) --and (curEquipData.treeLv>=curEquipData.maxTreeLv) + items, isMatEnough = this.GetCostItems(curEquipData, curEquipData.refineConfig) if not isMatEnough then - items,isMatEnough = this.GetCostItems(curEquipData,curEquipData.strongConfig) + items, isMatEnough = this.GetCostItems(curEquipData, curEquipData.strongConfig) if not isMatEnough then - items,isMatEnough = this.GetHoodTreeUpCost(curEquipData.treeLv) + items, isMatEnough = this.GetHoodTreeUpCost(curEquipData.treeLv) isMatEnough = isMatEnough and not (HarmonyManager.IsInfo(curEquipData.upHeroDid)) end end end - local teamHero=FormationManager.GetWuJinFormationHeroIds(FormationTypeDef.FORMATION_NORMAL) + local teamHero = FormationManager.GetWuJinFormationHeroIds(FormationTypeDef.FORMATION_NORMAL) if not isMax and isMatEnough and teamHero[curEquipData.upHeroDid] then return true end return false end - --获取消耗物品数据 -function this.GetCostItems(curEquipData,_config) - if _config==nil then +function this.GetCostItems(curEquipData, _config) + if _config == nil then return end local config = _config @@ -4902,94 +4937,94 @@ function this.GetCostItems(curEquipData,_config) if exps == nil then return end - local items={} - for i = 1,#exps do - local id=exps[i][1] + local items = {} + for i = 1, #exps do + local id = exps[i][1] if itemConfig[id] then - local item={} - item.id=id - item.icon=GetResourcePath(itemConfig[id].ResourceID) - item.frame=GetQuantityImageByquality(itemConfig[id].Quantity) - item.haveNum=BagManager.GetItemCountById(id) - item.needNum=exps[i][2] - item.isEnough=item.haveNum>=item.needNum - items[i]=item + local item = {} + item.id = id + item.icon = GetResourcePath(itemConfig[id].ResourceID) + item.frame = GetQuantityImageByquality(itemConfig[id].Quantity) + item.haveNum = BagManager.GetItemCountById(id) + item.needNum = exps[i][2] + item.isEnough = item.haveNum >= item.needNum + items[i] = item end end if config.JewelExpend then for i = 1, #config.JewelExpend do - local id=config.JewelExpend[i] - local item={} + local id = config.JewelExpend[i] + local item = {} --同类型宝物 - local type=id[1] - if type==1 then - item.id=curEquipData.id - item.icon=curEquipData.icon - item.frame=curEquipData.frame - local equips,num=EquipTreasureManager.GetEnoughRefineTreasure(curEquipData.id,curEquipData.idDyn) + local type = id[1] + if type == 1 then + item.id = curEquipData.id + item.icon = curEquipData.icon + item.frame = curEquipData.frame + local equips, num = EquipTreasureManager.GetEnoughRefineTreasure(curEquipData.id, curEquipData.idDyn) if equips then - item.haveNum= num + item.haveNum = num else - item.haveNum=0 + item.haveNum = 0 end - item.needNum=id[2] - if item.haveNum>=item.needNum then - item.isEnough=true + item.needNum = id[2] + if item.haveNum >= item.needNum then + item.isEnough = true else - item.isEnough=false + item.isEnough = false end - items[#items+1]=item + items[#items + 1] = item else - item.id=type - local config=itemConfig[type] + item.id = type + local config = itemConfig[type] if config then - item.icon=GetResourcePath(config.ResourceID) - item.frame=GetQuantityImageByquality(config.Quantity) - local equips,num=EquipTreasureManager.GetEnoughRefineTreasure(type,curEquipData.idDyn) + item.icon = GetResourcePath(config.ResourceID) + item.frame = GetQuantityImageByquality(config.Quantity) + local equips, num = EquipTreasureManager.GetEnoughRefineTreasure(type, curEquipData.idDyn) if equips then - item.haveNum= num + item.haveNum = num else - item.haveNum=0 + item.haveNum = 0 end - item.needNum=id[2] - if item.haveNum>=item.needNum then - item.isEnough=true + item.needNum = id[2] + if item.haveNum >= item.needNum then + item.isEnough = true else - item.isEnough=false + item.isEnough = false end - items[#items+1]=item + items[#items + 1] = item end end end end local isEnough = true - for k,v in pairs(items) do + for k, v in pairs(items) do if not v.isEnough then isEnough = false break end end - return items,isEnough + return items, isEnough end ---获取装备神应等级消耗 function this.GetHoodTreeUpCost(_treeLv) - local items={} + local items = {} local isEnough = true - local treeLvConfig= ConfigManager.GetConfigData(ConfigName.GodHoodTreeLevel,_treeLv) + local treeLvConfig = ConfigManager.GetConfigData(ConfigName.GodHoodTreeLevel, _treeLv) if treeLvConfig.LvupCost then - local id=treeLvConfig.LvupCost[1] + local id = treeLvConfig.LvupCost[1] if itemConfig[id] then - local item={} - item.id=id - item.icon=GetResourcePath(itemConfig[id].ResourceID) - item.frame=GetQuantityImageByquality(itemConfig[id].Quantity) - item.haveNum=BagManager.GetItemCountById(id) - item.needNum=treeLvConfig.LvupCost[2] - item.isEnough=item.haveNum>=item.needNum - items[1]=item + local item = {} + item.id = id + item.icon = GetResourcePath(itemConfig[id].ResourceID) + item.frame = GetQuantityImageByquality(itemConfig[id].Quantity) + item.haveNum = BagManager.GetItemCountById(id) + item.needNum = treeLvConfig.LvupCost[2] + item.isEnough = item.haveNum >= item.needNum + items[1] = item end - for k,v in pairs(items) do + for k, v in pairs(items) do if not v.isEnough then isEnough = false break @@ -4998,7 +5033,7 @@ function this.GetHoodTreeUpCost(_treeLv) else isEnough = false end - return items,isEnough + return items, isEnough end function this.CalculatePvpBonusForShow(data) @@ -5019,10 +5054,10 @@ function this.InVersion(heroTid) end local con = heroConfig[heroTid] if not con or not con.Version then - return + return end local serverOpenTime = PlayerManager.GetServerOpenTime() - local openDay = math.ceil(math.max(0, GetTimeStamp() - serverOpenTime)/(60*60*24))--当前是开服第几天 + local openDay = math.ceil(math.max(0, GetTimeStamp() - serverOpenTime) / (60 * 60 * 24)) --当前是开服第几天 if openDay >= con.Version then return true end @@ -5034,88 +5069,92 @@ function this.ChipIdToHeroId(chipId) return this._ChipToHero[chipId] end end + --获取对应的属性描述 -function this.GetAttSingleText(id,value) +function this.GetAttSingleText(id, value) if propertyConfig[id].Style == 1 then - return propertyConfig[id].Info,string.format("+%s",value) + return propertyConfig[id].Info, string.format("+%s", value) elseif propertyConfig[id].Style == 2 then - return propertyConfig[id].Info,string.format("+%s",value).."%" + return propertyConfig[id].Info, string.format("+%s", value) .. "%" end end + --获取对应的特训属性 function this.GetHeroTrainingAddPro(_id) - local hero=nil - for i=1,#this.heroDataLists do - if this.heroDataLists[i].dynamicId==_id then - hero=this.heroDataLists[i] + local hero = nil + for i = 1, #this.heroDataLists do + if this.heroDataLists[i].dynamicId == _id then + hero = this.heroDataLists[i] end end if not hero then return nil end - local level=hero.HeroTraining.trainingLv - local trainData=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.Train,"HeroID",hero.heroConfig.Id,"Level",level) - if trainData==nil then + local level = hero.HeroTraining.trainingLv + local trainData = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.Train, "HeroID", hero.heroConfig.Id, "Level", + level) + if trainData == nil then return nil end - local trainingsetting=ConfigManager.GetAllConfigsDataByKey(ConfigName.TrainSetting,"PoolID",trainData.TrainSettingID) - local datas={} - for i=1,#trainingsetting do + local trainingsetting = ConfigManager.GetAllConfigsDataByKey(ConfigName.TrainSetting, "PoolID", + trainData.TrainSettingID) + local datas = {} + for i = 1, #trainingsetting do --LogError(trainingsetting[i].Level) - if trainingsetting[i].Level< level then - for j=1 ,#trainingsetting[i].AttackProperty do - local tAttack=trainingsetting[i].AttackProperty[j] + if trainingsetting[i].Level < level then + for j = 1, #trainingsetting[i].AttackProperty do + local tAttack = trainingsetting[i].AttackProperty[j] if not datas[tAttack[1]] then - datas[tAttack[1]]=tAttack[2] - else - datas[tAttack[1]]=datas[tAttack[1]]+tAttack[2] + datas[tAttack[1]] = tAttack[2] + else + datas[tAttack[1]] = datas[tAttack[1]] + tAttack[2] end end - for j=1 ,#trainingsetting[i].HpProperty do - local tAttack=trainingsetting[i].HpProperty[j] + for j = 1, #trainingsetting[i].HpProperty do + local tAttack = trainingsetting[i].HpProperty[j] if not datas[tAttack[1]] then - datas[tAttack[1]]=tAttack[2] - else - datas[tAttack[1]]=datas[tAttack[1]]+tAttack[2] + datas[tAttack[1]] = tAttack[2] + else + datas[tAttack[1]] = datas[tAttack[1]] + tAttack[2] end end - for j=1 ,#trainingsetting[i].PhProperty do - local tAttack=trainingsetting[i].PhProperty[j] + for j = 1, #trainingsetting[i].PhProperty do + local tAttack = trainingsetting[i].PhProperty[j] if not datas[tAttack[1]] then - datas[tAttack[1]]=tAttack[2] - else - datas[tAttack[1]]=datas[tAttack[1]]+tAttack[2] + datas[tAttack[1]] = tAttack[2] + else + datas[tAttack[1]] = datas[tAttack[1]] + tAttack[2] end end - elseif trainingsetting[i].Level==level then + elseif trainingsetting[i].Level == level then --LogError("trainfinfo"..hero.HeroTraining.attackExp..trainingsetting[i].TrainExp1 ) - if hero.HeroTraining.attackExp>=trainingsetting[i].TrainExp1 then - for j=1 ,#trainingsetting[i].AttackProperty do - local tAttack=trainingsetting[i].AttackProperty[j] + if hero.HeroTraining.attackExp >= trainingsetting[i].TrainExp1 then + for j = 1, #trainingsetting[i].AttackProperty do + local tAttack = trainingsetting[i].AttackProperty[j] if not datas[tAttack[1]] then - datas[tAttack[1]]=tAttack[2] - else - datas[tAttack[1]]=datas[tAttack[1]]+tAttack[2] + datas[tAttack[1]] = tAttack[2] + else + datas[tAttack[1]] = datas[tAttack[1]] + tAttack[2] end end end - if hero.HeroTraining.defenseExp>=trainingsetting[i].TrainExp2 then - for j=1 ,#trainingsetting[i].PhProperty do - local tAttack=trainingsetting[i].PhProperty[j] + if hero.HeroTraining.defenseExp >= trainingsetting[i].TrainExp2 then + for j = 1, #trainingsetting[i].PhProperty do + local tAttack = trainingsetting[i].PhProperty[j] if not datas[tAttack[1]] then - datas[tAttack[1]]=tAttack[2] - else - datas[tAttack[1]]=datas[tAttack[1]]+tAttack[2] + datas[tAttack[1]] = tAttack[2] + else + datas[tAttack[1]] = datas[tAttack[1]] + tAttack[2] end end end - if hero.HeroTraining.hpExp>=trainingsetting[i].TrainExp3 then - for j=1 ,#trainingsetting[i].HpProperty do - local tAttack=trainingsetting[i].HpProperty[j] + if hero.HeroTraining.hpExp >= trainingsetting[i].TrainExp3 then + for j = 1, #trainingsetting[i].HpProperty do + local tAttack = trainingsetting[i].HpProperty[j] if not datas[tAttack[1]] then - datas[tAttack[1]]=tAttack[2] - else - datas[tAttack[1]]=datas[tAttack[1]]+tAttack[2] + datas[tAttack[1]] = tAttack[2] + else + datas[tAttack[1]] = datas[tAttack[1]] + tAttack[2] end end end @@ -5123,150 +5162,159 @@ function this.GetHeroTrainingAddPro(_id) end return datas end + --判断是否能解锁特训技能 -function this.CheckTrainingCanLevelUp(heroData,trainingData) +function this.CheckTrainingCanLevelUp(heroData, trainingData) if not trainingData then return false end - local lock=false - local OtherCondition=trainingData.OtherCondition - local conditioncheckCount={} - if heroData.star>=trainingData.MyselfCondition then - lock=true + local lock = false + local OtherCondition = trainingData.OtherCondition + local conditioncheckCount = {} + if heroData.star >= trainingData.MyselfCondition then + lock = true end - if type(OtherCondition[1][1])== "userdata" then + if type(OtherCondition[1][1]) == "userdata" then return true end - for i=1,#OtherCondition do - local t=OtherCondition[i] - for j=1,#this.heroDataLists do - if this.heroDataLists[j].id==t[1] and this.heroDataLists[j].HeroTraining.trainingLv>=t[2] and #this.heroDataLists[j].HeroTraining.unlockIds >=t[3] then - if not conditioncheckCount[this.heroDataLists[j].id] then - conditioncheckCount[this.heroDataLists[j].id]=1 + for i = 1, #OtherCondition do + local t = OtherCondition[i] + for j = 1, #this.heroDataLists do + if this.heroDataLists[j].id == t[1] and this.heroDataLists[j].HeroTraining.trainingLv >= t[2] and #this.heroDataLists[j].HeroTraining.unlockIds >= t[3] then + if not conditioncheckCount[this.heroDataLists[j].id] then + conditioncheckCount[this.heroDataLists[j].id] = 1 end end end end - local count=0 + local count = 0 for k, v in pairs(conditioncheckCount) do - count=count+1 + count = count + 1 end - if count>=#OtherCondition then - lock=true + if count >= #OtherCondition then + lock = true else - lock=false + lock = false end return lock end --判断是否特训满了 function this.IsHeroTrainingMax(heroData) - local t=ConfigManager.TryGetAllConfigsDataByKey(ConfigName.Train,"HeroID",heroData.id) - if #t==0 then + local t = ConfigManager.TryGetAllConfigsDataByKey(ConfigName.Train, "HeroID", heroData.id) + if #t == 0 then return false end table.sort(t, function(a, b) return a.Level > b.Level -end) - if t[1].Level<=heroData.HeroTraining.trainingLv then + end) + if t[1].Level <= heroData.HeroTraining.trainingLv then return true end return false end + --礼物格子 function this.ReturnGiftCount() - local count=0 + local count = 0 if not CheckFunctionOpen(FUNCTION_OPEN_TYPE.Train) then - return count + return count end - for i=1,#this.heroDataLists do - local hero=this.heroDataLists[i] + for i = 1, #this.heroDataLists do + local hero = this.heroDataLists[i] if this.IsHeroTrainingMax(hero) then - count=count+1 + count = count + 1 end end - local specail=ConfigManager.TryGetConfigData(ConfigName.SpecialConfig,172) - if count>tonumber(specail.Value) then - count=tonumber(specail.Value) + local specail = ConfigManager.TryGetConfigData(ConfigName.SpecialConfig, 172) + if count > tonumber(specail.Value) then + count = tonumber(specail.Value) end return count end + function this.ReturnGiftAtt() - local count=0 + local count = 0 if not CheckFunctionOpen(FUNCTION_OPEN_TYPE.Train) then - return count + return count end - for i=1,#this.heroDataLists do - local hero=this.heroDataLists[i] + for i = 1, #this.heroDataLists do + local hero = this.heroDataLists[i] if this.IsHeroTrainingMax(hero) then - count=count+1 + count = count + 1 end end - local specail1=ConfigManager.TryGetConfigData(ConfigName.SpecialConfig,172) - if count>tonumber(specail1.Value) then - count=tonumber(specail1.Value) + local specail1 = ConfigManager.TryGetConfigData(ConfigName.SpecialConfig, 172) + if count > tonumber(specail1.Value) then + count = tonumber(specail1.Value) end - local specail2=ConfigManager.TryGetConfigData(ConfigName.SpecialConfig,171) + local specail2 = ConfigManager.TryGetConfigData(ConfigName.SpecialConfig, 171) if not specail2 then return 0 end - - return count*tonumber(specail2.Value)/10000 + + return count * tonumber(specail2.Value) / 10000 end + function this.ReturnGiftAtt() - local count=0 + local count = 0 if not CheckFunctionOpen(FUNCTION_OPEN_TYPE.Train) then - return count + return count end - for i=1,#this.heroDataLists do - local hero=this.heroDataLists[i] + for i = 1, #this.heroDataLists do + local hero = this.heroDataLists[i] if this.IsHeroTrainingMax(hero) then - count=count+1 + count = count + 1 end end - local specail1=ConfigManager.TryGetConfigData(ConfigName.SpecialConfig,172) - if count>tonumber(specail1.Value) then - count=tonumber(specail1.Value) + local specail1 = ConfigManager.TryGetConfigData(ConfigName.SpecialConfig, 172) + if count > tonumber(specail1.Value) then + count = tonumber(specail1.Value) end - local specail2=ConfigManager.TryGetConfigData(ConfigName.SpecialConfig,171) + local specail2 = ConfigManager.TryGetConfigData(ConfigName.SpecialConfig, 171) if not specail2 then return 0 end - - return count*tonumber(specail2.Value)/10000 + + return count * tonumber(specail2.Value) / 10000 end + function this.RefreshRedShow(curHeroData) - local isSHow=true + local isSHow = true if not CheckFunctionOpen(FUNCTION_OPEN_TYPE.Train) then - return false + return false end - local Training=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.Train,"HeroID",curHeroData.id,"Level",curHeroData.HeroTraining.trainingLv) + local Training = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.Train, "HeroID", curHeroData.id, "Level", + curHeroData.HeroTraining.trainingLv) if not Training then return false end - local TrainingSetting=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.TrainSetting,"PoolID",Training.TrainSettingID,"Level",curHeroData.HeroTraining.trainingLv) - if not TrainingSetting then + local TrainingSetting = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.TrainSetting, "PoolID", + Training.TrainSettingID, "Level", curHeroData.HeroTraining.trainingLv) + if not TrainingSetting then return false end - if (TrainingSetting.TrainExp1>curHeroData.HeroTraining.attackExp or TrainingSetting.TrainExp2>curHeroData.HeroTraining.defenseExp or TrainingSetting.TrainExp3>curHeroData.HeroTraining.hpExp ) then - isSHow=false + if (TrainingSetting.TrainExp1 > curHeroData.HeroTraining.attackExp or TrainingSetting.TrainExp2 > curHeroData.HeroTraining.defenseExp or TrainingSetting.TrainExp3 > curHeroData.HeroTraining.hpExp) then + isSHow = false end - + return isSHow end -function this.GetTrainingPasivvSkill(skillstar,heroConfig) - local PassSKillList={} - local tdata=ConfigManager.TryGetAllConfigsDataByKey(ConfigName.Train,"HeroID",heroConfig) - if not tdata then - return nil - end - local t=nil - for i=1, #tdata do + +function this.GetTrainingPasivvSkill(skillstar, heroConfig) + local PassSKillList = {} + local tdata = ConfigManager.TryGetAllConfigsDataByKey(ConfigName.Train, "HeroID", heroConfig) + if not tdata then + return nil + end + local t = nil + for i = 1, #tdata do if skillstar == tdata[i].PassiveSkillStar then - t=tdata[i] + t = tdata[i] end - end - - return t + end + + return t end -return this \ No newline at end of file + +return this