Esempio n. 1
0
            public override void OnResponse(Mobile from, string text)
            {
                if (m_Box.Deleted || !m_Box.IsOwner(from))
                {
                    return;
                }

                if (from.Map != m_Box.Map || !from.InRange(m_Box.GetWorldLocation(), 2))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                    return;
                }

                m_Box.AddLineToTopic(text.TrimEnd());

                if (m_Box.Topic.Length < MaxTopicLines)
                {
                    from.SendLocalizedMessage(500377, "", 0x35); // Next line or ESC to finish:
                    from.Prompt = new TopicPrompt(m_Box);
                }
                else
                {
                    from.SendLocalizedMessage(500376, "", 0x35); // Ballot entry complete.
                    from.SendGump(new InternalGump(m_Box, true));
                }
            }
Esempio n. 2
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                if (m_Box.Deleted || info.ButtonID == 0)
                {
                    return;
                }

                Mobile from = sender.Mobile;

                if (from.Map != m_Box.Map || !from.InRange(m_Box.GetWorldLocation(), 2))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                    return;
                }

                bool isOwner = m_Box.IsOwner(from);

                switch (info.ButtonID)
                {
                case 1:     // change topic
                {
                    if (isOwner)
                    {
                        m_Box.ClearTopic();

                        from.SendLocalizedMessage(500370, "", 0x35);         // Enter a line of text for your ballot, and hit ENTER. Hit ESC after the last line is entered.
                        from.Prompt = new TopicPrompt(m_Box);
                    }

                    break;
                }

                case 2:     // reset votes
                {
                    if (isOwner)
                    {
                        m_Box.ClearVotes();
                        from.SendLocalizedMessage(500371);         // Votes zeroed out.
                    }

                    goto default;
                }

                case 3:     // aye
                {
                    if (!isOwner)
                    {
                        if (m_Box.HasVoted(from))
                        {
                            from.SendLocalizedMessage(500374);         // You have already voted on this ballot.
                        }
                        else
                        {
                            m_Box.Yes.Add(from);
                            from.SendLocalizedMessage(500373);         // Your vote has been registered.
                        }
                    }

                    goto default;
                }

                case 4:     // nay
                {
                    if (!isOwner)
                    {
                        if (m_Box.HasVoted(from))
                        {
                            from.SendLocalizedMessage(500374);         // You have already voted on this ballot.
                        }
                        else
                        {
                            m_Box.No.Add(from);
                            from.SendLocalizedMessage(500373);         // Your vote has been registered.
                        }
                    }

                    goto default;
                }

                default:
                {
                    from.SendGump(new InternalGump(m_Box, isOwner));
                    break;
                }
                }
            }