local Formation_Controller = {} local private = {} local PlayerHeroCounts = "PlayerHeroCounts" Formation_Controller.TempSelectedHeroId = nil function Formation_Controller.OnStartup() end function Formation_Controller.IsHeroInFormation(heroId) for i, v in ipairs(MDL.Formation.GetSlotHeroIds()) do if v == heroId then return true end end return false end function Formation_Controller.IsShowNewHero() local hasHero = MDL.HeroSelect.GetHasHeroCount() local oldCount = PersistentData.PlayerData:Get(PlayerHeroCounts,0) local slotsCount = MDL.Formation.GetSlotsCount() if hasHero > oldCount and hasHero > slotsCount then return true else return false end end function Formation_Controller.SetPlayerHeroCounts() PersistentData.PlayerData:Set(PlayerHeroCounts,MDL.HeroSelect.GetHasHeroCount(),true) end function Formation_Controller.SortFormationHeroOrder(a, b) local isALineUp = MDL.Player.HeroIsLineUp(a.ID) local isBLineUp = MDL.Player.HeroIsLineUp(b.ID) if isALineUp and isBLineUp then return MDL.HeroSelect.SortHeroOrderByHeroGs(a, b) elseif isALineUp then return true elseif isBLineUp then return false else return MDL.HeroSelect.SortHeroOrderByHeroGs(a, b) end end function Formation_Controller.IfHasHeroToChange() local heroList = MDL.HeroSelect.GetHasHeroList() for i, v in ipairs(heroList) do if not MDL.Player.HeroIsLineUp(v.heroId) then return true end end return false end return Formation_Controller