void AddRelicFromJSON(JToken relic)
        {
            Relic r = new Relic();

            r.LoadFromJSON(relic);

            if (relic.SelectToken("flavorText") != null)
            {
                r.Flavor = relic.SelectToken("flavorText").ToObject <string>();
            }

            if (relic.SelectToken("defense") != null)
            {
                r.Defense = relic.SelectToken("defense").ToObject <int>();
            }

            if (relic.SelectToken("hitPoints") != null)
            {
                r.HitPoints = relic.SelectToken("hitPoints").ToObject <int>();
            }

            if (relic.SelectToken("size") != null)
            {
                r.Size = ((relic.SelectToken("size").ToObject <string>())[0] == '2' ? 2 : 1);
            }

            r.Description = ExtractAbilitiesAndConditions(r.Description, ref r.DescriptionAbilities, ref r.DescriptionConditions);

            Relics.Add(r.ID, r);
        }
Esempio n. 2
0
        public void UpdateInventoryCategories()
        {
            Potions.Clear();
            Weapons.Clear();
            Treasure.Clear();
            Relics.Clear();

            foreach (var gameItemQuantity in _inventory)
            {
                if (gameItemQuantity.GameItem is Potions)
                {
                    Potions.Add(gameItemQuantity);
                }
                if (gameItemQuantity.GameItem is Weapon)
                {
                    Weapons.Add(gameItemQuantity);
                }
                if (gameItemQuantity.GameItem is Treasure)
                {
                    Treasure.Add(gameItemQuantity);
                }
                if (gameItemQuantity.GameItem is Relic)
                {
                    Relics.Add(gameItemQuantity);
                }
            }
        }
Esempio n. 3
0
 public void GrabItem(Item item)
 {
     if (item.GetType() == typeof(Weapon))
     {
         this.Weapon = (Weapon)item;
     }
     else if (item.GetType() == typeof(Relic))
     {
         Relics.Add((Relic)item);
     }
 }
Esempio n. 4
0
 public Player(CardDomain type            = CardDomain.IronClad, int?hp = null, int?hpMax = null,
               IEnumerable <Relic> relics = null, IEnumerable <Potion> potions = null,
               int?maxEnergy = null, int?drawAmount = null)
     : base("Wilson", EntityType.Player, hp ?? 100, hpMax ?? 100)
 {
     CharacterType = type;
     if (relics != null)
     {
         foreach (var relic in relics)
         {
             relic.Player = this;
             Relics.Add(relic);
         }
     }
     if (potions != null)
     {
         //TODO check max potion slots?
         Potions = potions.ToList();
     }
     _MaxEnergy  = maxEnergy ?? 3;
     _DrawAmount = drawAmount ?? 5;
 }
Esempio n. 5
0
        public static void Initialize()
        {
            var httpClient = new HttpClient();

            HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "http://drops.warframestat.us/data/all.json");

            var httpResponse = httpClient.SendAsync(request);

            httpResponse.Wait();
            var result  = httpResponse.Result;
            var content = result.Content.ReadAsStringAsync().Result;

            var response = JsonConvert.DeserializeObject <WarframeDropDataModels.AllDataReponse>(content);

            #region Missions
            Missions.Clear();

            var missionRewardsEnumerator = response.MissionRewards.GetEnumerator();

            while (missionRewardsEnumerator.MoveNext())
            {
                var planetKeyValuePair = missionRewardsEnumerator.Current;

                var missionsEnumerator = planetKeyValuePair.Value.GetEnumerator();

                while (missionsEnumerator.MoveNext())
                {
                    var missionModelKeyValuePair = missionsEnumerator.Current;

                    var mission = new SearchResultModels.Mission
                    {
                        Planet = planetKeyValuePair.Key,
                        Name   = missionModelKeyValuePair.Key,
                        Type   = missionModelKeyValuePair.Value.GameMode
                    };

                    for (int i = 0; i < missionModelKeyValuePair.Value.MissionRewards.Count; i++)
                    {
                        var missionReward = missionModelKeyValuePair.Value.MissionRewards[i];

                        if (mission.Rewards == null)
                        {
                            mission.Rewards = new List <SearchResultModels.Item>();
                        }

                        mission.Rewards.Add(missionReward.ToItem());
                    }

                    if (missionModelKeyValuePair.Value.MissionRewards.A != null)
                    {
                        for (int i = 0; i < missionModelKeyValuePair.Value.MissionRewards.A.Count; i++)
                        {
                            var missionReward = missionModelKeyValuePair.Value.MissionRewards.A[i];

                            if (mission.RotationA == null)
                            {
                                mission.RotationA = new List <SearchResultModels.Item>();
                            }

                            mission.RotationA.Add(missionReward.ToItem());
                        }
                    }

                    if (missionModelKeyValuePair.Value.MissionRewards.B != null)
                    {
                        for (int i = 0; i < missionModelKeyValuePair.Value.MissionRewards.B.Count; i++)
                        {
                            var missionReward = missionModelKeyValuePair.Value.MissionRewards.B[i];

                            if (mission.RotationB == null)
                            {
                                mission.RotationB = new List <SearchResultModels.Item>();
                            }

                            mission.RotationB.Add(missionReward.ToItem());
                        }
                    }

                    if (missionModelKeyValuePair.Value.MissionRewards.C != null)
                    {
                        for (int i = 0; i < missionModelKeyValuePair.Value.MissionRewards.C.Count; i++)
                        {
                            var missionReward = missionModelKeyValuePair.Value.MissionRewards.C[i];

                            if (mission.RotationC == null)
                            {
                                mission.RotationC = new List <SearchResultModels.Item>();
                            }

                            mission.RotationC.Add(missionReward.ToItem());
                        }
                    }

                    Missions.Add(mission);
                }
            }
            #endregion

            #region Bounties
            Bounties.Clear();

            ConvertBounties(response.CetusBountyRewards, "Earth");
            ConvertBounties(response.SolarisBountyRewards, "Venus");
            ConvertBounties(response.DeimosRewards, "Deimos");
            #endregion

            #region Relics
            Relics.Clear();

            for (int i = 0; i < response.Relics.Count; i++)
            {
                var relicModel = response.Relics[i];

                if (i == 0 || i % 4 != 0)
                {
                    continue;
                }

                var relic = new SearchResultModels.Relic
                {
                    Era         = relicModel.Tier,
                    Description = relicModel.RelicName,
                    Locations   = new List <SearchResultModels.ItemLocation>()
                };

                relic.Rewards = relicModel.Rewards.Select(j => j.ToItem()).OrderByDescending(i => i.DropChance).ToList();

                var relicName = $"{relic.Era} {relic.Description} Relic";

                var locations = Missions.Where(j => j.Rewards?.Any(k => k.Name == relicName) == true).ToList();

                for (int j = 0; j < locations.Count; j++)
                {
                    var location = locations[j];

                    var chance = location.Rewards.FirstOrDefault(k => k.Name == relicName).DropChance;

                    relic.Locations.Add(new SearchResultModels.ItemLocation
                    {
                        Mission = location,
                        Chance  = chance
                    });
                }

                locations = Missions.Where(j => j.RotationA?.Any(k => k.Name == relicName) == true).ToList();

                for (int j = 0; j < locations.Count; j++)
                {
                    var location = locations[j];

                    var chance = location.RotationA.FirstOrDefault(k => k.Name == relicName).DropChance;

                    relic.Locations.Add(new SearchResultModels.ItemLocation
                    {
                        Rotation = "A",
                        Chance   = chance,
                        Mission  = location
                    });
                }

                locations = Missions.Where(j => j.RotationB?.Any(k => k.Name == relicName) == true).ToList();

                for (int j = 0; j < locations.Count; j++)
                {
                    var location = locations[j];

                    var chance = location.RotationB.FirstOrDefault(k => k.Name == relicName).DropChance;

                    relic.Locations.Add(new SearchResultModels.ItemLocation
                    {
                        Rotation = "B",
                        Chance   = chance,
                        Mission  = location
                    });
                }

                locations = Missions.Where(j => j.RotationC?.Any(k => k.Name == relicName) == true).ToList();

                for (int j = 0; j < locations.Count; j++)
                {
                    var location = locations[j];

                    var chance = location.RotationC.FirstOrDefault(k => k.Name == relicName).DropChance;

                    relic.Locations.Add(new SearchResultModels.ItemLocation
                    {
                        Rotation = "C",
                        Chance   = chance,
                        Mission  = location
                    });
                }

                relic.Locations = relic.Locations.OrderByDescending(i => i.Chance).ToList();

                Relics.Add(relic);
            }
            #endregion
        }
        public MainWindow()
        {
            InitializeComponent();
            WarframeItem.OwnedLog = JsonConvert.DeserializeObject <Dictionary <string, bool> >(Properties.Settings.Default.OwnershipLog);
            System.Net.WebClient wc      = new System.Net.WebClient();
            const string         webPath = "http://content.warframe.com/PublicExport/Manifest/";

            foreach (string manifestPath in GetManifestPaths())
            {
                JObject manifest = JObject.Parse(wc.DownloadString(webPath + manifestPath));
                if (manifest.ContainsKey("ExportWeapons"))
                {
                    foreach (JToken weapon in manifest["ExportWeapons"].Children().ToList())
                    {
                        if (weapon["slot"] != null)
                        {
                            WarframeWeapon theWeapon = weapon.ToObject <WarframeWeapon>();
                            if (!App.AllItems.ContainsKey(theWeapon.UniqueName))
                            {
                                Weapons.Add(theWeapon);
                                App.AllItems.Add(theWeapon.UniqueName, theWeapon);
                            }
                        }
                    }
                }
                else if (manifest.ContainsKey("ExportWarframes"))
                {
                    foreach (JToken warframe in manifest["ExportWarframes"].Children().ToList())
                    {
                        WarframeWarframe theWarframe = warframe.ToObject <WarframeWarframe>();
                        Warframes.Add(theWarframe);
                        App.AllItems.Add(theWarframe.UniqueName, theWarframe);
                    }
                }
                else if (manifest.ContainsKey("ExportRecipes"))
                {
                    foreach (JToken recipe in manifest["ExportRecipes"].Children().ToList())
                    {
                        Recipes.Add(recipe.ToObject <WarframeRecipe>());
                    }
                }
                else if (manifest.ContainsKey("ExportRelicArcane"))
                {
                    foreach (JToken relic in manifest["ExportRelicArcane"].Children().ToList())
                    {
                        if (relic["name"].ToString().ToLower().Contains("relic"))
                        {
                            if (relic["uniqueName"].ToString().ToLower().Contains("platinum"))
                            {
                                Relics.Add(relic.ToObject <WarframeRelic>());
                            }
                        }
                        else
                        {
                            Arcanes.Add(relic.ToObject <WarframeArcane>());
                        }
                    }
                }
                else if (manifest.ContainsKey("ExportUpgrades"))
                {
                    foreach (JToken upgrade in manifest["ExportUpgrades"].Children().ToList())
                    {
                        Mods.Add(upgrade.ToObject <WarframeMod>());
                    }
                }
                else if (manifest.ContainsKey("ExportResources"))
                {
                    foreach (JToken resource in manifest["ExportResources"].Children().ToList())
                    {
                        WarframeItem theItem = resource.ToObject <WarframeItem>();
                        App.AllItems.Add(theItem.UniqueName, theItem);
                    }
                }
                else if (manifest.ContainsKey("ExportGear"))
                {
                    foreach (JToken gear in manifest["ExportGear"].Children().ToList())
                    {
                        WarframeItem theItem = gear.ToObject <WarframeItem>();
                        App.AllItems.Add(theItem.UniqueName, theItem);
                    }
                }
                else if (manifest.ContainsKey("ExportDrones"))
                {
                    foreach (JToken drone in manifest["ExportDrones"].Children().ToList())
                    {
                        WarframeItem theItem = drone.ToObject <WarframeItem>();
                        App.AllItems.Add(theItem.UniqueName, theItem);
                    }
                }
                else if (manifest.ContainsKey("ExportKeys"))
                {
                    foreach (JToken key in manifest["ExportKeys"].Children().ToList())
                    {
                        WarframeItem theItem = key.ToObject <WarframeItem>();
                        App.AllItems.Add(theItem.UniqueName, theItem);
                    }
                }
                else if (!manifest.ContainsKey("EportSortieRewards"))
                {
                    foreach (JToken token in manifest.SelectTokens("*"))
                    {
                        foreach (JToken item in token.Children().ToList())
                        {
                            try
                            {
                                WarframeItem theItem = item.ToObject <WarframeItem>();
                                OtherItems.Add(theItem);
                                if (theItem.UniqueName is null)
                                {
                                    MessageBox.Show(item.ToString());
                                }
                                //App.AllItems.Add(theItem.UniqueName, theItem);
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                }
            }
            WeaponViewer.ItemsSource   = Weapons;
            WarframeViewer.ItemsSource = Warframes;
            RelicViewer.ItemsSource    = Relics;
            ArcaneViewer.ItemsSource   = Arcanes;
            ModViewer.ItemsSource      = Mods;
            RecipeViewer.ItemsSource   = Recipes;
            OtherViewer.ItemsSource    = OtherItems;

            PropertyGroupDescription groupDescription_Type = new PropertyGroupDescription("Type");
            PropertyGroupDescription groupDescription_Tier = new PropertyGroupDescription("Tier");
            CollectionView           view = (CollectionView)CollectionViewSource.GetDefaultView(WeaponViewer.ItemsSource);

            view.GroupDescriptions.Add(groupDescription_Type);
            view = (CollectionView)CollectionViewSource.GetDefaultView(WarframeViewer.ItemsSource);
            view.GroupDescriptions.Add(groupDescription_Type);
            view = (CollectionView)CollectionViewSource.GetDefaultView(RelicViewer.ItemsSource);
            view.GroupDescriptions.Add(groupDescription_Tier);
            view = (CollectionView)CollectionViewSource.GetDefaultView(ModViewer.ItemsSource);
            view.GroupDescriptions.Add(groupDescription_Type);
        }