コード例 #1
0
ファイル: CreateBountyGump.cs プロジェクト: nydehi/imagine-uo
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 1)
            {
                Mobile  from = state.Mobile;
                BankBox box  = from.BankBox;
                string  text = (string)info.GetTextEntry(1).Text;

                if (text.Length > 0)
                {
                    try
                    {
                        int amount = Convert.ToInt32(text);

                        if (amount < 1)
                        {
                            from.SendMessage("Thats to low of an amount.");
                            from.SendGump(new CreateBountyGump(from, m_Killer));
                        }
                        else if (box.TotalGold < amount)
                        {
                            from.SendMessage("You lack the gold for that bounty.");
                            from.SendGump(new CreateBountyGump(from, m_Killer));
                        }
                        else
                        {
                            box.ConsumeTotal(typeof(Gold), amount);
                            FSBountySystem.CreateBounty(m_Killer, amount);
                            from.SendMessage("{0} has been removed from your bank.", amount);
                            from.SendMessage("The bounty has been placed on {0}'s head.", m_Killer.Name);
                        }
                    }
                    catch
                    {
                        from.SendMessage("You must enter a number amount.");
                        from.SendGump(new CreateBountyGump(from, m_Killer));
                    }
                }
            }
        }