Ejemplo n.º 1
0
        private static Item GetCurrency(JSONProxy.Item item)
        {
            var typeline = item.TypeLine.ToLower();

            if (typeline.Contains("essence") || typeline.Contains("remnant of"))
            {
                return(new Essence(item));
            }

            if (typeline.Contains("splinter of"))
            {
                return(new Splinter(item));
            }

            if (typeline.Contains("blessing"))
            {
                return(new BreachBlessing(item));
            }

            if (item.TypeLine.Contains("Sextant"))
            {
                return(new Sextant(item));
            }

            if (item.TypeLine.Contains("Net"))
            {
                return(new Net(item));
            }

            return(new Currency(item));
        }
Ejemplo n.º 2
0
        public static Item Get(JSONProxy.Item item)
        {
            try
            {
                if (item.frameType == 4)
                {
                    return(new Gem(item));
                }

                if (item.frameType == 5)
                {
                    return(new Currency(item));
                }

                if (item.TypeLine.Contains("Map") && item.DescrText != null && item.DescrText.Contains("Travel to this Map"))
                {
                    return(new Map(item));
                }

                return(new Gear(item));
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                var errorMessage = "ItemFactory unable to instanciate type : " + item.TypeLine;
                Logger.Log(errorMessage);
                throw new Exception(errorMessage);
            }
        }
Ejemplo n.º 3
0
        public Gem(JSONProxy.Item item) : base(item)
        {
            this.Properties = ProxyMapper.GetProperties(item.Properties);
            this.ItemType   = ItemType.Gem;

            this.Level = getLevel();
        }
Ejemplo n.º 4
0
 public Map(JSONProxy.Item item) : base(item)
 {
     ItemType = Model.ItemType.Gear;
     Properties = ProxyMapper.GetProperties(item.Properties);
     Rarity = getRarity(item);
     MapTier = int.Parse(Properties.Find(p => p.Name == "Map Tier").Values[0].Item1);
 }
Ejemplo n.º 5
0
        protected Item(JSONProxy.Item item)
        {
            this.Verified     = item.Verified;
            this.Identified   = item.Identified;
            this.W            = item.W;
            this.H            = item.H;
            this.IconURL      = item.Icon;
            this.League       = item.League;
            this.Name         = item.Name;
            this.TypeLine     = item.TypeLine;
            this.DescrText    = item.DescrText;
            this.X            = item.X;
            this.Y            = item.Y;
            this.inventoryId  = item.InventoryId;
            this.SecDescrText = item.SecDescrText;
            this.Explicitmods = item.ExplicitMods;
            this.ItemType     = Model.ItemType.UnSet;
            if (item.Properties != null)
            {
                this.Properties = item.Properties.Select(p => new Property(p)).ToList();

                if (this.Properties.Any(p => p.Name == "Quality"))
                {
                    this.IsQuality = true;
                    this.Quality   = ProxyMapper.GetQuality(item.Properties);
                }
            }
            this.Corrupted = item.Corrupted;
        }
Ejemplo n.º 6
0
        private void ExtractGemExperience(JSONProxy.Item item)
        {
            var experienceProperties = item.AdditionalProperties?.FirstOrDefault(x => x.Name == "Experience");

            if (experienceProperties == null)
            {
                return;
            }

            LevelExperienceProgress = experienceProperties.Progress;
            var experienceValues = experienceProperties.Values[0].FirstOrDefault()?.ToString();

            if (experienceValues == null || !experienceValues.Contains("/"))
            {
                return;
            }

            var numeratorAndDenominator = experienceValues.Split('/');

            int temporaryInt;

            if (int.TryParse(numeratorAndDenominator[0], out temporaryInt))
            {
                ExperienceNumerator = temporaryInt;
            }

            if (int.TryParse(numeratorAndDenominator[1], out temporaryInt))
            {
                ExperienceDenominator = temporaryInt;
            }

            HasExperience = true;
        }
Ejemplo n.º 7
0
        public static Item Get(JSONProxy.Item item)
        {
            try
            {
                if (item.frameType == 4)
                {
                    return(new Gem(item));
                }

                if (item.DescrText != null && item.DescrText.ToLower() == "right click this item then left click a location on the ground to create the object.")
                {
                    return(new Decoration(item));
                }

                if (item.frameType == 5)
                {
                    return(new Currency(item));
                }

                if (item.TypeLine.Contains("Map") && item.DescrText != null && item.DescrText.Contains("Travel to this Map"))
                {
                    return(new Map(item));
                }

                return(new Gear(item));
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                var errorMessage = "ItemFactory unable to instanciate type : " + item.TypeLine;
                Logger.Log(errorMessage);
                throw new Exception(errorMessage);
            }
        }
Ejemplo n.º 8
0
        internal Map(JSONProxy.Item item) : base(item)
        {
            this.ItemType   = Model.ItemType.Gear;
            this.Properties = ProxyMapper.GetProperties(item.Properties);
            this.Rarity     = getRarity(item);
            this.MapTier    = int.Parse(Properties.Find(p => p.Name == "Map Tier").Values[0].Item1);

            this.UniqueIDHash = base.getHash();
        }
Ejemplo n.º 9
0
        protected Rarity getRarity(JSONProxy.Item item)
        {
            if (item.frameType <= 3)
            {
                return((Rarity)item.frameType);
            }

            return(Rarity.Normal);
        }
Ejemplo n.º 10
0
        public Gem(JSONProxy.Item item) : base(item)
        {
            Properties = ProxyMapper.GetProperties(item.Properties);
            ItemType   = ItemType.Gem;

            Level = getLevel();

            ExtractGemExperience(item);
        }
Ejemplo n.º 11
0
        protected Item(JSONProxy.Item item)
        {
            Id            = item.Id;
            Verified      = item.Verified;
            Identified    = item.Identified;
            IsMirrored    = item.Duplicated;
            W             = item.W;
            H             = item.H;
            IconURL       = getIconUrl(item.Icon);
            League        = item.League;
            Name          = item.Name;
            TypeLine      = item.TypeLine;
            DescrText     = item.DescrText;
            X             = item.X;
            Y             = item.Y;
            InventoryId   = item.InventoryId;
            SecDescrText  = item.SecDescrText;
            Explicitmods  = item.ExplicitMods;
            ItemType      = Model.ItemType.UnSet;
            CraftedMods   = item.CraftedMods ?? new List <string>();
            VeiledMods    = item.VeiledMods ?? new List <string>();
            EnchantMods   = item.EnchantMods ?? new List <string>();
            FracturedMods = item.FracturedMods ?? new List <string>();
            FlavourText   = item.FlavourText;
            ItemLevel     = item.Ilvl;
            Shaper        = item.Shaper;
            Elder         = item.Elder;
            Synthesised   = item.Synthesised;
            Fractured     = item.Fractured;
            StackSize     = item.StackSize;
            MaxStackSize  = item.MaxStackSize;

            if (item.Properties != null)
            {
                Properties = item.Properties.Select(p => new Property(p)).ToList();

                if (Properties.Any(p => p.Name == "Quality"))
                {
                    IsQuality = true;
                    Quality   = ProxyMapper.GetQuality(item.Properties);
                }
            }

            Corrupted         = item.Corrupted;
            Microtransactions = item.CosmeticMods ?? new List <string>();
            EnchantMods       = item.EnchantMods ?? new List <string>();

            TradeX           = X;
            TradeY           = Y;
            TradeInventoryId = InventoryId;
            Character        = string.Empty;

            if (item.Elder || item.Shaper)
            {
                BackgroundUrl = ItemBackgroundUrlBuilder.GetUrl(this);
            }
        }
Ejemplo n.º 12
0
        public Gem(JSONProxy.Item item) : base(item)
        {
            this.Properties = ProxyMapper.GetProperties(item.Properties);
            this.ItemType   = Model.ItemType.Gem;

            this.Socket       = item.Socket;
            this.Color        = item.Color;
            this.Requirements = ProxyMapper.GetRequirements(item.Requirements);
            this.Level        = getLevel();
        }
Ejemplo n.º 13
0
        public Gem(JSONProxy.Item item) : base(item)
        {
            this.Properties = ProxyMapper.GetProperties(item.Properties);
            this.ItemType   = Model.ItemType.Gem;

            this.Socket       = item.Socket;
            this.Color        = item.Color;
            this.Requirements = ProxyMapper.GetRequirements(item.Requirements);

            this.UniqueIDHash = base.getHash();
        }
Ejemplo n.º 14
0
 public Gear(JSONProxy.Item item) : base(item)
 {
     Sockets       = GetSockets(item);
     Explicitmods  = item.ExplicitMods;
     SocketedItems = GetSocketedItems(item);
     Implicitmods  = item.ImplicitMods;
     Requirements  = ProxyMapper.GetRequirements(item.Requirements);
     ItemType      = Model.ItemType.Gear;
     GearType      = GearTypeFactory.GetType(this);
     BaseType      = GearTypeFactory.GetBaseType(this);
 }
Ejemplo n.º 15
0
 public Gear(JSONProxy.Item item) : base(item)
 {
     this.Rarity        = getRarity(item);
     this.Sockets       = getSockets(item);
     this.Explicitmods  = item.ExplicitMods;
     this.SocketedItems = getSocketedItems(item);
     this.Implicitmods  = item.ImplicitMods;
     this.Requirements  = ProxyMapper.GetRequirements(item.Requirements);
     this.ItemType      = Model.ItemType.Gear;
     this.GearType      = GearTypeFactory.GetType(this);
     this.BaseType      = GearTypeFactory.GetBaseType(this);
 }
Ejemplo n.º 16
0
 internal Gear(JSONProxy.Item item) : base(item)
 {
     this.Rarity        = getRarity(item);
     this.FlavourText   = item.FlavourText;
     this.Sockets       = item.Sockets.Select(proxy => new Socket(proxy)).ToList();
     this.Explicitmods  = item.ExplicitMods;
     this.SocketedItems = item.SocketedItems.Select(proxy => (Gem)ItemFactory.Get(proxy)).ToList();
     this.Implicitmods  = item.ImplicitMods;
     this.Requirements  = ProxyMapper.GetRequirements(item.Requirements);
     this.ItemType      = Model.ItemType.Gear;
     this.GearType      = GearTypeFactory.GetType(this);
     this.BaseType      = GearTypeFactory.GetBaseType(this);
 }
Ejemplo n.º 17
0
        private static Item GetCurrency(JSONProxy.Item item)
        {
            var typeline = item.TypeLine.ToLower();

            if (typeline.Contains("essence") || typeline.Contains("remnant of"))
            {
                return(new Essence(item));
            }

            if (typeline.Contains("splinter of"))
            {
                return(new BreachSplinter(item));
            }

            if (typeline.Contains("splinter"))
            {
                return(new LegionSplinter(item));
            }

            if (typeline.Contains("emblem"))
            {
                return(new LegionEmblem(item));
            }

            if (typeline.Contains("blessing"))
            {
                return(new Breachstone(item));
            }

            if (item.TypeLine.Contains("Sextant"))
            {
                return(new Sextant(item));
            }

            if (item.TypeLine.Contains("Net"))
            {
                return(new Net(item));
            }

            if (item.TypeLine.Contains("Fossil"))
            {
                return(new Fossil(item));
            }

            if (item.TypeLine.Contains("Resonator"))
            {
                return(new Resonator(item));
            }

            return(new Currency(item));
        }
Ejemplo n.º 18
0
        public static BreachType GetBreachType(JSONProxy.Item item)
        {
            try
            {
                return(_breachMap.First(m => item.TypeLine.Contains(m.Key)).Value);
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                Logger.Log("ProxyMapper.GetBreachType Failed! ItemType = " + item.TypeLine);

                return(BreachType.Unknown);
            }
        }
Ejemplo n.º 19
0
        public static LegionFaction GetLegionFaction(JSONProxy.Item item)
        {
            try
            {
                return(_legionMap.First(m => item.TypeLine.Contains(m.Key)).Value);
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                Logger.Log("ProxyMapper.GetLegionFaction Failed! ItemType = " + item.TypeLine);

                return(LegionFaction.Unknown);
            }
        }
Ejemplo n.º 20
0
        protected Item(JSONProxy.Item item)
        {
            this.Id           = item.Id;
            this.Verified     = item.Verified;
            this.Identified   = item.Identified;
            this.IsMirrored   = item.Duplicated;
            this.W            = item.W;
            this.H            = item.H;
            this.IconURL      = getIconUrl(item.Icon);
            this.League       = item.League;
            this.Name         = item.Name;
            this.TypeLine     = item.TypeLine;
            this.DescrText    = item.DescrText;
            this.X            = item.X;
            this.Y            = item.Y;
            this.InventoryId  = item.InventoryId;
            this.SecDescrText = item.SecDescrText;
            this.Explicitmods = item.ExplicitMods;
            this.ItemType     = Model.ItemType.UnSet;
            this.CraftedMods  = item.CraftedMods ?? new List <string>();
            this.VeiledMods   = item.VeiledMods ?? new List <string>();
            this.EnchantMods  = item.EnchantMods ?? new List <string>();
            this.FlavourText  = item.FlavourText;
            this.ItemLevel    = item.Ilvl;
            this.Shaper       = item.Shaper;
            this.Elder        = item.Elder;
            this.StackSize    = item.StackSize;
            this.MaxStackSize = item.MaxStackSize;

            if (item.Properties != null)
            {
                this.Properties = item.Properties.Select(p => new Property(p)).ToList();

                if (this.Properties.Any(p => p.Name == "Quality"))
                {
                    this.IsQuality = true;
                    this.Quality   = ProxyMapper.GetQuality(item.Properties);
                }
            }

            this.Corrupted         = item.Corrupted;
            this.Microtransactions = item.CosmeticMods ?? new List <string>();
            this.EnchantMods       = item.EnchantMods ?? new List <string>();

            this.TradeX           = this.X;
            this.TradeY           = this.Y;
            this.TradeInventoryId = this.InventoryId;
            this.Character        = string.Empty;
        }
Ejemplo n.º 21
0
        private Rarity GetRarity(JSONProxy.Item item)
        {
            //Looks like isRelic is coming across the wire as an additional field but coincidentally 9 was the correct frame type here.
            if (item.FrameType == 9 || item.IsRelic)
            {
                return(Rarity.Relic);
            }

            if (item.FrameType <= 3)
            {
                return((Rarity)item.FrameType);
            }

            return(Rarity.Normal);
        }
Ejemplo n.º 22
0
        public static Item Get(JSONProxy.Item item)
        {
            try
            {
                item.Name     = filterString(item.Name);
                item.TypeLine = filterString(item.TypeLine);

                if (!string.IsNullOrWhiteSpace(item.ProphecyText))
                {
                    return(new Prophecy(item));
                }

                if (item.FrameType == 4)
                {
                    return(new Gem(item));
                }

                if (item.DescrText != null && item.DescrText.ToLower() == "right click this item then left click a location on the ground to create the object.")
                {
                    return(new Decoration(item));
                }

                if (item.TypeLine.Contains("Leaguestone"))
                {
                    return(new Leaguestone(item));
                }

                if (item.FrameType == 5)
                {
                    return(GetCurrency(item));
                }

                if (item.TypeLine.Contains("Map") && item.DescrText != null && item.DescrText.Contains("Travel to this Map"))
                {
                    return(new Map(item));
                }

                return(new Gear(item));
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                var errorMessage = "ItemFactory unable to instantiate type : " + item.TypeLine;
                Logger.Log(errorMessage);
                throw;
            }
        }
Ejemplo n.º 23
0
        public FullBestiaryOrb(JSONProxy.Item item) : base(item)
        {
            this.Rarity   = getRarity(item);
            this.ItemType = ItemType.Currency;

            this.Genus  = ProxyMapper.GetGenus(item.Properties);
            this.Group  = ProxyMapper.GetGroup(item.Properties);
            this.Family = ProxyMapper.GetFamily(item.Properties);

            // TODO: This item's explicit mods are the mods of the contained beast.  These could be various types of
            // mods ("prefix mod", "suffix mod", "monster mod", etc.), but only the name is provided in the JSON for
            // the explicit mod.  Compile a list of each of these types of mods and map them here, so we can style the
            // text of the mods correctly in the item tooltip.  Right now all of the mods have the default blue
            // foreground text and no other styling, which is only correct for prefix/suffix mods.  Note that the
            // in-game detailed tooltip uses "monster mod" for different kinds of mods, including bestiary beast mods
            // (bold white text with red outline) and bloodline mods (magenta text RGB(210, 0, 220)).
        }
Ejemplo n.º 24
0
 public Sextant(JSONProxy.Item item) : base(item)
 {
     if (item.TypeLine.StartsWith("Apprentice"))
     {
         Type = SextantType.Apprentice;
     }
     else if (item.TypeLine.StartsWith("Journeyman"))
     {
         Type = SextantType.Journeyman;
     }
     else if (item.TypeLine.StartsWith("Master"))
     {
         Type = SextantType.Master;
     }
     else
     {
         Type = SextantType.Unknown;
     }
 }
Ejemplo n.º 25
0
        protected Item(JSONProxy.Item item)
        {
            this.Verified     = item.Verified;
            this.Identified   = item.Identified;
            this.W            = item.W;
            this.H            = item.H;
            this.IconURL      = item.Icon;
            this.League       = item.League;
            this.Name         = item.Name;
            this.TypeLine     = item.TypeLine;
            this.DescrText    = item.DescrText;
            this.X            = item.X;
            this.Y            = item.Y;
            this.InventoryId  = item.InventoryId;
            this.SecDescrText = item.SecDescrText;
            this.Explicitmods = item.ExplicitMods;
            this.ItemType     = Model.ItemType.UnSet;

            if (item.Properties != null)
            {
                this.Properties = item.Properties.Select(p => new Property(p)).ToList();

                if (this.Properties.Any(p => p.Name == "Quality"))
                {
                    this.IsQuality = true;
                    this.Quality   = ProxyMapper.GetQuality(item.Properties);
                }
            }

            this.Corrupted         = item.Corrupted;
            this.Microtransactions = item.CosmeticMods == null ? new List <string>() : item.CosmeticMods;

            this.TradeX           = this.X;
            this.TradeY           = this.Y;
            this.TradeInventoryId = this.InventoryId;
            this.Character        = string.Empty;
        }
Ejemplo n.º 26
0
 public AbyssJewel(JSONProxy.Item item) : base(item)
 {
     Rarity = getRarity(item);
 }
Ejemplo n.º 27
0
 public AbyssJewel(JSONProxy.Item item) : base(item)
 {
 }
Ejemplo n.º 28
0
 internal Prophecy(JSONProxy.Item item) : base(item)
 {
     ProphecyText           = item.ProphecyText;
     ProphecyDifficultyText = item.ProphecyDiffText;
 }
Ejemplo n.º 29
0
 public LegionSplinter(JSONProxy.Item item) : base(item)
 {
     Faction = ProxyMapper.GetLegionFaction(item);
 }
Ejemplo n.º 30
0
 public Splinter(JSONProxy.Item item) : base(item)
 {
     Type = ProxyMapper.GetBreachType(item);
 }