예제 #1
0
 public override void OnResponse(NetState state, RelayInfo info)
 {
     if (m_TL.Deleted)
     {
         return;
     }
     else if (info.ButtonID == 1)
     {
         if (((RewardTicketLedger)m_TL).RewardTickets <= 1000000)
         {
             m_TL.BeginAddRewardTickets(m_From);
         }
         else
         {
             m_From.SendMessage(1161, "This Reward ticket ledger is full, pick up another ledger in the lounge");
         }
         m_From.SendGump(new RewardTicketsGump(m_From, m_TL));
     }
     else if (info.ButtonID == 2)
     {
         TextRelay tr_RewardTicketAmount = info.GetTextEntry(3);
         if (tr_RewardTicketAmount != null)
         {
             int i_MaxAmount = 0;
             try
             {
                 i_MaxAmount = Convert.ToInt32(tr_RewardTicketAmount.Text, 10);
             }
             catch
             {
                 m_From.SendMessage(1161, "Please make sure you write only numbers.");
             }
             if (i_MaxAmount > 0)
             {
                 if (i_MaxAmount <= ((RewardTicketLedger)m_TL).RewardTickets)
                 {
                     if (i_MaxAmount <= 100)
                     {
                         for (int i = 0; i < i_MaxAmount; ++i)
                         {
                             m_From.AddToBackpack(new RewardTicket());
                         }
                         m_From.SendMessage(1161, "You extracted {0} tickets from your ledger.", i_MaxAmount);
                         ((RewardTicketLedger)m_TL).RewardTickets = (((RewardTicketLedger)m_TL).RewardTickets - i_MaxAmount);
                     }
                     else
                     {
                         m_From.SendMessage(1161, "You can't extract more than 100 tickets at a time.");
                     }
                 }
                 else
                 {
                     m_From.SendMessage(1161, "You don't have that many tickets in your ledger.");
                 }
             }
             m_From.SendGump(new RewardTicketsGump(m_From, m_TL));
         }
     }
 }