public override void OnResponse(NetState state, RelayInfo info) { bool prime = m_Plot.IsPrimeSpot; if (info.ButtonID == 0) { return; } if ((prime && !m_Plot.CanPurchaseLottoTicket(m_From)) || !m_Plot.LottoOngoing) { return; } int pricePer = m_Plot.LottoPrice; int total = pricePer; int toBuy = 1; if (!prime && info.ButtonID == 1) { toBuy = 0; TextRelay relay = info.GetTextEntry(0); string text = relay.Text; try { toBuy = Convert.ToInt32(text); } catch (Exception e) { Diagnostics.ExceptionLogging.LogException(e); } if (toBuy <= 0) { return; } } if (toBuy > 1) { total = toBuy * pricePer; } if (Banker.Withdraw(m_From, total)) { MaginciaLottoSystem.GoldSink += total; m_From.SendLocalizedMessage(1150480, string.Format("{0}\t{1}\t{2}", toBuy.ToString(), pricePer.ToString(), total.ToString())); // Purchase of ~1_COUNT~ ticket(s) at ~2_PRICE~gp each costs a total of ~3_TOTAL~. The funds have been withdrawn from your bank box and your ticket purchase has been recorded. m_Plot.PurchaseLottoTicket(m_From, toBuy); } else { m_From.SendLocalizedMessage(1150479, string.Format("{0}\t{1}\t{2}", toBuy.ToString(), pricePer.ToString(), total.ToString())); // Purchase of ~1_COUNT~ ticket(s) at ~2_PRICE~gp each costs a total of ~3_TOTAL~. You do not have the required funds in your bank box to make the purchase. } }