Example #1
0
        public static StashItemsFiltered chooseItem(List <StashItemsFiltered> items, bool lowLvl)
        {
            StashItemsFiltered result = null;

            foreach (var item in items)
            {
                if (lowLvl)
                {
                    if (item.itlvl < 75)
                    {
                        result = item;
                        lowLvl = false;
                    }
                }
                else
                {
                    if (item.itlvl > 74)
                    {
                        result = item;
                    }
                }
            }
            if (result == null)
            {
                result = items[0];
            }

            return(result);
        }
Example #2
0
        private StashItemsFiltered copyStashItem(StashItemsFiltered inputItem)
        {
            StashItemsFiltered result = new StashItemsFiltered();

            result.category    = inputItem.category;
            result.subCategory = inputItem.subCategory;
            result.icon        = inputItem.icon;
            result.id          = inputItem.id;
            result.itlvl       = inputItem.itlvl;
            result.typeName    = inputItem.typeName;
            result.x           = inputItem.x;
            result.y           = inputItem.y;
            result.w           = inputItem.w;
            result.h           = inputItem.h;
            result.quadLayout  = inputItem.quadLayout;
            result.picked      = inputItem.picked;

            return(result);
        }
Example #3
0
        private void button3_Click(object sender, EventArgs e)
        {
            List <StashItemsFiltered> set = null;
            int setsNo = SetCalculation.HowManySets(itemsPerType);

            if (setsNo > 0)
            {
                Dictionary <string, List <StashItemsFiltered> > itemsPerTypeCopy = new Dictionary <string, List <StashItemsFiltered> >();
                foreach (var typeEntry in itemsPerType)
                {
                    List <StashItemsFiltered> newList = new List <StashItemsFiltered>();
                    foreach (StashItemsFiltered item in typeEntry.Value)
                    {
                        StashItemsFiltered newItem = copyStashItem(item);
                        newList.Add(newItem);
                    }
                    itemsPerTypeCopy.Add(typeEntry.Key, newList);
                }

                set = SetCalculation.MakeSets(itemsPerTypeCopy);

                kb.SendDown(Keys.ControlKey);
                {
                    foreach (StashItemsFiltered item in set)
                    {
                        Tuple <int, int> click = Coordinates.GetClickCoordinates(item.x, item.y, item.quadLayout);
                        Thread.Sleep(50);
                        mouse.MouseLeftClick(click.Item1, click.Item2);
                    }
                }
                kb.SendUp(Keys.ControlKey);

                Thread.Sleep(2000);
                RefreshStash();
            }
        }
Example #4
0
        public static StashItemsFiltered RemoveItem(Dictionary <string, List <StashItemsFiltered> > items, string type, bool lowLvl)
        {
            StashItemsFiltered thisItem = null;

            if (type != "weapon")
            {
                thisItem = chooseItem(items[type], lowLvl);
            }
            else
            {
                List <StashItemsFiltered> weapons2h = items["weapon"].Where(i => i.category == "weapon2h").ToList();
                List <StashItemsFiltered> weapons1h = items["weapon"].Where(i => i.category == "weapon1h").ToList();
                if (weapons2h.Count > 0)
                {
                    thisItem = chooseItem(weapons2h, lowLvl);
                }
                else
                {
                    thisItem = chooseItem(weapons1h, lowLvl);
                }
            }
            items[type].Remove(thisItem);
            return(thisItem);
        }
Example #5
0
        public static List <StashItemsFiltered> MakeSets(Dictionary <string, List <StashItemsFiltered> > itemsPerType)
        {
            List <StashItemsFiltered> result = new List <StashItemsFiltered>();
            bool lowLvl = true;

            foreach (var itemTypeEntry in itemsPerType)
            {
                StashItemsFiltered newItem = RemoveItem(itemsPerType, itemTypeEntry.Key, lowLvl);
                result.Add(newItem);// (newItem.category+" iLvl:"+newItem.itlvl + " id:" + newItem.id);

                if (newItem.category == "ring")
                {
                    StashItemsFiltered secondRing = RemoveItem(itemsPerType, itemTypeEntry.Key, lowLvl);
                    result.Add(secondRing); //(secondRing.category + " iLvl:" + newItem.itlvl + " id:" + secondRing.id);
                }

                if (newItem.category == "weapon1h")
                {
                    StashItemsFiltered secondWeapon1h = RemoveItem(itemsPerType, itemTypeEntry.Key, lowLvl);
                    result.Add(secondWeapon1h);//(secondWeapon1h.category + " iLvl:" + newItem.itlvl + " id:" + secondWeapon1h.id);
                }
            }
            return(result);
        }
Example #6
0
        public static List <StashItemsFiltered> GetStashItemsFromWeb(string acc, string stashNo)
        {
            string url = "https://pathofexile.com/character-window/get-stash-items?league=bestiary&tabs=0&tabIndex=" + stashNo + "&accountName=" + acc;
            IEnumerable <Tuple <string, string> > results = WebTools.ReadCookies(".pathofexile.com");
            Tuple <string, string> result = results.Where(x => x.Item1 == "POESESSID").First();

            string json = WebTools.getPrivateStashJSON(result.Item2, url);
            //do to: read cookie expiration date, read new cookie only when expired.

            //string json = WebTools.getPrivateStashJSON("8dcfe28b4cd5d1ca884e2f2d539f8057", url);

            JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();

            jsonSerializer.MaxJsonLength = Int32.MaxValue;
            PrivateStash ro = jsonSerializer.Deserialize <PrivateStash>(json);
            List <StashItemsFiltered> myStash = new List <StashItemsFiltered>();
            int hel = 0;

            foreach (var item in ro.items)
            {
                StashItemsFiltered newItem = new StashItemsFiltered();
                newItem.quadLayout = ro.quadLayout;
                Dictionary <string, object> bla = (Dictionary <string, object>)item;

                foreach (var propertyEntry in bla)
                {
                    switch (propertyEntry.Key)
                    {
                    case "category":
                    {
                        Dictionary <string, object> categoryDict = (Dictionary <string, object>)propertyEntry.Value;

                        foreach (var categoryEntry in categoryDict)
                        {
                            newItem.category = categoryEntry.Key;
                            object[] subCat = (object[])categoryEntry.Value;
                            if (subCat.Count() > 0)
                            {
                                newItem.subCategory = subCat[0].ToString();
                            }
                            if (newItem.subCategory == "helmet")
                            {
                                hel++;
                            }
                        }
                        break;
                    }

                    case "typeLine":
                    {
                        string typeLinel = (string)propertyEntry.Value;
                        newItem.typeName = typeLinel;
                        break;
                    }

                    case "icon":
                    {
                        string icon = (string)propertyEntry.Value;
                        newItem.icon = icon;
                        break;
                    }

                    case "id":
                    {
                        string id = (string)propertyEntry.Value;
                        newItem.id = id;
                        break;
                    }

                    case "ilvl":
                    {
                        Int32 ilvl = (Int32)propertyEntry.Value;
                        newItem.itlvl = ilvl;
                        break;
                    }

                    case "x":
                    {
                        Int32 x = (Int32)propertyEntry.Value;
                        newItem.x = x;
                        break;
                    }

                    case "y":
                    {
                        Int32 y = (Int32)propertyEntry.Value;
                        newItem.y = y;
                        break;
                    }

                    case "w":
                    {
                        Int32 w = (Int32)propertyEntry.Value;
                        newItem.w = w;
                        break;
                    }

                    case "h":
                    {
                        Int32 h = (Int32)propertyEntry.Value;
                        newItem.h = h;
                        break;
                    }
                    }
                }

                myStash.Add(newItem);
            }
            Debug.WriteLine("Helmets: " + hel);
            return(myStash);
        }