示例#1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            reader.ReadInt();

            Level    = (SecureLevel)reader.ReadInt();
            BookName = reader.ReadString();
            Filter   = new RecipeScrollFilter(reader);

            int count = reader.ReadInt();

            Recipes = new List <RecipeScrollDefinition>();

            for (int i = count; i > 0; i--)
            {
                int             id     = reader.ReadInt();
                int             rid    = reader.ReadInt();
                Expansion       ex     = (Expansion)reader.ReadInt();
                RecipeSkillName skill  = (RecipeSkillName)reader.ReadInt();
                int             amount = reader.ReadInt();
                int             price  = reader.ReadInt();

                Recipes.Add(new RecipeScrollDefinition(id, rid, ex, skill, amount, price));
            }

            ReLoadDefinitions();
        }
示例#2
0
 public RecipeBook()
     : base(0xA266)
 {
     Weight   = 1.0;
     LootType = LootType.Blessed;
     LoadDefinitions();
     Filter = new RecipeScrollFilter();
     Level  = SecureLevel.CoOwners;
 }
示例#3
0
        public RecipeScrollFilterGump(Mobile from, RecipeBook book)
            : base(12, 24)
        {
            from.CloseGump(typeof(RecipeBookGump));
            from.CloseGump(typeof(RecipeScrollFilterGump));

            m_From = from;
            m_Book = book;

            RecipeScrollFilter f = book.Filter;

            AddPage(0);

            AddBackground(10, 10, 600, 375, 0x13BE);

            AddImageTiled(18, 20, 583, 356, 0xA40);
            AddAlphaRegion(18, 20, 583, 356);

            AddImage(0, 0, 0x28DC);
            AddImage(590, 0, 0x28DC);
            AddImage(0, 365, 0x28DC);
            AddImage(590, 365, 0x28DC);

            AddHtmlLocalized(26, 64, 120, 32, 1158816, TitleLabelColor, false, false);  // Crafting
            AddHtmlLocalized(270, 32, 200, 32, 1062223, TitleLabelColor, false, false); // Filter Preference

            AddHtmlLocalized(26, 64, 120, 32, 1158816, TitleLabelColor, false, false);  // Crafting
            AddFilterList(25, 96, m_XOffsets_Skill, 32, m_SkillFilters, 32, f.Skill, 0);

            AddHtmlLocalized(26, 192, 120, 42, 1158814, TitleLabelColor, false, false); // Expansion
            AddFilterList(25, 224, m_XOffsets_Expansion, 32, m_ExpansionFilters, 42, f.Expansion, 1);

            AddHtmlLocalized(26, 256, 120, 32, 1062217, TitleLabelColor, false, false); // Amount
            AddFilterList(25, 288, m_XOffsets_Amount, 32, m_AmountFilters, 32, f.Amount, 2);

            AddHtmlLocalized(75, 352, 120, 32, 1062477, (((PlayerMobile)from).UseOwnFilter ? LabelColor : 16927), false, false); // Set Book Filter
            AddButton(40, 352, 4005, 4007, 1, GumpButtonType.Reply, 0);

            AddHtmlLocalized(235, 352, 120, 32, 1062478, (((PlayerMobile)from).UseOwnFilter ? 16927 : LabelColor), false, false); // Set Your Filter
            AddButton(200, 352, 4005, 4007, 2, GumpButtonType.Reply, 0);

            AddHtmlLocalized(405, 352, 120, 32, 1062231, TitleLabelColor, false, false); // Clear Filter
            AddButton(370, 352, 4005, 4007, 3, GumpButtonType.Reply, 0);

            AddHtmlLocalized(540, 352, 50, 32, 1011046, TitleLabelColor, false, false); // APPLY
            AddButton(505, 352, 4017, 4018, 0, GumpButtonType.Reply, 0);
        }
示例#4
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            case 0:
                Level    = (SecureLevel)reader.ReadInt();
                BookName = reader.ReadString();
                Filter   = new RecipeScrollFilter(reader);

                int count = reader.ReadInt();

                Recipes = new List <RecipeScrollDefinition>();

                for (int i = count; i > 0; i--)
                {
                    int             id     = reader.ReadInt();
                    int             rid    = reader.ReadInt();
                    Expansion       ex     = (Expansion)reader.ReadInt();
                    RecipeSkillName skill  = (RecipeSkillName)reader.ReadInt();
                    int             amount = reader.ReadInt();
                    int             price  = reader.ReadInt();

                    Recipes.Add(new RecipeScrollDefinition(id, rid, ex, skill, amount, price));
                }

                ReLoadDefinitions();

                break;
            }

            if (version == 0)
            {
                LootType = LootType.Blessed;
            }
        }
示例#5
0
        public RecipeBookGump(Mobile from, RecipeBook book, int page, List <RecipeScrollDefinition> list)
            : base(12, 24)
        {
            from.CloseGump(typeof(RecipeBookGump));
            from.CloseGump(typeof(RecipeScrollFilterGump));

            m_Book = book;
            m_Page = page;

            if (list == null)
            {
                list = new List <RecipeScrollDefinition>();

                m_Book.Recipes.ForEach(x =>
                {
                    if (CheckFilter(x))
                    {
                        list.Add(x);
                    }
                });
            }

            m_List = list;

            int index = GetIndexForPage(page);
            int count = GetCountForIndex(index);

            int tableIndex = 0;

            PlayerVendor pv = book.RootParent as PlayerVendor;

            bool canLocked = book.IsLockedDown;
            bool canDrop   = book.IsChildOf(from.Backpack);
            bool canBuy    = (pv != null);
            bool canPrice  = (canDrop || canBuy || canLocked);

            if (canBuy)
            {
                VendorItem vi = pv.GetVendorItem(book);

                canBuy = (vi != null && !vi.IsForSale);
            }

            int width = 600;

            if (!canPrice)
            {
                width = 516;
            }

            X = (624 - width) / 2;

            AddPage(0);

            AddBackground(10, 10, width, 439, 5054);
            AddImageTiled(18, 20, width - 17, 420, 2624);

            if (canPrice)
            {
                AddImageTiled(573, 64, 24, 352, 200);
                AddImageTiled(493, 64, 78, 352, 1416);
            }

            if (canDrop)
            {
                AddImageTiled(24, 64, 32, 352, 1416);
            }

            AddImageTiled(58, 64, 36, 352, 200);
            AddImageTiled(96, 64, 133, 352, 1416);
            AddImageTiled(231, 64, 80, 352, 200);
            AddImageTiled(313, 64, 100, 352, 1416);
            AddImageTiled(415, 64, 76, 352, 200);

            list = list.OrderBy(x => x.ID).ToList();

            for (int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i)
            {
                var recipe = list[i];

                if (!CheckFilter(recipe))
                {
                    continue;
                }

                AddImageTiled(24, 94 + (tableIndex * 32), canPrice ? 573 : 489, 2, 2624);

                ++tableIndex;
            }

            AddAlphaRegion(18, 20, width - 17, 420);
            AddImage(0, 0, 10460);
            AddImage(width - 15, 5, 10460);
            AddImage(0, 429, 10460);
            AddImage(width - 15, 429, 10460);

            AddHtmlLocalized(266, 32, 200, 32, 1158810, LabelColor, false, false); // Recipe Book

            AddHtmlLocalized(147, 64, 200, 32, 1062214, LabelColor, false, false); // Item
            AddHtmlLocalized(246, 64, 200, 32, 1158814, LabelColor, false, false); // Expansion
            AddHtmlLocalized(336, 64, 200, 32, 1158816, LabelColor, false, false); // Crafting
            AddHtmlLocalized(429, 64, 100, 32, 1062217, LabelColor, false, false); // Amount

            AddHtmlLocalized(70, 32, 200, 32, 1062476, LabelColor, false, false);  // Set Filter
            AddButton(35, 32, 4005, 4007, 1, GumpButtonType.Reply, 0);

            RecipeScrollFilter f = book.Filter;

            if (f.IsDefault)
            {
                AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927, false, false); // Using No Filter
            }
            else if (((PlayerMobile)from).UseOwnFilter)
            {
                AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927, false, false); // Using Your Filter
            }
            else
            {
                AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927, false, false); // Using Book Filter
            }
            AddButton(375, 416, 4017, 4018, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(410, 416, 120, 20, 1011441, LabelColor, false, false); // EXIT

            if (canDrop)
            {
                AddHtmlLocalized(26, 64, 50, 32, 1062212, LabelColor, false, false); // Drop
            }
            if (canPrice)
            {
                AddHtmlLocalized(516, 64, 200, 32, 1062218, LabelColor, false, false); // Price

                if (canBuy)
                {
                    AddHtmlLocalized(576, 64, 200, 32, 1062219, LabelColor, false, false); // Buy
                }
                else
                {
                    AddHtmlLocalized(576, 64, 200, 32, 1062227, LabelColor, false, false); // Set
                }
            }

            tableIndex = 0;

            if (page > 0)
            {
                AddButton(75, 416, 4014, 4016, 2, GumpButtonType.Reply, 0);
                AddHtmlLocalized(110, 416, 150, 20, 1011067, LabelColor, false, false); // Previous page
            }

            if (GetIndexForPage(page + 1) < list.Count)
            {
                AddButton(225, 416, 4005, 4007, 3, GumpButtonType.Reply, 0);
                AddHtmlLocalized(260, 416, 150, 20, 1011066, LabelColor, false, false); // Next page
            }

            for (int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i)
            {
                var recipe = list[i];

                if (!CheckFilter(recipe) || !Recipe.Recipes.ContainsKey(recipe.RecipeID))
                {
                    continue;
                }

                int y = 96 + (tableIndex++ *32);

                if (recipe.Amount > 0 && (canDrop || canLocked))
                {
                    AddButton(35, y + 2, 5602, 5606, 4 + (i * 2), GumpButtonType.Reply, 0);
                }

                AddLabel(61, y, 0x480, string.Format("{0}", recipe.ID));
                AddHtmlLocalized(103, y, 130, 32, Recipe.Recipes[recipe.RecipeID].TextDefinition.Number, "#103221", 0xFFFFFF, false, false); // ~1_val~
                AddLabel(235, y, 0x480, GetExpansion(recipe.Expansion));
                AddHtmlLocalized(316, y, 100, 20, GetSkillName(recipe.Skill), "#104409", 0xFFFFFF, false, false);                            // ~1_val~
                AddLabel(421, y, 0x480, recipe.Amount.ToString());

                if (canDrop || (canBuy && recipe.Price > 0))
                {
                    AddButton(579, y + 2, 2117, 2118, 5 + (i * 2), GumpButtonType.Reply, 0);
                    AddLabel(495, y, 1152, recipe.Price.ToString("N0"));
                }
            }
        }
示例#6
0
        public bool CheckFilter(RecipeScrollDefinition recipe)
        {
            RecipeScrollFilter f = m_Book.Filter;

            if (f.IsDefault)
            {
                return(true);
            }

            if (f.Skill == 1 && recipe.Skill != RecipeSkillName.Blacksmith)
            {
                return(false);
            }
            else if (f.Skill == 2 && recipe.Skill != RecipeSkillName.Tailoring)
            {
                return(false);
            }
            else if (f.Skill == 3 && recipe.Skill != RecipeSkillName.Fletching)
            {
                return(false);
            }
            else if (f.Skill == 4 && recipe.Skill != RecipeSkillName.Carpentry && recipe.Skill != RecipeSkillName.Masonry)
            {
                return(false);
            }
            else if (f.Skill == 5 && recipe.Skill != RecipeSkillName.Inscription)
            {
                return(false);
            }
            else if (f.Skill == 6 && recipe.Skill != RecipeSkillName.Cooking)
            {
                return(false);
            }
            else if (f.Skill == 7 && recipe.Skill != RecipeSkillName.Alchemy)
            {
                return(false);
            }
            else if (f.Skill == 8 && recipe.Skill != RecipeSkillName.Tinkering)
            {
                return(false);
            }
            else if (f.Skill == 9 && recipe.Skill != RecipeSkillName.Cartography)
            {
                return(false);
            }

            if (f.Expansion == 1 && recipe.Expansion != Expansion.ML)
            {
                return(false);
            }
            else if (f.Expansion == 2 && recipe.Expansion != Expansion.SA)
            {
                return(false);
            }
            else if (f.Expansion == 3 && recipe.Expansion != Expansion.TOL)
            {
                return(false);
            }


            if (f.Amount == 1 && recipe.Amount == 0)
            {
                return(false);
            }

            return(true);
        }
示例#7
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            RecipeScrollFilter f = m_Book.Filter;

            int index = info.ButtonID;

            switch (index)
            {
            case 0:     // APPLY
            {
                m_From.SendGump(new RecipeBookGump(m_From, m_Book));

                break;
            }

            case 1:     // Set Book Filter
            {
                ((PlayerMobile)m_From).UseOwnFilter = false;
                m_From.SendGump(new RecipeScrollFilterGump(m_From, m_Book));

                break;
            }

            case 2:     // Set Your Filter
            {
                ((PlayerMobile)m_From).UseOwnFilter = true;
                m_From.SendGump(new RecipeScrollFilterGump(m_From, m_Book));

                break;
            }

            case 3:     // Clear
            {
                f.Clear();
                m_From.SendGump(new RecipeScrollFilterGump(m_From, m_Book));

                break;
            }

            default:
            {
                index -= 4;

                int type = index % 4;
                index /= 4;

                int[][,] filter = m_Filters;

                if (type >= 0 && type < filter.Length)
                {
                    int[,] filters = filter[type];

                    if (index >= 0 && index < filters.GetLength(0))
                    {
                        if (filters[index, 0] == 0)
                        {
                            break;
                        }

                        switch (type)
                        {
                        case 0:
                            f.Skill = filters[index, 1];
                            break;

                        case 1:
                            f.Expansion = filters[index, 1];
                            break;

                        case 2:
                            f.Amount = filters[index, 1];
                            break;
                        }

                        m_From.SendGump(new RecipeScrollFilterGump(m_From, m_Book));
                    }
                }

                break;
            }
            }
        }