Exemple #1
0
        private static bool ShouldSell(string sellName)
        {
            try
            {
                foreach (PItem item in Inventory.GetItemsInBags)
                {
                    try
                    {
                        if (ItemDatabase.GetItem(item.EntryId.ToString()) != null)
                        {
                            string name    = ItemDatabase.GetItem(item.EntryId.ToString())["item_name"].ToString();
                            string quality = ItemDatabase.GetItem(item.EntryId.ToString())["item_quality"].ToString();
                            if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(quality))
                            {
                                if (name != sellName)
                                {
                                    continue;
                                }
                                if (MailList.ShouldMail(name))
                                {
                                    continue;
                                }
                                if (ProtectedList.ShouldVendor(name))
                                {
                                    switch (quality)
                                    {
                                    case "Poor":
                                        if (LazySettings.SellPoor)
                                        {
                                            return(true);
                                        }
                                        break;

                                    case "Common":
                                        if (LazySettings.SellCommon)
                                        {
                                            return(true);
                                        }
                                        break;

                                    case "UnCommon":
                                        if (LazySettings.SellUncommon)
                                        {
                                            return(true);
                                        }
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                Logging.Write(string.Format("[Vendor]Could not detect the name of: {0} is wowhead down?", item.EntryId));
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Logging.Debug("Exception in ShouldSell (Loop): {0}", e);
                    }
                }
            }
            catch (Exception e)
            {
                Logging.Debug("Exception in ShouldSell: {0}", e);
            }
            return(false);
        }