예제 #1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (!m_Owner.CheckAlive())
            {
                return;
            }

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

            case 1:                     // Toggle Auto Renew
            {
                if (m_Owner.AutoRenewInsurance)
                {
                    m_Owner.SendGump(new ConfirmationCancelInsuranceGump(m_Owner, m_ItemInsuranceInfo));
                }
                else
                {
                    m_Owner.SendLocalizedMessage(1060881, String.Empty, 0x23);                                       // You have selected to automatically reinsure all insured items upon death
                    m_Owner.AutoRenewInsurance = true;

                    m_Owner.SendGump(new ItemInsuranceMenu(m_Owner, m_ItemInsuranceInfo, m_Page));
                }

                break;
            }

            case 2:                     // OK
            {
                m_Owner.CloseGump <ConfirmInsureGump>();
                m_Owner.SendGump(new ConfirmInsureGump(m_Owner, m_ItemInsuranceInfo));

                break;
            }

            case 503:                     // Previous page
            {
                m_Owner.CloseGump <ItemInsuranceMenu>();
                m_Owner.SendGump(new ItemInsuranceMenu(m_Owner, m_ItemInsuranceInfo, m_Page - 1));

                break;
            }

            case 505:                     // Next page
            {
                m_Owner.CloseGump <ItemInsuranceMenu>();
                m_Owner.SendGump(new ItemInsuranceMenu(m_Owner, m_ItemInsuranceInfo, m_Page + 1));

                break;
            }

            default:
            {
                int idx = info.ButtonID - 100;

                if (idx >= 0 && idx < m_ItemInsuranceInfo.Length)
                {
                    m_ItemInsuranceInfo[idx].Toggle();
                    m_Owner.SendGump(new ItemInsuranceMenu(m_Owner, m_ItemInsuranceInfo, m_Page));
                }

                break;
            }
            }
        }