예제 #1
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      = TQColorHelper.RemoveLeadingColorTag(ItemProvider.ToFriendlyName(item));
            ItemStyle computedItemStyle = item.ItemStyle;

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

            this.RequiredLevel = GetRequirement(requirementVariables, "levelRequirement");
        }
예제 #2
0
        /// <summary>
        /// Gets a color tag for a line of text
        /// </summary>
        /// <param name="text">text containing the color tag</param>
        /// <returns>System.Drawing.Color of the embedded color code</returns>
        public static Color GetColor(this Item itm, string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                // Use the standard color code for the item
                return(Color(itm.ItemStyle));
            }

            // Look for a formatting tag in the beginning of the string
            TQColor?colorCode = TQColorHelper.GetColorFromTaggedString(text);

            // We didn't find a code so use the standard color code for the item
            if (colorCode is null)
            {
                return(Color(itm.ItemStyle));
            }

            // We found something so lets try to find the code
            return(Color(colorCode.Value));
        }