コード例 #1
0
        public CodexViewModel Load(UnitOfWork uow, WarframeItemUtilities itemUtils, ClaimsPrincipal user, CodexSection codexSection, int tabID)
        {
            CodexSection = codexSection;

            int?userID = null;

            if (user.Identity.IsAuthenticated)
            {
                userID = int.Parse(user.FindFirstValue(ClaimTypes.NameIdentifier));
            }

            CodexTabs = uow.GetRepo <CodexTabRepository>().GetByCodexSection(codexSection)
                        .OrderBy(x => x.SortingPriority).ThenBy(x => x.Name).ToList();

            CurrentCodexTab = CodexTabs.SingleOrDefault(x => x.ID == tabID);

            new EagerLoader(uow).Load(CodexTabs);

            WarframeItems = itemUtils
                            .GetByCategoryIDs(CurrentCodexTab.ItemCategory_Objects.Select(x => x.ID))
                            .OrderBy(x => x.Name).ToList();

            if (userID.HasValue)
            {
                ItemAcquisitions = uow.GetRepo <ItemAcquisitionRepository>().GetByUserID(userID.Value);
            }
            if (CodexSection == CodexSection.Fish)
            {
                var fish = uow.GetRepo <FishRepository>().GetAll();
                Fish = fish.Where(x => WarframeItems.Select(y => y.UniqueName).Contains(x.UniqueName)).ToDictionary(x => x.UniqueName);
            }
            return(this);
        }
コード例 #2
0
        public AdminIndexViewModel Load(UnitOfWork uow, WarframeItemUtilities itemUtilities, AppSettings appSettings)
        {
            List <WarframeItem> warframes = itemUtilities.GetByCategoryID(appSettings.WarframeItemCategoryID);

            // Warframe Release Dates
            foreach (WarframeItem warframe in warframes.Where(x => string.IsNullOrWhiteSpace(x.ReleaseDate)))
            {
                if (!DateTime.TryParse(warframe.ReleaseDate, out DateTime _))
                {
                    WarframesMissingReleaseDate.Add(warframe.Name);
                }
            }

            // Invasion Reward Names
            List <string> trackedData             = uow.GetRepo <TrackedDataRepository>().GetGroupedByType("InvasionRewards").Select(x => x.Data).ToList();
            List <string> existingInvasionRewards = uow.GetRepo <InvasionRewardRepository>().GetAll().Select(x => x.UniqueName).ToList();

            foreach (string data in trackedData)
            {
                if (!existingInvasionRewards.Any(x => x.Equals(data)))
                {
                    InvasionRewardsMissingNames.Add(data);
                }
            }


            return(this);
        }
コード例 #3
0
 public SearchResultsViewModel Load(UnitOfWork uow, WarframeItemUtilities itemUtils, AdvancedSearchModel model)
 {
     WarframeItems = itemUtils.AdvancedSearch(model);
     CodexTabs     = uow.GetRepo <CodexTabRepository>().GetAll();
     new EagerLoader(uow).Load(CodexTabs);
     return(this);
 }
コード例 #4
0
 public void Load(Fish fish, WarframeItemUtilities wiu)
 {
     if (wiu == null)
     {
         wiu = new WarframeItemUtilities(uow);
     }
     fish.WarframeItem_Object = wiu.GetByUniqueName(fish.UniqueName, false);
 }
コード例 #5
0
        public void Load(IEnumerable <Fish> fish)
        {
            WarframeItemUtilities wiu = new WarframeItemUtilities(uow);

            foreach (Fish f in fish)
            {
                Load(f, wiu);
            }
        }
コード例 #6
0
        public ManualItemDataViewModel Load(UnitOfWork uow, WarframeItemUtilities itemUtils)
        {
            ManualItemData = uow.GetRepo <ManualItemDataRepository>().GetAll();

            ItemDictionary         = itemUtils.GetAll().ToDictionary(x => x.UniqueName);
            ItemCategoryDictionary = uow.GetRepo <ItemCategoryRepository>().GetAll().ToDictionary(x => x.ID);
            CodexTabDictionary     = uow.GetRepo <CodexTabRepository>().GetAll().ToDictionary(x => x.ID);

            return(this);
        }
コード例 #7
0
        public EditPrimeReleaseViewModel Load(UnitOfWork uow, WarframeItemUtilities itemUtils, PrimeRelease pr)
        {
            PrimeRelease = pr;
            if (pr != null)
            {
                pr.LoadItemNames(uow);
            }
            List <WarframeItem> items = itemUtils.GetByCodexSection(CodexSection.Equipment)
                                        .Where(x => x.IsPrime)
                                        .OrderBy(x => x.Name).ToList();

            PrimeSelectList = new SelectList(items, "UniqueName", "Name");
            return(this);
        }
コード例 #8
0
        public EditFishViewModel Load(WarframeItemUtilities warframeItemUtilities, Fish fish)
        {
            Fish = fish;
            if (fish != null && !string.IsNullOrWhiteSpace(fish.UniqueName))
            {
                var item = warframeItemUtilities.GetByUniqueName(fish.UniqueName);
                SelectedItemName = item.Name;
            }

            string[] maps = new[] { "Plains of Eidolon", "Orb Vallis", "Cambion Drift" };
            MapSelectList = new SelectList(maps);

            string[] rarity = new[] { "Common", "Uncommon", "Rare", "Legendary" };
            RaritySelectList = new SelectList(rarity);

            string[] biomes = new[] { "Ocean", "Lake", "Pond", "Cave", "River", "Pond, River", "Surface" };
            BiomeSelectList = new SelectList(biomes);

            string[] actity = new[] { "Day and Night", "Day", "Night", "Cold and Ward", "Cold", "Warm", "Fass/Vome", "Fass", "Vome" };
            ActiveTimeSelectList = new SelectList(actity);

            return(this);
        }
コード例 #9
0
 public InvasionRewardController(UnitOfWork unitOfWork, WarframeItemUtilities utils)
 {
     _uow       = unitOfWork;
     _itemUtils = utils;
 }
コード例 #10
0
        public EditManualItemDataViewModel Load(ManualItemData manualItemData, UnitOfWork uow, WarframeItemUtilities itemUtils)
        {
            ManualItemData = manualItemData;
            if (ManualItemData == null)
            {
                ManualItemData = new ManualItemData();
            }

            if (!string.IsNullOrWhiteSpace(ManualItemData.ItemUniqueName))
            {
                WarframeItem item = itemUtils.GetByUniqueName(ManualItemData.ItemUniqueName);
                SelectedItemName = item.Name;
            }

            PropertyNames = new List <string>();
            foreach (PropertyInfo prop in typeof(WarframeItem).GetProperties())
            {
                if (prop.CanRead &&
                    prop.CanWrite &&
                    prop.Name != "UniqueName" &&
                    prop.PropertyType == typeof(string) ||
                    prop.PropertyType == typeof(int?) ||
                    prop.PropertyType == typeof(double?) ||
                    prop.PropertyType == typeof(bool))
                {
                    PropertyNames.Add(prop.Name);
                }
            }
            PropertyNames = PropertyNames.OrderBy(x => x).ToList();

            return(this);
        }
コード例 #11
0
 public RefreshModSuggestionJson(UnitOfWork uow, WarframeItemUtilities warframeItemUtilities)
 {
     this.uow = uow;
     this.warframeItemUtilities = warframeItemUtilities;
 }
コード例 #12
0
 public ToolsController(IOptions <AppSettings> appSettings, UnitOfWork uow, WarframeItemUtilities itemUtils)
 {
     this.appSettings = appSettings.Value;
     this.uow         = uow;
     this.itemUtils   = itemUtils;
 }
コード例 #13
0
        public PrimePredictionViewModel Load(UnitOfWork uow, WarframeItemUtilities itemUtils, AppSettings appSettings)
        {
            List <WarframeItem> frames = itemUtils.GetByCategoryID(appSettings.WarframeItemCategoryID);

            StandardWarframes = frames.Where(x => !x.IsPrime && !x.Name.Contains("Umbra")).OrderBy(x => string.IsNullOrWhiteSpace(x.ReleaseDate)).ThenBy(x => x.ReleaseDate).ToList();
            PrimeWarframes    = frames.Where(x => x.IsPrime).OrderBy(x => x.ReleaseDate).ToList();

            WarframeItem lastPrime = PrimeWarframes.Last();

            LastPrimeReleaseDate = DateTime.Parse(lastPrime.ReleaseDate);

            StandardWithoutPrimeWarframes = new List <WarframeItem>();
            foreach (WarframeItem standard in StandardWarframes)
            {
                WarframeItem primeVariant = PrimeWarframes.SingleOrDefault(x => x.Name == standard.Name + " Prime");
                if (primeVariant == null)
                {
                    StandardWithoutPrimeWarframes.Add(standard);
                }
            }

            StandardWithoutPrimeWarframes = StandardWithoutPrimeWarframes.OrderBy(x => string.IsNullOrWhiteSpace(x.ReleaseDate)).ThenBy(x => x.ReleaseDate).ToList();

            PrimeIndex = 0;
            foreach (WarframeItem item in PrimeWarframes)
            {
                PrimeIndex++;
                if (PrimeIndex % 4 == 0)
                {
                    Gender = "Male";
                }
                else if (PrimeIndex % 4 == 2)
                {
                    Gender = "Female";
                }
            }

            List <int> daysBetweenReleases = new List <int>();

            for (int i = 0; i < PrimeWarframes.Count; i++)
            {
                if (i == 0)
                {
                    continue;
                }

                WarframeItem current  = PrimeWarframes[i];
                WarframeItem previous = PrimeWarframes[i - 1];

                bool currentParsed = DateTime.TryParse(current.ReleaseDate, out DateTime currentRelease);
                bool prevParsed    = DateTime.TryParse(previous.ReleaseDate, out DateTime previousRelease);

                if (currentParsed && prevParsed)
                {
                    TimeSpan diff = currentRelease - previousRelease;
                    daysBetweenReleases.Add((int)Math.Round(diff.TotalDays));
                }
            }

            AverageDaysBetweenPrimes = daysBetweenReleases.Sum() / daysBetweenReleases.Count;

            return(this);
        }
コード例 #14
0
        public CodexModsViewModel Load(UnitOfWork uow, WarframeItemUtilities itemUtils, ClaimsPrincipal user, int tabID = 1)
        {
            TabID = tabID;
            List <WarframeItem> allMods = itemUtils.GetByCodexSection(CodexSection.Mods);

            switch (tabID)
            {
            case 1:
                Mods = allMods.Where(x => x.CompatName == "WARFRAME" || x.CompatName == "AURA").ToList();
                break;

            case 2:
                Mods = allMods.Where(x => x.IsAugment == true).ToList();
                break;

            case 3:
                List <string> compats = new List <string> {
                    "PRIMARY", "RIFLE", "RIFLE (NO AOE)", "ASSAULT RIFLE", "SHOTGUN", "BOW", "SNIPER"
                };
                Mods = allMods.Where(x => compats.Contains(x.CompatName)).ToList();
                break;

            case 4:
                Mods = allMods.Where(x => x.CompatName == "PISTOL" | x.CompatName == "PISTOL (NO AOE)").ToList();
                break;

            case 5:
                Mods = allMods.Where(x => x.CompatName == "MELEE" || x.CompatName == "THROWN MELEE").ToList();
                break;

            case 6:
                Mods = allMods.Where(x => x.CompatName == "ARCHWING").ToList();
                break;

            case 7:
                Mods = allMods.Where(x => x.CompatName == "ARCHGUN").ToList();
                break;

            case 8:
                Mods = allMods.Where(x => x.CompatName == "ARCHMELEE").ToList();
                break;

            case 9:
                List <string> compats2 = new List <string> {
                    "BEAST", "COMPANION", "ROBOTIC", "SENTINEL"
                };
                Mods = allMods.Where(x => compats2.Contains(x.CompatName)).ToList();
                break;

            case 10:
                Mods = allMods.Where(x => x.CompatName == "K-Drive").ToList();
                break;

            case 11:
                Mods = allMods.Where(x => x.CompatName == "NECRAMECH").ToList();
                break;

            case 12:
                Mods = allMods.Where(x => x.CompatName == "PARAZON").ToList();
                break;
            }

            int?userID = null;

            if (user.Identity.IsAuthenticated)
            {
                userID = int.Parse(user.FindFirstValue(ClaimTypes.NameIdentifier));
            }
            if (userID.HasValue)
            {
                ItemAcquisitions = uow.GetRepo <ItemAcquisitionRepository>().GetByUserID(userID.Value);
            }

            return(this);
        }
コード例 #15
0
 public ModSuggestionController(UnitOfWork uow, WarframeItemUtilities warframeItemUtilities)
 {
     this.uow = uow;
     this.warframeItemUtilities = warframeItemUtilities;
 }
コード例 #16
0
 public HomeController(UnitOfWork uow, WarframeItemUtilities itemUtils, IOptions <AppSettings> appSettings)
 {
     this.uow         = uow;
     this.itemUtils   = itemUtils;
     this.appSettings = appSettings.Value;
 }
コード例 #17
0
        public EditModSuggestionViewModel Load(ModSuggestion modSuggestion, UnitOfWork uow, WarframeItemUtilities warframeItemUtilities)
        {
            ModSuggestion = modSuggestion;

            List <ModSuggestion> mods = uow.GetRepo <ModSuggestionRepository>().GetAll().Where(x => x.ModCategory == ModSuggestion.ModCategory).ToList();

            if (ModSuggestion != null)
            {
                mods = mods.Where(x => x.ID != ModSuggestion.ID).ToList();
            }
            ModSuggestionList = new SelectList(mods, "ID", "WarframeItem.Name");

            List <WarframeItem> allMods = warframeItemUtilities.GetAllMods().Where(x => !x.UniqueName.EndsWith("Beginner")).ToList();

            ModList = new SelectList(allMods, "UniqueName", "Name");
            return(this);
        }
コード例 #18
0
 public SearchController(UnitOfWork unitOfWork, WarframeItemUtilities itemUtils)
 {
     _uow       = unitOfWork;
     _itemUtils = itemUtils;
 }
コード例 #19
0
        public ItemModalViewModel Load(WarframeItem warframeItem, ItemCategory itemCategory, ClaimsPrincipal user, UnitOfWork uow, WarframeItemUtilities itemUtils)
        {
            WarframeItem = warframeItem;
            ItemCategory = itemCategory;

            int?userID = null;

            if (user.Identity.IsAuthenticated)
            {
                userID          = int.Parse(user.FindFirstValue(ClaimTypes.NameIdentifier));
                ItemAcquisition = uow.GetRepo <ItemAcquisitionRepository>().GetByPrimaryKeys(userID.Value, WarframeItem.UniqueName);

                if (ItemAcquisition == null)
                {
                    ItemAcquisition = new ItemAcquisition {
                        UserID         = userID.Value,
                        ItemUniqueName = WarframeItem.UniqueName
                    }
                }
                ;
            }

            if (WarframeItem.Components != null && WarframeItem.Components.Any())
            {
                WarframeItem.Components = WarframeItem.Components.OrderByDescending(x => x.Name == "Blueprint").ThenBy(x => x.Name == "Orokin Cell").ThenBy(x => x.Name).ToList();

                if (userID.HasValue)
                {
                    ComponentAcquisitions = uow.GetRepo <ComponentAcquisitionRepository>()
                                            .GetByItemUniqueNameAndUserID(WarframeItem.UniqueName, userID.Value);
                }
                else
                {
                    ComponentAcquisitions = new List <ComponentAcquisition>();
                }

                ItemCategory        cat    = uow.GetRepo <ItemCategoryRepository>().GetByCodexSection(CodexSection.Relics).FirstOrDefault();
                List <WarframeItem> relics = itemUtils.GetByCategoryID(cat.ID);


                int index = 0;
                foreach (Component comp in WarframeItem.Components)
                {
                    ComponentAcquisition ca = ComponentAcquisitions
                                              .SingleOrDefault(x => x.ComponentUniqueName == comp.UniqueName);
                    if (ca == null)
                    {
                        ComponentAcquisitions.Add(new ComponentAcquisition {
                            UserID = userID ?? 0,
                            ComponentUniqueName = comp.UniqueName,
                            ItemUniqueName      = WarframeItem.UniqueName,
                            ComponentName       = comp.Name
                        });
                    }
                    else
                    {
                        ca.ComponentName = comp.Name;
                    }

                    if (comp.Drops != null && comp.Drops.Any())
                    {
                        for (int i = comp.Drops.Count - 1; i >= 0; i--)
                        {
                            var relic = relics.SingleOrDefault(x => x.Name == comp.Drops[i].Location);
                            //if (relic != null && relic.IsVaulted) {
                            //    comp.Drops.RemoveAt(i);
                            //}
                        }
                    }
                    index++;
                }

                ComponentAcquisitions = ComponentAcquisitions.OrderByDescending(x => x.ComponentName == "Blueprint").ThenBy(x => x.ComponentName == "Orokin Cell").ThenBy(x => x.ComponentName).ToList();
            }
            return(this);
        }
    }
コード例 #20
0
 public PrimeReleaseController(UnitOfWork unitOfWork, WarframeItemUtilities utils)
 {
     _uow       = unitOfWork;
     _itemUtils = utils;
 }
コード例 #21
0
 public FishController(UnitOfWork uow, WarframeItemUtilities warframeItemUtilities)
 {
     _uow = uow;
     _warframeItemUtilities = warframeItemUtilities;
 }
コード例 #22
0
        public PrimeWishlistViewModel Load(UnitOfWork uow, WarframeItemUtilities itemUtils, ClaimsPrincipal user, AppSettings appSettings)
        {
            int?userID = null;

            if (user.Identity.IsAuthenticated)
            {
                userID = int.Parse(user.FindFirstValue(ClaimTypes.NameIdentifier));
            }

            List <WarframeItem> allItems = itemUtils.GetAll();
            List <WarframeItem> primes   = allItems.Where(x => x.IsPrime).ToList();

            if (userID.HasValue)
            {
                ItemAcquisitions = uow.GetRepo <ItemAcquisitionRepository>().GetByUserID(userID.Value);
            }
            else
            {
                ItemAcquisitions = new List <ItemAcquisition>();
            }

            List <ItemAcquisition> ias = ItemAcquisitions.Where(x => x.IsAcquired).ToList();

            if (userID.HasValue)
            {
                ComponentAcquisitions = uow.GetRepo <ComponentAcquisitionRepository>().GetByUserID(userID.Value);
            }
            else
            {
                ComponentAcquisitions = new List <ComponentAcquisition>();
            }

            List <PrimeRelease> releases             = uow.GetRepo <PrimeReleaseRepository>().GetAll();
            List <PrimeRelease> unvaulted            = releases.Where(x => x.IsReleasedFromVault).ToList();
            List <string>       unvaultedUniqueNames = new List <string>();

            if (unvaulted.Any())
            {
                unvaultedUniqueNames.AddRange(unvaulted.Select(x => x.WarframeUniqueName));
                unvaultedUniqueNames.AddRange(unvaulted.Select(x => x.Item1UniqueName));
                unvaultedUniqueNames.AddRange(unvaulted.Select(x => x.Item2UniqueName));
                unvaultedUniqueNames.AddRange(unvaulted.Select(x => x.Item3UniqueName));
            }

            PrimeWishlist = primes.Where(x => !x.IsExclusive && (!x.IsVaulted || unvaultedUniqueNames.Contains(x.UniqueName)) && !ias.Select(y => y.ItemUniqueName).Contains(x.UniqueName)).ToList();

            foreach (WarframeItem item in PrimeWishlist)
            {
                if (string.IsNullOrWhiteSpace(item.ReleaseDate))
                {
                    PrimeRelease primeRelease = releases.SingleOrDefault(x => x.WarframeUniqueName == item.UniqueName || x.Item1UniqueName == item.UniqueName || x.Item2UniqueName == item.UniqueName || x.Item3UniqueName == item.UniqueName);
                    if (primeRelease != null)
                    {
                        item.ReleaseDate = primeRelease.ReleaseDate.ToString("yyyy MM dd");
                    }
                }
                if (item.Components != null)
                {
                    item.Components = item.Components.OrderByDescending(x => x.Name == "Blueprint").ThenBy(x => x.Name == "Orokin Cell").ThenBy(x => x.Name).ToList();
                }
            }

            PrimeWishlist = PrimeWishlist.OrderBy(x => x.ReleaseDate).ToList();

            #region Needed Relics
            NeededRelics = new List <WarframeItem>();
            ItemCategory        cat       = uow.GetRepo <ItemCategoryRepository>().GetByCodexSection(CodexSection.Relics).FirstOrDefault();
            List <WarframeItem> allRelics = itemUtils.GetByCategoryID(cat.ID);
            foreach (WarframeItem item in PrimeWishlist.Where(x => !x.IsVaulted))
            {
                if (item.Components != null)
                {
                    foreach (Component comp in item.Components)
                    {
                        ComponentAcquisition ca = ComponentAcquisitions
                                                  .SingleOrDefault(x => x.IsAcquired && x.ItemUniqueName == item.UniqueName && x.ComponentUniqueName == comp.UniqueName);

                        if (ca == null)
                        {
                            if (comp.Drops != null && comp.Drops.Any())
                            {
                                foreach (Drop drop in comp.Drops)
                                {
                                    string[] split = drop.Location.Split(" ", StringSplitOptions.RemoveEmptyEntries);
                                    if (split.Length > 1)
                                    {
                                        string relicName = split[0] + " " + split[1];
                                        var    relic     = allRelics.SingleOrDefault(x => x.Name.StartsWith(relicName + " "));
                                        //var relic = allRelics.Where(x => x.Name.Substring(0, 8) == drop.Location.Substring(0, 8));
                                        if (relic != null && !relic.IsVaulted)
                                        {
                                            NeededRelics.Add(relic);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            NeededRelics = NeededRelics.Distinct()
                           .OrderByDescending(x => x.Name.StartsWith("Lith"))
                           .ThenByDescending(x => x.Name.StartsWith("Meso"))
                           .ThenByDescending(x => x.Name.StartsWith("Neo"))
                           .ThenByDescending(x => x.Name).ToList();
            #endregion

            return(this);
        }
コード例 #23
0
 public CodexController(UnitOfWork unitOfWork, WarframeItemUtilities warframeItemUtilities)
 {
     _uow       = unitOfWork;
     _itemUtils = warframeItemUtilities;
 }
コード例 #24
0
 public ItemController(IOptions <AppSettings> appSettings, UnitOfWork unitOfWork, WarframeItemUtilities utils)
 {
     _appSettings = appSettings.Value;
     _uow         = unitOfWork;
     _itemUtils   = utils;
 }
コード例 #25
0
 public ManualItemDataController(UnitOfWork unitOfWork, WarframeItemUtilities utils)
 {
     _uow       = unitOfWork;
     _itemUtils = utils;
 }