Example #1
0
            public MotDGump(Mobile from, int mID) : base(50, 50)
            {
                m_Mobile = from;
                m_ID     = mID;

                if (m_ID < 0 || m_ID >= MotD.Messages.Count)
                {
                    return;
                }

                MotDStruct mds = (MotDStruct)Messages[m_ID];

                MotD.GenerateRegulars(this, mds, mID);

                if (from.AccessLevel < AccessLevel.Administrator)
                {
                    AddLabel(30, 395, 0, "Greetings,");
                    AddLabel(90, 420, 0, "The Defiance UOR staff");
                }

                else
                {
                    AddButton(30, 400, 4011, 4012, 3, GumpButtonType.Reply, 0);
                    AddLabel(65, 400, 0, "New Message");
                    AddButton(165, 400, 4026, 4027, 4, GumpButtonType.Reply, 0);
                    AddLabel(200, 400, 0, "Edit");
                    AddButton(260, 400, 4017, 4018, 5, GumpButtonType.Reply, 0);
                    AddLabel(295, 400, 0, "Remove");
                }
            }
Example #2
0
            public ModMoTDGump(MotDStruct mds, bool existing)
                : base()
            {
                m_Mds      = mds;
                m_Existing = existing;

                MotD.GenerateRegulars(this, mds, -1);

                AddButton(30, 400, 4011, 4012, 1, GumpButtonType.Reply, 0);
                AddLabel(65, 400, 0, existing? "Submit Message":"Add Message");
                AddButton(260, 400, 4017, 4018, 0, GumpButtonType.Reply, 0);
                AddLabel(295, 400, 0, "Cancel");

                AddBackground(400, 30, 375, 400, 9380);

                AddLabel(445, 60, 0, "Change title:");
                AddBackground(445, 85, 250, 20, 9300);
                AddTextEntry(450, 85, 230, 20, 0, 2, "");
                AddButton(700, 85, 4014, 4015, 2, GumpButtonType.Reply, 0);

                AddImageTiled(450, 111, 277, 11, 50);

                AddLabel(445, 125, 0, "Add text to body:");
                AddBackground(445, 150, 250, 140, 9300);
                AddTextEntry(450, 155, 230, 130, 0, 3, "");
                AddButton(700, 270, 4014, 4015, 3, GumpButtonType.Reply, 0);

                AddLabel(445, 300, 0, "Remove characters:");
                AddBackground(600, 300, 100, 22, 9300);
                AddTextEntry(605, 300, 90, 15, 0, 4, "");
                AddButton(700, 300, 4014, 4015, 4, GumpButtonType.Reply, 0);

                AddImageTiled(448, 330, 277, 11, 50);


                AddLabel(445, 350, 0, "Add Link:");
                AddBackground(520, 345, 180, 25, 9300);
                AddTextEntry(525, 350, 170, 15, 0, 5, "");
                AddButton(700, 350, 4014, 4015, 5, GumpButtonType.Reply, 0);
                AddLabel(590, 370, 0, "Remove last link");
                AddButton(700, 370, 4014, 4015, 6, GumpButtonType.Reply, 0);
            }
Example #3
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                Mobile from = sender.Mobile;

                switch (info.ButtonID)
                {
                case 0: break;

                case 1:
                    if (!m_Existing)
                    {
                        MotD.AddMessage(m_Mds);
                    }

                    from.SendGump(new MotDGump(from, MotD.LastMessage));
                    break;

                case 2:
                    m_Mds.Subject = info.GetTextEntry(2).Text;
                    from.SendGump(new ModMoTDGump(m_Mds, m_Existing));
                    break;

                case 3:
                    m_Mds.Body = m_Mds.Body + info.GetTextEntry(3).Text;
                    from.SendGump(new ModMoTDGump(m_Mds, m_Existing));
                    break;

                case 4:
                    try
                    {
                        int toremove = Convert.ToInt32(info.GetTextEntry(4).Text);
                        int length   = m_Mds.Body.Length;

                        if (toremove > length)
                        {
                            from.SendMessage("You cannot remove that many characters.");
                        }

                        else if (toremove < 1)
                        {
                            from.SendMessage("You can only remove a positive amount of characters.");
                        }

                        else
                        {
                            m_Mds.Body = ((string)m_Mds.Body).Remove(length - toremove, toremove);
                        }
                    }
                    catch
                    {
                        from.SendMessage("Bad format. An integer was expected.");
                    }

                    from.SendGump(new ModMoTDGump(m_Mds, m_Existing));
                    break;

                case 5:
                    if (m_Mds.Links.Count < 5)
                    {
                        m_Mds.Links.Add(info.GetTextEntry(5).Text);
                    }

                    else
                    {
                        from.SendMessage("The maximum amount of links has been reached already.");
                    }

                    from.SendGump(new ModMoTDGump(m_Mds, m_Existing));
                    break;

                case 6:
                    if (m_Mds.Links.Count > 0)
                    {
                        m_Mds.Links.RemoveAt(m_Mds.Links.Count - 1);
                    }

                    else
                    {
                        from.SendMessage("This message does not contain any links.");
                    }

                    from.SendGump(new ModMoTDGump(m_Mds, m_Existing));
                    break;
                }
            }
Example #4
0
            public override void OnResponse(NetState Sender, RelayInfo info)
            {
                if (m_ID < 0 || m_ID >= MotD.Messages.Count)
                {
                    return;
                }

                PlayerMobile from = (PlayerMobile)m_Mobile;
                MotDStruct   mds  = (MotDStruct)Messages[m_ID];

                if (info.ButtonID >= 900)
                {
                    int li = info.ButtonID - 900;
                    if (li >= 0 && li < mds.Links.Count)
                    {
                        from.LaunchBrowser((string)mds.Links[li]);
                    }
                    from.SendGump(new MotDGump(from, m_ID));
                }

                else
                {
                    switch (info.ButtonID)
                    {
                    case 0: break;

                    case 1: from.SendGump(new MotDGump(from, m_ID + 1)); break;

                    case 2: from.SendGump(new MotDGump(from, m_ID - 1)); break;

                    case 3:
                        if (from.AccessLevel >= AccessLevel.Administrator)
                        {
                            from.SendGump(new ModMoTDGump(new MotDStruct(from.Name.ToString() + " : " + DateTime.Today.ToShortDateString(), "", new ArrayList()), false));
                        }
                        break;

                    case 4:
                        if (from.AccessLevel >= AccessLevel.Administrator)
                        {
                            if (m_ID == 0)
                            {
                                from.SendMessage("You cannot edit this message.");
                                from.SendGump(new MotDGump(from, MotD.LastMessage));
                            }

                            else
                            {
                                from.SendGump(new ModMoTDGump((MotDStruct)Messages[m_ID], true));
                            }
                        }
                        break;

                    case 5:
                        if (from.AccessLevel >= AccessLevel.Administrator)
                        {
                            if (m_ID == 0)
                            {
                                from.SendMessage("You cannot remove this message.");
                                from.SendGump(new MotDGump(from, MotD.LastMessage));
                            }

                            else
                            {
                                MotD.RemoveMessage(m_ID);
                                from.SendGump(new MotDGump(from, MotD.LastMessage));
                            }
                        }
                        break;
                    }
                }
            }