Ejemplo n.º 1
0
        TextSnippet ITagHandler.Parse(string text, Color baseColor, string options)
        {
            Item obj = new Item();
            int result1;
            if (int.TryParse(text, out result1))
                obj.netDefaults(result1);
            else
                obj.SetDefaults(text);

            if (obj.itemId <= 0)
                return new TextSnippet(text);

            obj.stack = 1;
            if (options != null)
            {
                string[] strArray = options.Split(',');
                for (int index = 0; index < strArray.Length; ++index)
                {
                    if (strArray[index].Length != 0)
                    {
                        switch (strArray[index][0])
                        {
                            case 'p':
                                int result2;
                                if (int.TryParse(strArray[index].Substring(1), out result2))
                                {
                                    obj.Prefix(Utils.Clamp<int>(result2, 0, 84));
                                    continue;
                                }
                                continue;
                            case 's':
                            case 'x':
                                int result3;
                                if (int.TryParse(strArray[index].Substring(1), out result3))
                                {
                                    obj.stack = Utils.Clamp<int>(result3, 1, obj.maxStack);
                                    continue;
                                }
                                continue;
                            default:
                                continue;
                        }
                    }
                }
            }

            string str = "";
            if (obj.stack > 1)
                str = " (" + obj.stack + ")";

            ItemSnippet itemSnippet = new ItemSnippet(obj);
            itemSnippet.Text = "[" + obj.AffixName() + str + "]";
            itemSnippet.CheckForHover = true;
            itemSnippet.DeleteWhole = true;
            return itemSnippet;
        }
Ejemplo n.º 2
0
        TextSnippet ITagHandler.Parse(string text, Color baseColor, string options)
        {
            Item item = new Item();

            if (int.TryParse(text, out int result))
            {
                item.netDefaults(result);
            }
            else
            {
                item.SetDefaults(text);
            }
            if (item.type <= 0)
            {
                return(new TextSnippet(text));
            }
            item.stack = 1;
            if (options != null)
            {
                string[] array = options.Split(',');
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i].Length == 0)
                    {
                        continue;
                    }
                    switch (array[i][0])
                    {
                    case 's':
                    case 'x':
                    {
                        if (int.TryParse(array[i].Substring(1), out int result3))
                        {
                            item.stack = Utils.Clamp(result3, 1, item.maxStack);
                        }
                        break;
                    }

                    case 'p':
                    {
                        if (int.TryParse(array[i].Substring(1), out int result2))
                        {
                            item.Prefix((byte)Utils.Clamp(result2, 0, 84));
                        }
                        break;
                    }
                    }
                }
            }
            string str = "";

            if (item.stack > 1)
            {
                str = " (" + item.stack + ")";
            }
            ItemSnippet itemSnippet = new ItemSnippet(item);

            itemSnippet.Text          = "[" + item.AffixName() + str + "]";
            itemSnippet.CheckForHover = true;
            itemSnippet.DeleteWhole   = true;
            return(itemSnippet);
        }
Ejemplo n.º 3
0
        TextSnippet ITagHandler.Parse(string text, Color baseColor, string options)
        {
            Item obj = new Item();
            int  result1;

            if (int.TryParse(text, out result1))
            {
                obj.netDefaults(result1);
            }
            else
            {
                obj.SetDefaults(text);
            }

            if (obj.itemId <= 0)
            {
                return(new TextSnippet(text));
            }

            obj.stack = 1;
            if (options != null)
            {
                string[] strArray = options.Split(',');
                for (int index = 0; index < strArray.Length; ++index)
                {
                    if (strArray[index].Length != 0)
                    {
                        switch (strArray[index][0])
                        {
                        case 'p':
                            int result2;
                            if (int.TryParse(strArray[index].Substring(1), out result2))
                            {
                                obj.Prefix(Utils.Clamp <int>(result2, 0, 84));
                                continue;
                            }
                            continue;

                        case 's':
                        case 'x':
                            int result3;
                            if (int.TryParse(strArray[index].Substring(1), out result3))
                            {
                                obj.stack = Utils.Clamp <int>(result3, 1, obj.maxStack);
                                continue;
                            }
                            continue;

                        default:
                            continue;
                        }
                    }
                }
            }

            string str = "";

            if (obj.stack > 1)
            {
                str = " (" + obj.stack + ")";
            }

            ItemSnippet itemSnippet = new ItemSnippet(obj);

            itemSnippet.Text          = "[" + obj.AffixName() + str + "]";
            itemSnippet.CheckForHover = true;
            itemSnippet.DeleteWhole   = true;
            return(itemSnippet);
        }