예제 #1
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                if (m_Box.Deleted || info.ButtonID == 0)
                {
                    return;
                }

                Mobile from = sender.Mobile;

                bool isOwner = m_Box.IsOwner(from);

                if (info.ButtonID >= 6 && info.ButtonID <= 6 + MaxChoices)
                {
                    int choice = info.ButtonID - 6;
                    if (!isOwner)
                    {
                        if (m_Box.HasVoted(from))
                        {
                            from.SendLocalizedMessage(500374); // You have already voted on this ballot.
                        }
                        else
                        {
                            m_Box.Votes.Add(from.Account, choice);
                            from.SendLocalizedMessage(500373); // Your vote has been registered.
                            from.AddToBackpack(new CorpseRetrievalWand(5));
                            from.SendMessage("Thank you for providing your feedback. Your feedback is very important to us, and allows us to further improve the shard to better serve you and other players.");
                            from.SendMessage("You received a small gift as a token of appreciation.");
                        }
                        from.SendGump(new InternalGump(m_Box, isOwner));
                    }
                }
                else
                {
                    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, false);
                        }

                        break;
                    }

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

                        goto default;
                    }

                    case 3:     // change choices
                    {
                        if (isOwner)
                        {
                            m_Box.ClearChoices();

                            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, true);
                        }

                        break;
                    }

                    case 4:     // change days
                    {
                        if (isOwner)
                        {
                            from.SendMessage(0x35, "Enter how many days in total for your ballot to run, and hit ENTER.");
                            from.Prompt = new BallotDaysPrompt(m_Box);
                        }

                        break;
                    }

                    case 5:     // toggle open/close
                    {
                        if (isOwner)
                        {
                            m_Box.ToggleOpen();
                        }

                        goto default;
                    }

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