Пример #1
0
        public OKTargetGump(string header, int headerColor, string content, int contentColor, int width, int height,
            GenericOKCallback callback, MasterRunebook master, InternalRunebook book, int id)
            : base((640 - width) / 2, (480 - height) / 2)
        {
            m_Callback = callback;
            m_Master = master;
            m_Book = book;
            m_Id = id;

            Closable = false;

            AddPage(0);

            AddBackground(0, 0, width, height, 5054);

            AddImageTiled(10, 10, width - 20, 20, 2624);
            AddAlphaRegion(10, 10, width - 20, 20);
            AddHtml(10, 10, width - 20, 20, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", headerColor, header), false, false);

            AddImageTiled(10, 40, width - 20, height - 80, 2624);
            AddAlphaRegion(10, 40, width - 20, height - 80);

            AddHtml(10, 40, width - 20, height - 80, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", contentColor, content), false, true);

            AddImageTiled(10, height - 30, width - 20, 20, 2624);
            AddAlphaRegion(10, height - 30, width - 20, 20);

            AddButton(10, height - 30, 4005, 4007, 1, GumpButtonType.Reply, 0);
            AddHtmlLocalized(40, height - 30, 170, 20, 1049717, 32767, false, false); // YES

            AddButton(10 + ((width - 20) / 2), height - 30, 4005, 4007, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(40 + ((width - 20) / 2), height - 30, 170, 20, 1049718, 32767, false, false); // NO
        }
        public MasterRunebookGump(Mobile owner, MasterRunebook book)
            : base(150, 60)
        {
            m_Book = book;
            AddPage(0);
            AddBackground(0, 0, 420, 440, 3500);
            AddItem(66, 14, 0x2252, m_Book.Hue);
            AddLabel(110, 14, 0, "Lokai's Master Runebook");
            AddItem(260, 14, 0x2252, m_Book.Hue);

            int count = 0;
            for (int x = 0; x < 3; x++)
            {
                AddPage(1 + x);
                if (x < 2)
                    AddButton(338, 407, 2471, 2470, 0, GumpButtonType.Page, 2 + x); //Next Button
                if (x > 0)
                    AddButton(30, 407, 2468, 2467, 0, GumpButtonType.Page, x); // Previous Button

                int XposB = 15, YposB = 44, XposL = 35, YposL = 41, bk = 16;
                for (int y = 0; y < 17; y++)
                {
                    string name = "";
                    try { name = m_Book.Books[count].Name.Trim(); }
                    catch { }
                    if (name == null || name.Length < 1) name = string.Format("Book #{0}", ((int)(count + 1)).ToString());
                    AddTextEntry(XposL, YposL, 320, 19, 0, count + 100, name);
                    AddButton(XposB, YposB, 1802, 1802, bk + (17 * x), GumpButtonType.Reply, 0);
                    AddItem(XposB - 13, YposB - 4, 8901, 0x461);
                    YposB += 20;
                    YposL += 20;
                    count++;
                    bk++;
                }
                XposB += 130;
                XposL += 130;
                YposB = 44;
                YposL = 41;
            }
        }
        public InternalRunebookGump(Mobile from, InternalRunebook book, MasterRunebook masterbook, int booknum)
            : base(150, 200)
        {
            m_Book = book;
            m_MasterBook = masterbook;
            m_BookNum = booknum;

            AddBackground();

            AddLabel(137, 12, 0, m_Book.Name);
            AddLabel(312, 32, 0, "Return");
            AddButton(288, 34, 2223, 2223, 199, GumpButtonType.Reply, 0);

            if (booknum > 0)
            {
                AddButton(283, 14, 9766, 9767, booknum + 199, GumpButtonType.Reply, 0);
                AddLabel(303, 12, 0, string.Format("{0}", ((int)(booknum)).ToString()));
            }
            if (booknum < 50)
            {
                AddButton(407, 14, 9762, 9763, booknum + 201, GumpButtonType.Reply, 0);
                AddLabel(387, 12, 0, string.Format("{0}", ((int)(booknum + 2)).ToString()));
            }

            AddIndex();

            for (int page = 0; page < 8; ++page)
            {
                AddPage(2 + page);

                //AddButton(125, 14, 2205, 2205, 0, GumpButtonType.Page, 1 + page);

                //if (page < 7)
                //    AddButton(393, 14, 2206, 2206, 0, GumpButtonType.Page, 3 + page);

                for (int half = 0; half < 2; ++half)
                    AddDetails((page * 2) + half, half);
            }
        }
        public static void RemoveRunebook_Callback(Mobile from, bool okay, MasterRunebook master, InternalRunebook book, int id)
        {
            if (okay)
            {
                Container pack = from.Backpack;
                if (pack == null || pack.Deleted)
                {
                    from.SendMessage("Unable to find a backpack in which to place a new Runebook.");
                    return;
                }
                int count = book.Entries.Count;
                if (count > 0)
                {
                    if (from.AccessLevel < AccessLevel.GameMaster)
                    {
                        if (from.Backpack.ConsumeTotal(new Type[] { typeof(BlankScroll), typeof(RecallScroll), typeof(GateTravelScroll) },
                            new int[] { 10, 1, 1 }) >= 0)
                        {
                            from.SendMessage("You do not have the materials needed to create the runebook.");
                            return;
                        }
                        if (from.CheckSkill(SkillName.Inscribe, 100, 120))
                        {
                            from.SendMessage("You failed to extract the book. Some materials were lost.");
                            return;
                        }
                    }

                    Runebook runebook = new Runebook(book.MaxCharges);
                    for (int x = 0; x < count; x++)
                    {
                        RunebookEntry rbe = new RunebookEntry(
                            ((RunebookEntry)book.Entries[0]).Location, ((RunebookEntry)book.Entries[0]).Map,
                            ((RunebookEntry)book.Entries[0]).Description, ((RunebookEntry)book.Entries[0]).House);
                        runebook.Entries.Add(rbe);
                        book.Entries.RemoveAt(0);
                    }
                    runebook.CurCharges = book.CurCharges;
                    runebook.Name = book.Name;
                    book.Name = string.Format("Book #{0}", ((int)(id + 1)).ToString());
                    pack.DropItem(runebook);
                    from.SendMessage("Runebook extracted. Some materials were used.");
                }
                else
                {
                    from.SendMessage("You cannot remove an empty Runebook.");
                }
                from.CloseGump(typeof(InternalRunebookGump));
                from.SendGump(new InternalRunebookGump(from, book, master, id));
            }
            else
            {
                from.CloseGump(typeof(InternalRunebookGump));
                from.SendGump(new InternalRunebookGump(from, book, master, id));
            }
        }
 public InternalTarget(InternalRunebook book, MasterRunebook master, int booknum)
     : base(3, false, TargetFlags.None)
 {
     m_RuneBook = book;
     m_Master = master;
     m_Booknum = booknum;
 }
 public DescriptionPrompt(MasterRunebook master, InternalRunebook book, int id)
 {
     m_Master = master;
     m_Book = book;
     m_Id = id;
 }
 public static void TargetPoint3D_Callback(Mobile from, bool okay, MasterRunebook master, InternalRunebook book, int id)
 {
     if (okay)
     {
         if (book.Entries.Count < 16)
         {
             book.Entries.Add(new RunebookEntry(from.Location, from.Map, "", null));
             from.SendMessage("Enter the description for this location.");
             from.Prompt = new DescriptionPrompt(master, book, id);
         }
         else
         {
             from.SendLocalizedMessage(502401); // This runebook is full.
             from.CloseGump(typeof(InternalRunebookGump));
             from.SendGump(new InternalRunebookGump(from, book, master, id));
         }
     }
     else
     {
         from.CloseGump(typeof(InternalRunebookGump));
         from.SendGump(new InternalRunebookGump(from, book, master, id));
     }
 }