Exemple #1
0
        /// <summary>
        /// Gets the string name for the corresponding SackType
        /// </summary>
        /// <param name="containterType">SackType which we are looking up</param>
        /// <returns>string containing the sack type</returns>
        private static string GetContainerTypeString(SackType containterType)
        {
            switch (containterType)
            {
            case SackType.Vault:
                return(Resources.ResultsContainerVault);

            case SackType.Player:
                return(Resources.ResultsContainerPlayer);

            case SackType.Equipment:
                return(Resources.ResultsContainerEquip);

            case SackType.Stash:
                return(Resources.ResultsContainerStash);

            case SackType.TransferStash:
                return(Resources.GlobalTransferStash);

            case SackType.RelicVaultStash:
                return(Resources.GlobalRelicVaultStash);

            default:
                return("Unknown");
            }
        }
Exemple #2
0
 /// <summary>
 /// Advanced Ctrs
 /// </summary>
 /// <param name="container"></param>
 /// <param name="containerName"></param>
 /// <param name="sackNumber"></param>
 /// <param name="sackType"></param>
 /// <param name="fnames"></param>
 public Result(string container, string containerName, int sackNumber, SackType sackType, Lazy <ToFriendlyNameResult> fnames)
 {
     this.Container               = container ?? throw new ArgumentNullException(nameof(container));
     this.ContainerName           = containerName ?? throw new ArgumentNullException(nameof(containerName));
     this.SackNumber              = sackNumber;
     this.SackType                = sackType;
     this.FriendlyNamesLazyLoader = fnames ?? throw new ArgumentNullException(nameof(fnames));
 }
Exemple #3
0
        /// <summary>
        /// Searches all loaded stashes including transfer stash.
        /// </summary>
        /// <param name="predicate">Predicate that the items should match</param>
        /// <param name="results">List holding the search results.</param>
        private void SearchStashes(IItemPredicate predicate, List <Result> results)
        {
            if (this.UserContext.Stashes == null || this.UserContext.Stashes.Count == 0)
            {
                return;
            }

            foreach (KeyValuePair <string, Stash> kvp in this.UserContext.Stashes)
            {
                string stashFile = kvp.Key;
                Stash  stash     = kvp.Value;

                // Make sure we have a valid name and stash.
                if (stash == null)
                {
                    Log.WarnFormat(CultureInfo.InvariantCulture, "stashFile={0} returned null stash.", stashFile);
                    continue;
                }

                string stashName = GetNameFromFile(stashFile);
                if (stashName == null)
                {
                    Log.WarnFormat(CultureInfo.InvariantCulture, "stashFile={0} returned null stashName.", stashFile);
                    continue;
                }

                SackCollection sack = stash.Sack;
                if (sack == null)
                {
                    Log.WarnFormat(CultureInfo.InvariantCulture, "stashFile={0} returned null sack.", stashFile);
                    continue;
                }

                int      sackNumber = 2;
                SackType sackType   = SackType.Stash;
                if (stashName == Resources.GlobalTransferStash)
                {
                    sackNumber = 1;
                    sackType   = SackType.TransferStash;
                }
                else if (stashName == Resources.GlobalRelicVaultStash)
                {
                    sackNumber = 3;
                    sackType   = SackType.RelicVaultStash;
                }

                foreach (var fnames in QuerySack(predicate, sack))
                {
                    results.Add(new Result(
                                    stashFile,
                                    stashName,
                                    sackNumber,
                                    sackType,
                                    fnames
                                    ));
                }
            }
        }
Exemple #4
0
 public Result(string container, string containerName, int sackNumber, SackType sackType, ToFriendlyNameResult fnames)
 {
     this.Container     = container ?? throw new ArgumentNullException(nameof(container));
     this.ContainerName = containerName ?? throw new ArgumentNullException(nameof(containerName));
     this.SackNumber    = sackNumber;
     this.SackType      = sackType;
     this.FriendlyNames = fnames ?? throw new ArgumentNullException(nameof(fnames));
     this.ItemName      = fnames.FullNameClean;
     this.ItemStyle     = fnames.Item.ItemStyle;
     this.TQColor       = fnames.Item.ItemStyle.TQColor();
     this.RequiredLevel = GetRequirement(fnames.RequirementVariables.Values, "levelRequirement");
 }
Exemple #5
0
        public Result(string container, string containerName, int sackNumber, SackType sackType, Item item)
        {
            this.Container     = container ?? throw new ArgumentNullException(nameof(container));
            this.ContainerName = containerName ?? throw new ArgumentNullException(nameof(containerName));
            this.SackNumber    = sackNumber;
            this.SackType      = sackType;
            this.Item          = item ?? throw new ArgumentNullException(nameof(item));
            this.ItemName      = Entities.Item.ClipColorTag(ItemProvider.ToFriendlyName(item));
            ItemStyle computedItemStyle = item.ItemStyle;

            this.ItemStyle = ItemStyleHelper.Translate(computedItemStyle);
            this.Color     = ItemGfxHelper.GetColor(computedItemStyle);
            var requirementVariables = ItemProvider.GetRequirementVariables(item).Values;

            this.RequiredLevel = GetRequirement(requirementVariables, "levelRequirement");
        }
Exemple #6
0
        public Result(string container, string containerName, int sackNumber, SackType sackType, Item item)
        {
            this.container     = container ?? throw new ArgumentNullException(nameof(container));
            this.containerName = containerName ?? throw new ArgumentNullException(nameof(containerName));
            this.sackNumber    = sackNumber;
            this.sackType      = sackType;
            this.item          = item ?? throw new ArgumentNullException(nameof(item));

            this.itemName = Item.ClipColorTag(item.ToString());

            ItemStyle computedItemStyle = item.ItemStyle;

            this.itemStyle = MainForm.GetItemStyleString(computedItemStyle);
            this.color     = Item.GetColor(computedItemStyle);

            var requirementVariables = item.GetRequirementVariables().Values;

            this.requiredLevel = GetRequirement(requirementVariables, "levelRequirement");
        }
Exemple #7
0
 /// <summary>
 /// Initializes a new instance of the SackCollection class.
 /// </summary>
 public SackCollection()
 {
     this.items    = new List <Item>();
     this.sackType = SackType.Sack;
 }