Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ItemOverlayViewModel" /> class.
        /// </summary>
        /// <param name="item">The item.</param>
        public ItemOverlayViewModel(PoeItem item)
        {
            this._item             = item;
            this.SocketInformation = GetSocketInformation(item);
            this.Suffixes          = new List <char>();
            this.Prefixes          = new List <char>();

            if (this._item.Information != null)
            {
                var openPrefix = MaxAffixCount - this._item.Information.PrefixCount;
                for (int i = 0; i < openPrefix; i++)
                {
                    this.Prefixes.Add('.');
                }

                var openSuffix = MaxAffixCount - this._item.Information.SuffixCount;
                for (int i = 0; i < openSuffix; i++)
                {
                    this.Suffixes.Add('.');
                }
            }

            var affix = this._item.ImportantAffixes.FirstOrDefault(i => i != null);

            if (affix != null)
            {
                this._importantAffix = new AffixViewModel(affix);
            }
        }
Example #2
0
        public void DelItem(PoeItem item)
        {
            SlotCatList[(int)item.SlotCategory].DelItem(item);

            ItemCountInThisCat--;
            OnPropertyChanged("ItemCountDisplay");
        }
        /// <summary>
        /// Parses the item.
        /// </summary>
        private async void ParseItem()
        {
            PoeItem item = default;
            var retryCount = 2;
            for (int i = 0; i < retryCount; i++)
            {
                item = await this.GetItemInClipboard();
                if (item == null)
                {
                    return;
                }

                if (!item.Identified)
                {
                    await Task.Delay(50);
                    continue;
                }

                break;
            }

            if (item == null || !item.Identified)
            {
                return;
            }

            this.Newitem?.Invoke(this, item);
            this.ClearClipboard();
        }
Example #4
0
        /// <summary>
        /// Gets the total life.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns>The total life of the item.</returns>
        public static double GetTotalLife(PoeItem item)
        {
            double increasedLifeCount = 0;

            var strengthCount = GetTotalStrength(item);

            if (strengthCount > 0)
            {
                var strBonus = (int)(strengthCount / 10);
                increasedLifeCount = strBonus * 5;
            }

            var instance           = GetInstance();
            var maximumLifeAffixes = instance.Affixes.Where(a => a.text == AttributeAffixes.MaximumLifeText);

            foreach (var maximumLifeAffix in maximumLifeAffixes)
            {
                var affix = item.Affixes.FirstOrDefault(a => a.Id == maximumLifeAffix.Id);
                if (affix != null)
                {
                    increasedLifeCount += affix.Value;
                }
            }

            return(increasedLifeCount);
        }
Example #5
0
        /// <summary>
        /// Parses the item.
        /// </summary>
        private async void ParseItem()
        {
            PoeItem item       = default;
            var     retryCount = 2;

            for (int i = 0; i < retryCount; i++)
            {
                this._simulator.Keyboard.ModifiedKeyStroke(WindowsInput.Native.VirtualKeyCode.CONTROL, WindowsInput.Native.VirtualKeyCode.VK_C);
                await Task.Delay(20);

                item = ClipboardHelper.GetItemInClipboard();

                if (item == null)
                {
                    return;
                }

                if (!item.Identified)
                {
                    await Task.Delay(50);

                    continue;
                }

                break;
            }

            if (item == null || !item.Identified)
            {
                return;
            }

            this.Newitem?.Invoke(this, item);
            ClipboardHelper.ClearClipboard();
        }
Example #6
0
        public void DelItem(PoeItem item)
        {
            SlotCatList[(int)item.SlotCategory].DelItem(item);

            ItemCountInThisCat--;
            OnPropertyChanged("ItemCountDisplay");
        }
Example #7
0
        /// <summary>
        /// Clipboards the lurker newitem.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="item">The item.</param>
        private void MouseLurker_Newitem(object sender, PoeItem item)
        {
            if (!this._popup.IsActive)
            {
                this.ActivateItem(this._popup);
            }

            if (item is Map map)
            {
                if (this._settingsService.MapEnabled)
                {
                    this._popup.Open(new MapViewModel(map, this.ActivePlayer, this._currentCharacterService));
                }
            }
            else if (!this._settingsService.SearchEnabled)
            {
                return;
            }
            else if (item is Weapon weapon)
            {
                this._popup.Open(new WeaponViewModel(weapon));
            }
            else if (item.Rarity != Rarity.Currency)
            {
                this._popup.Open(new ItemOverlayViewModel(item));
            }
        }
Example #8
0
        public void AddItem(PoeItem item)
        {
            //RequiresResort = true;
            SlotCatList[(int)item.SlotCategory].AddItem(item);

            ItemCountInThisCat++;
            OnPropertyChanged("ItemCountDisplay");
        }
Example #9
0
        public void AddItem(PoeItem item)
        {
            //RequiresResort = true;
            SlotCatList[(int)item.SlotCategory].AddItem(item);

            ItemCountInThisCat++;
            OnPropertyChanged("ItemCountDisplay");
        }
        /// <summary>
        /// Gets the socket information.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns>The socket information.</returns>
        private static string GetSocketInformation(PoeItem item)
        {
            if (item is SocketableItem socketItem)
            {
                return($"{socketItem.SocketCount} sockets | {socketItem.SocketLinks} links");
            }

            return(string.Empty);
        }
Example #11
0
 private void ItemIdentified(object sender, PoeItem item)
 {
     if (this._settingsService.MapEnabled && item is Map map)
     {
         this.ShowMap(map);
     }
     else if (this._settingsService.ItemAlertEnabled && item.IsGood())
     {
         this._soundService.PlayItemAlert(this._settingsService.ItemAlertVolume);
     }
 }
Example #12
0
        /// <summary>
        /// Clipboards the lurker newitem.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="item">The item.</param>
        private void MouseLurker_Newitem(object sender, PoeItem item)
        {
            if (!this._popup.IsActive)
            {
                this.ActivateItem(this._popup);
            }

            if (item is Map map && this._settingsService.MapEnabled)
            {
                this._popup.Open(new MapViewModel(map, this.ActivePlayer, this._currentCharacterService));
            }
        private static void DoParseTest(string gameText, PoeItem expectedItem)
        {
            Console.WriteLine(gameText);

            var compendium  = new AffixCompendium();
            var lexicon     = new ItemTypeLexicon();
            var parsers     = new ModParsers(lexicon, compendium);
            var itemFactory = new PoeItemFactory(lexicon, parsers);

            var actualItem = itemFactory.CreateItem(gameText);

            // Note that the mods on the expected object must be in the same order as the mods on the parsed item.
            // Which is actually determined by the order the parsers are run.  This is crap but not sure how to fix it right now.
            actualItem.ShouldMatch(expectedItem.ToExpectedObject());
        }
Example #14
0
        /// <summary>
        /// Clipboards the lurker newitem.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="item">The item.</param>
        private void ShowItemDetails(object sender, PoeItem item)
        {
            if (!this._popup.IsActive)
            {
                this.ActivateItem(this._popup);
            }

            if (item is Map)
            {
                return;
            }
            else if (item is Weapon weapon)
            {
                this._popup.Open(new WeaponViewModel(weapon));
            }
            else if (item.Rarity != Rarity.Currency)
            {
                this._popup.Open(new ItemOverlayViewModel(item));
            }
        }
Example #15
0
        /// <summary>
        /// Parses the specified value.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns>The parsed item.</returns>
        public PoeItem Parse(string value)
        {
            if (!value.StartsWith("Rarity: "))
            {
                return(null);
            }

            switch (PoeItem.GetItemClass(value))
            {
            case ItemClass.Boots:
                return(new Boots(value));

            case ItemClass.Gloves:
                return(new Gloves(value));

            case ItemClass.BodyArmour:
                return(new BodyArmour(value));

            case ItemClass.Belt:
                return(new Belt(value));

            case ItemClass.Helmet:
                return(new Helmet(value));

            case ItemClass.Bow:
                return(new Bow(value));

            case ItemClass.Quiver:
                return(new Quiver(value));

            case ItemClass.Ring:
                return(new Ring(value));

            case ItemClass.Amulet:
                return(new Amulet(value));

            default:
                return(null);
            }
        }
Example #16
0
        /// <summary>
        /// Parses the item.
        /// </summary>
        private async Task <PoeItem> ParseItem()
        {
            PoeItem item       = default;
            var     retryCount = 2;

            for (int i = 0; i < retryCount; i++)
            {
                item = await ClipboardHelper.GetItemInClipboard();

                if (item == null)
                {
                    return(null);
                }

                if (!item.Identified)
                {
                    await Task.Delay(50);

                    continue;
                }

                break;
            }

            if (item == null || !item.Identified)
            {
                return(null);
            }

            if (item.ItemClass == ItemClass.Unknown)
            {
                return(null);
            }

            return(item);
        }
Example #17
0
        /// <summary>
        /// Parses the item.
        /// </summary>
        private async Task ParseItem()
        {
            PoeItem item       = default;
            var     retryCount = 2;

            for (int i = 0; i < retryCount; i++)
            {
                await Simulate.Events().ClickChord(WindowsInput.Events.KeyCode.LControlKey, WindowsInput.Events.KeyCode.C).Invoke();

                await Task.Delay(100);

                item = ClipboardHelper.GetItemInClipboard();

                if (item == null)
                {
                    return;
                }

                if (!item.Identified)
                {
                    await Task.Delay(50);

                    continue;
                }

                break;
            }

            if (item == null || !item.Identified)
            {
                return;
            }

            this.Newitem?.Invoke(this, item);
            ClipboardHelper.ClearClipboard();
        }
Example #18
0
 /// <summary>
 /// Affixes the sum.
 /// </summary>
 /// <param name="values">The values.</param>
 /// <param name="item">The item.</param>
 /// <returns>The sum of the affixes</returns>
 private static double AffixSum(IEnumerable <string> values, PoeItem item)
 {
     return(item.Affixes.Where(a => values.Contains(a.Text)).Sum(a => a.Value));
 }
Example #19
0
 public void AddItem(PoeItem item)
 {
     ItemsList.Add(item);
     OnPropertyChanged("ItemCountDisplay");
 }
Example #20
0
 public void DelItem(PoeItem item)
 {
     ClassCatList[(int)item.ClassCategory].DelItem(item);
 }
Example #21
0
 /// <summary>
 /// Gets the total strength.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>The sum of strength.</returns>
 public static double GetTotalStrength(PoeItem item)
 {
     return(AffixSum(AttributeAffixes.StrengthTexts, item));
 }
Example #22
0
 public void AddItem(PoeItem item)
 {
     ClassCatList[(int)item.ClassCategory].AddItem(item);
 }
 public PoeItemQuality(PoeItem item, int quality)
 {
     this.Item    = item;
     this.Quality = quality;
 }
Example #24
0
        /// <summary>
        /// Distributes item to other tables (except AllItems)
        /// </summary>
        /// <param name="item">Item</param>
        private void DistributeAddedItemToOtherLists(PoeItem item)
        {
            //orb of alchemy name comparsion
            if (item.FrameType == PoeItem.FrameTypeIndex.Rare && item.Identified == true)
            {
                if (!RareItemNames.ContainsKey(item.Name))
                    RareItemNames.Add(item.Name, 1);
                else
                    RareItemNames[item.Name]++;

                int extraParam;
                ItemsOfInterest.InterestType iType = ItemsOfInterest.IsItItemOfInterest(item,this, out extraParam);
                if (iType != ItemsOfInterest.InterestType.None)
                {
                    if (iType == ItemsOfInterest.InterestType.RareNameMatch && extraParam >= 3)
                        FindAlchemyItemsByName(item.Name, extraParam);
                    //else if (iType == ItemsOfInterest.InterestType.HighQualityRare)
                    //    PrintHighQualityItem(item, extraParam);
                }

            }
            //TreeView in ui to show
            ItemsByCatForListView.AddItem(item);
            ItemsByOwner[item.Owner].Add(item);
        }
Example #25
0
 /// <summary>
 /// Clipboards the lurker newitem.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 private void MouseLurker_Newitem(object sender, PoeItem e)
 {
     this.IsItemOverlayOpen    = false;
     this.ItemOverlayViewModel = new ItemOverlayViewModel(e, () => { this.IsItemOverlayOpen = false; });
     this.IsItemOverlayOpen    = true;
 }
Example #26
0
 public void DelItem(PoeItem item)
 {
     ItemsList.Remove(item);
     OnPropertyChanged("ItemCountDisplay");
 }
Example #27
0
 /// <summary>
 /// Deletes item from all distributed tables except AllItems
 /// </summary>
 /// <param name="item">item</param>
 private void DelDistributedItem(PoeItem item)
 {
     ItemsByOwner[item.Owner].Remove(item);
     ItemsByCatForListView.DelItem(item);
     if (item.FrameType == PoeItem.FrameTypeIndex.Rare && item.Identified == true)
     {
         int i = --RareItemNames[item.Name];
         if (i == 0)
             RareItemNames.Remove(item.Name);
     }
 }
Example #28
0
 /// <summary>
 /// Gets the total dexterity.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>The sum of dexterity.</returns>
 public static double GetTotalDexterity(PoeItem item)
 {
     return(AffixSum(AttributeAffixes.DexterityTexts, item));
 }
Example #29
0
 internal CatSubCat(PoeItem.ClassIndex classIndex, InternalArmorCat cat)
 {
     ClassIndex = classIndex;
     SlotIndex = (int)cat + InternalArmorCatOffset[(int)ClassIndex];
 }
Example #30
0
 /// <summary>
 /// Gets the total intelligence.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>The sum of Intelligence</returns>
 public static double GetTotalIntelligence(PoeItem item)
 {
     return(AffixSum(AttributeAffixes.IntelligenceTexts, item));
 }
Example #31
0
 public void DelItem(PoeItem item)
 {
     ItemsList.Remove(item);
     OnPropertyChanged("ItemCountDisplay");
 }
Example #32
0
 /// <summary>
 /// Gets the total lightning resistance.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>The sum of lightning resistance.</returns>
 public static double GetTotalLightningResistance(PoeItem item)
 {
     return(AffixSum(ResistanceAffixes.LightningResistanceTexts, item));
 }
Example #33
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ItemOverlayViewModel"/> class.
 /// </summary>
 public ItemOverlayViewModel(PoeItem item, Action closeAction)
 {
     this._item             = item;
     this._closeAction      = closeAction;
     this.SocketInformation = GetSocketInformation(item);
 }
Example #34
0
 /// <summary>
 /// Gets the total fire resistance.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>The sum of fire resistance.</returns>
 public static double GetTotalFireResistance(PoeItem item)
 {
     return(AffixSum(ResistanceAffixes.FireResistanceTexts, item));
 }
Example #35
0
 private void PrintHighQualityItem(PoeItem item, int Quality)
 {
     AddLog("[" + StaticVariables.LeagueNames[(int)LeagueIndex] + "]: [" + item.TypeLine + "] " + Quality + "%: " + item.Name + " [" + item.Owner + " " + item.StashName + " " + item.PosX + "x" + item.PosY + "]");
 }
Example #36
0
 public void DelItem(PoeItem item)
 {
     ClassCatList[(int)item.ClassCategory].DelItem(item);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ItemOverlayViewModel" /> class.
 /// </summary>
 /// <param name="item">The item.</param>
 public ItemOverlayViewModel(PoeItem item)
 {
     this._item             = item;
     this.SocketInformation = GetSocketInformation(item);
 }
Example #38
0
 private void RecheckStashIndex(PoeItem item)
 {
     if (!OwnerStashNames.ContainsKey(item.Owner))
         OwnerStashNames.Add(item.Owner, new SortedSet<string>());
     if (!OwnerStashNames[item.Owner].Contains(item.StashName))
         OwnerStashNames[item.Owner].Add(item.StashName);
 }
Example #39
0
 public CatSubCat(PoeItem.ClassIndex classIndex = PoeItem.ClassIndex.Misc, int slotIndex = 0)
 {
     ClassIndex = classIndex;
     SlotIndex = slotIndex;
 }
Example #40
0
 public void AddItem(PoeItem item)
 {
     ClassCatList[(int)item.ClassCategory].AddItem(item);
 }
Example #41
0
        public static CatSubCat Find(PoeItem i)
        {
            try
            {
                string typeLine = i.TypeLine;
                if (i.FrameType == PoeItem.FrameTypeIndex.Unique)
                    return UniqueCat;
                if (typeLine.StartsWith("Superior "))
                    typeLine = typeLine.Remove(0, 9);

                if (ItemTree.ContainsKey(typeLine))
                {
                    var csc = ItemTree[typeLine];
                    if (csc.MultiIndexByProperty != null)
                    {
                        if (i.ItemProperties.Count == 0)
                            return DefaultCat;

                        string firstProperty = i.ItemProperties.First().Name;
                        if (csc.MultiIndexByProperty.ContainsKey(firstProperty))
                            return csc.MultiIndexByProperty[firstProperty];
                        else
                            return DefaultCat;
                    }
                    else
                        return csc;
                }

                if (i.TypeLine.EndsWith("Belt") || i.TypeLine == "Rustic Sash")
                    return BeltCat;
                else if (i.TypeLine.EndsWith("Ring"))
                    return RingCat;
                else if (i.TypeLine.EndsWith("Amulet"))
                    return AmuletCat;

                if (i.ItemProperties.Count != 0 && i.ItemProperties[0].Name == "Map Level")
                    return MapCat;
                if (i.TypeLine.Contains("Life Flask"))
                    return HpCat;
                if (i.TypeLine.Contains("Mana Flask"))
                    return ManaCat;
                if (i.TypeLine.Contains("Flask"))
                    return OtherCat;
            }
            catch (Exception)
            {
            }
            return null;
        }
Example #42
0
 public void AddItem(PoeItem item)
 {
     ItemsList.Add(item);
     OnPropertyChanged("ItemCountDisplay");
 }