예제 #1
0
            public Item(ExiledToolkit.Models.PathOfExileObjects.Item pItem)
            {
                PropertyNames = new List<string>();
                SkillGemTypes = new List<SkillTypes>();
                Statistics = new Dictionary<Stats, double>();
                MinimumDamage = new Dictionary<DamageTypes, int>();
                MaximumDamage = new Dictionary<DamageTypes, int>();

                JSONDefinition = JsonConvert.SerializeObject(pItem);
                Name = pItem.name;
                Type = pItem.typeLine;
                Description = pItem.descrText;
                BaseType = String.Empty;

                //Parse through properties
                if (pItem.properties != null)
                {
                    foreach (ExiledToolkit.Models.PathOfExileObjects.Property fProp in pItem.properties)
                    {
                        EvaluateProperty(fProp);
                    }
                }
                if (pItem.requirements != null)
                {
                    // parse them requirements
                }
                if (pItem.implicitMods != null)
                {
                    foreach (String mod in pItem.implicitMods)
                    {
                        EvaluateMod(mod);
                    }
                }
                if (pItem.explicitMods != null)
                {
                    foreach (String mod in pItem.explicitMods)
                    {
                        EvaluateMod(mod);
                    }
                }
                if (BaseType == String.Empty)
                {
                    if (Type.Contains("Belt"))
                    {
                        BaseType = "Belt";
                    }
                    else if (Type.Contains("Ring"))
                    {
                        BaseType = "Ring";
                    }
                    else if (Type.Contains("Amulet"))
                    {
                        BaseType = "Amulet";
                    }
                    else if (Type.Contains("Flask"))
                    {
                        BaseType = "Flask";
                    }
                    else if (Description != null && Description.Length > 0)
                    {
                        BaseType = "Currency";
                    }
                    else
                    {
                        BaseType = "Armor";
                    }
                }
            }
예제 #2
0
            private void EvaluateProperty(ExiledToolkit.Models.PathOfExileObjects.Property pProp)
            {
                PropertyNameType lPropType = EvaluatePropertyName(pProp.name);
                //do something  with that type
                switch (lPropType)
                {
                    case PropertyNameType.Stack_Size:
                        {
                            // Items in this stack
                            String[] lValues = pProp.values[0];
                            String lStackSize = lValues[0];
                            String[] lQuantities = lStackSize.Split('/');
                            int.TryParse(lQuantities[0], out Quantity);
                            int.TryParse(lQuantities[1], out MaxQuanity);
                            break;
                        }
                    case PropertyNameType.Level:
                        {
                            // Current Gem Level
                            String[] lValues = pProp.values[0];
                            int.TryParse(lValues[0], out CurrentGemLevel);
                            break;
                        }
                    case PropertyNameType.Mana_Cost_Multiplier:
                        {
                            // Gems
                            break;
                        }
                    case PropertyNameType.Mana_Reserved:
                        {
                            // Gems
                            break;
                        }
                    case PropertyNameType.Cooldown_Time:
                        {
                            // Gems
                            break;
                        }
                    case PropertyNameType.Cast_Time:
                        {
                            // Gems
                            break;
                        }
                    case PropertyNameType.Mana_Cost:
                        {
                            // Gems
                            break;
                        }
                    case PropertyNameType.Critical_Strike_Chance:
                        {
                            break;
                        }
                    case PropertyNameType.Quality:
                        {
                            break;
                        }
                    case PropertyNameType.Damage_Effectiveness:
                        {
                            // Gems
                            break;
                        }
                    case PropertyNameType.Physical_Damage:
                        {
                            String[] lValues = pProp.values[0];
                            String lRange = lValues[0];
                            int lIncludesMods;
                            int.TryParse(lValues[1], out lIncludesMods);

                            String[] lDamages = lRange.Split('-');
                            int lMinimum, lMaximum;
                            int.TryParse(lDamages[0], out lMinimum);
                            int.TryParse(lDamages[1], out lMaximum);

                            MinimumDamage[DamageTypes.Physical] = lMinimum;
                            MaximumDamage[DamageTypes.Physical] = lMaximum;

                            break;
                        }
                    case PropertyNameType.Elemental_Damage:
                        {
                            String[] lValues = pProp.values[0];
                            String lRange = lValues[0];
                            int lTypeInt;
                            int.TryParse(lValues[1], out lTypeInt);

                            DamageTypes lType = (DamageTypes)lTypeInt;
                            String[] lDamages = lRange.Split('-');
                            int lMinimum, lMaximum;
                            int.TryParse(lDamages[0], out lMinimum);
                            int.TryParse(lDamages[1], out lMaximum);

                            MinimumDamage[lType] = lMinimum;
                            MaximumDamage[lType] = lMaximum;

                            break;
                        }
                    case PropertyNameType.Attacks_per_Second:
                        {
                            // Current Gem Level
                            String[] lValues = pProp.values[0];
                            double.TryParse(lValues[0], out Speed);
                            break;
                        }
                    case PropertyNameType.Chance_to_Block:
                        {
                            break;
                        }
                    case PropertyNameType.Energy_Shield:
                        {
                            String[] lValues = pProp.values[0];
                            int lEnergyShield;
                            int lContainsMods;
                            if (int.TryParse(lValues[0], out lEnergyShield))
                            {
                                Statistics[Stats.Energy_Shield] = lEnergyShield;
                            }
                            if (int.TryParse(lValues[1], out lContainsMods))
                            {
                                if (lContainsMods == 1)
                                {
                                    // The armour total is blue, and contains the mods on the item.
                                }
                            }
                            break;
                        }
                    case PropertyNameType.Evasion:
                        {
                            String[] lValues = pProp.values[0];
                            int lEvasion;
                            int lContainsMods;
                            if (int.TryParse(lValues[0], out lEvasion))
                            {
                                Statistics[Stats.Armour] = lEvasion;
                            }
                            if (int.TryParse(lValues[1], out lContainsMods))
                            {
                                if (lContainsMods == 1)
                                {
                                    // The armour total is blue, and contains the mods on the item.
                                }
                            }
                            break;
                        }
                    case PropertyNameType.Armour:
                        {
                            String[] lValues = pProp.values[0];
                            int lArmour;
                            int lContainsMods;
                            if (int.TryParse(lValues[0], out lArmour))
                            {
                                Statistics[Stats.Armour] = lArmour;
                            }
                            if (int.TryParse(lValues[1], out lContainsMods))
                            {
                                if (lContainsMods == 1)
                                {
                                    // The armour total is blue, and contains the mods on the item.
                                }
                            }
                            break;
                        }
                    case PropertyNameType.Weapon:
                        BaseType = pProp.name;
                        break;
                    case PropertyNameType.SkillGem:
                        BaseType = "Skill Gem";
                        break;
                }
            }