예제 #1
0
        public PageQueueGump() : base(30, 30)
        {
            Add(new GumpPage(0));
            //Add( new GumpBackground( 0, 0, 410, 448, 9200 ) );
            Add(new GumpImageTiled(0, 0, 410, 448, 0xA40));
            Add(new GumpAlphaRegion(1, 1, 408, 446));

            Add(new GumpLabel(180, 12, 2100, "Page Queue"));

            ArrayList list = PageQueue.List;

            for (int i = 0; i < list.Count;)
            {
                PageEntry e = (PageEntry)list[i];

                if (e.Sender.Deleted || e.Sender.NetState == null)
                {
                    e.AddResponse(e.Sender, "[Logout]");
                    PageQueue.Remove(e);
                }
                else
                {
                    ++i;
                }
            }

            m_List = (PageEntry[])list.ToArray(typeof(PageEntry));

            if (m_List.Length > 0)
            {
                Add(new GumpPage(1));

                for (int i = 0; i < m_List.Length; ++i)
                {
                    PageEntry e = m_List[i];

                    if (i >= 5 && (i % 5) == 0)
                    {
                        Add(new GumpButton(368, 12, 0xFA5, 0xFA7, 0, GumpButtonType.Page, (i / 5) + 1));
                        Add(new GumpLabel(298, 12, 2100, "Next Page"));
                        Add(new GumpPage((i / 5) + 1));
                        Add(new GumpButton(12, 12, 0xFAE, 0xFB0, 0, GumpButtonType.Page, (i / 5)));
                        Add(new GumpLabel(48, 12, 2100, "Previous Page"));
                    }

                    string typeString = PageQueue.GetPageTypeName(e.Type);

                    string html = String.Format("[{0}] {1} <basefont color=#{2:X6}>[<u>{3}</u>]</basefont>", typeString, e.Message, e.Handler == null ? 0xFF0000 : 0xFF, e.Handler == null ? "Unhandled" : "Handling");

                    Add(new GumpHtml(12, 44 + ((i % 5) * 80), 350, 70, html, true, true));
                    Add(new GumpButton(370, 44 + ((i % 5) * 80) + 24, 0xFA5, 0xFA7, i + 1, GumpButtonType.Reply, 0));
                }
            }
            else
            {
                Add(new GumpLabel(12, 44, 2100, "The page queue is empty."));
            }
        }
예제 #2
0
        public override void OnResponse(NetState state, int index)
        {
            if (index == 0)
            {
                m_From.SendLocalizedMessage(1005306, "", 0x35); // Help request unchanged.
            }
            else if (index == 1)
            {
                PageEntry entry = PageQueue.GetEntry(m_From);

                if (entry != null && entry.Handler == null)
                {
                    m_From.SendLocalizedMessage(1005307, "", 0x35); // Removed help request.
                    entry.AddResponse(entry.Sender, "[Canceled]");
                    PageQueue.Remove(entry);
                }
                else
                {
                    m_From.SendLocalizedMessage(1005306, "", 0x35); // Help request unchanged.
                }
            }
        }
예제 #3
0
            protected override void OnTick()
            {
                int index = PageQueue.IndexOf(m_Entry);

                if (m_Entry.Sender.NetState != null && index != -1)
                {
                    m_Entry.Sender.SendLocalizedMessage(1008077, true, (index + 1).ToString()); // Thank you for paging. Queue status :
                    m_Entry.Sender.SendLocalizedMessage(1008084);                               // You can reference our website at www.uo.com or contact us at [email protected]. To cancel your page, please select the help button again and select cancel.

                    if (m_Entry.Handler != null && m_Entry.Handler.NetState == null)
                    {
                        m_Entry.Handler = null;
                    }
                }
                else
                {
                    if (index != -1)
                    {
                        m_Entry.AddResponse(m_Entry.Sender, "[Logout]");
                    }

                    PageQueue.Remove(m_Entry);
                }
            }
예제 #4
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID != 0 && PageQueue.List.IndexOf(m_Entry) < 0)
            {
                state.Mobile.SendGump(new PageQueueGump());
                state.Mobile.SendMessage("That page has been removed.");
                return;
            }

            switch (info.ButtonID)
            {
            case 0:     // close
            {
                if (m_Entry.Handler != state.Mobile)
                {
                    PageQueueGump g = new PageQueueGump();

                    g.SendTo(state);
                }

                break;
            }

            case 1:     // go to sender
            {
                Mobile m = state.Mobile;

                if (m_Entry.Sender.Deleted)
                {
                    m.SendMessage("That character no longer exists.");
                }
                else if (m_Entry.Sender.Map == null || m_Entry.Sender.Map == Map.Internal)
                {
                    m.SendMessage("That character is not in the world.");
                }
                else
                {
                    m_Entry.AddResponse(state.Mobile, "[Go Sender]");
                    m.MoveToWorld(m_Entry.Sender.Location, m_Entry.Sender.Map);

                    m.SendMessage("You have been teleported to that page's sender.");

                    Resend(state);
                }

                break;
            }

            case 2:     // go to handler
            {
                Mobile m = state.Mobile;
                Mobile h = m_Entry.Handler;

                if (h != null)
                {
                    if (h.Deleted)
                    {
                        m.SendMessage("That character no longer exists.");
                    }
                    else if (h.Map == null || h.Map == Map.Internal)
                    {
                        m.SendMessage("That character is not in the world.");
                    }
                    else
                    {
                        m_Entry.AddResponse(state.Mobile, "[Go Handler]");
                        m.MoveToWorld(h.Location, h.Map);

                        m.SendMessage("You have been teleported to that page's handler.");
                        Resend(state);
                    }
                }
                else
                {
                    m.SendMessage("Nobody is handling that page.");
                    Resend(state);
                }

                break;
            }

            case 3:     // go to page location
            {
                Mobile m = state.Mobile;

                if (m_Entry.PageMap == null || m_Entry.PageMap == Map.Internal)
                {
                    m.SendMessage("That location is not in the world.");
                }
                else
                {
                    m_Entry.AddResponse(state.Mobile, "[Go PageLoc]");
                    m.MoveToWorld(m_Entry.PageLocation, m_Entry.PageMap);

                    state.Mobile.SendMessage("You have been teleported to the original page location.");

                    Resend(state);
                }

                break;
            }

            case 4:     // handle page
            {
                if (m_Entry.Handler == null)
                {
                    m_Entry.AddResponse(state.Mobile, "[Handling]");
                    m_Entry.Handler = state.Mobile;

                    state.Mobile.SendMessage("You are now handling the page.");
                }
                else
                {
                    state.Mobile.SendMessage("Someone is already handling that page.");
                }

                Resend(state);

                break;
            }

            case 5:     // delete page
            {
                if (m_Entry.Handler == null)
                {
                    m_Entry.AddResponse(state.Mobile, "[Deleting]");
                    PageQueue.Remove(m_Entry);

                    state.Mobile.SendMessage("You delete the page.");

                    PageQueueGump g = new PageQueueGump();

                    g.SendTo(state);
                }
                else
                {
                    state.Mobile.SendMessage("Someone is handling that page, it can not be deleted.");

                    Resend(state);
                }

                break;
            }

            case 6:     // abandon page
            {
                if (m_Entry.Handler == state.Mobile)
                {
                    m_Entry.AddResponse(state.Mobile, "[Abandoning]");
                    state.Mobile.SendMessage("You abandon the page.");

                    m_Entry.Handler = null;
                }
                else
                {
                    state.Mobile.SendMessage("You are not handling that page.");
                }

                Resend(state);

                break;
            }

            case 7:     // page handled
            {
                if (m_Entry.Handler == state.Mobile)
                {
                    m_Entry.AddResponse(state.Mobile, "[Handled]");
                    PageQueue.Remove(m_Entry);

                    m_Entry.Handler = null;

                    state.Mobile.SendMessage("You mark the page as handled, and remove it from the queue.");

                    PageQueueGump g = new PageQueueGump();

                    g.SendTo(state);
                }
                else
                {
                    state.Mobile.SendMessage("You are not handling that page.");

                    Resend(state);
                }

                break;
            }

            case 8:     // Send message
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    m_Entry.AddResponse(state.Mobile, "[Response] " + text.Text);
                    m_Entry.Sender.SendGump(new MessageSentGump(m_Entry.Sender, state.Mobile.Name, text.Text));
                    //m_Entry.Sender.SendMessage( 0x482, "{0} tells you:", state.Mobile.Name );
                    //m_Entry.Sender.SendMessage( 0x482, text.Text );
                }

                Resend(state);

                break;
            }

            case 9:     // predef overview
            {
                Resend(state);
                state.Mobile.SendGump(new PredefGump(state.Mobile, null));

                break;
            }

            case 10:     // View Speech Log
            {
                Resend(state);

                if (m_Entry.SpeechLog != null)
                {
                    Gump gump = new SpeechLogGump(m_Entry.Sender, m_Entry.SpeechLog);
                    state.Mobile.SendGump(gump);
                }

                break;
            }

            default:
            {
                int       index   = info.ButtonID - 100;
                ArrayList preresp = PredefinedResponse.List;

                if (index >= 0 && index < preresp.Count)
                {
                    m_Entry.AddResponse(state.Mobile, "[PreDef] " + ((PredefinedResponse)preresp[index]).Title);
                    m_Entry.Sender.SendGump(new MessageSentGump(m_Entry.Sender, state.Mobile.Name, ((PredefinedResponse)preresp[index]).Message));
                }

                Resend(state);

                break;
            }
            }
        }