public override void OnSpeech(SpeechEventArgs e)
        {
            if (!e.Handled)
            {
                for (int i = 0; i < e.Keywords.Length; ++i)
                {
                    int keyword = e.Keywords[i];

                    if (e.Mobile.Criminal)
                    {
                        e.Mobile.SendMessage("Thou art a criminal and cannot access thy balance.");
                    }
                    else
                    {
                        switch (keyword)
                        {
                        /*
                         * case 0x0000: // *withdraw*
                         * {
                         *  e.Handled = true;
                         *
                         *  string[] split = e.Speech.Split(' ');
                         *
                         *  if (split.Length >= 2)
                         *  {
                         *      int amount;
                         *
                         *      try
                         *      {
                         *          amount = Convert.ToInt32(split[1]);
                         *      }
                         *      catch
                         *      {
                         *          break;
                         *      }
                         *
                         *      if (amount > 5000)
                         *      {
                         *          this.Say(500381); // Thou canst not withdraw so much at one time!
                         *      }
                         *      else if (amount > 0)
                         *      {
                         *          BankBox box = e.Mobile.BankBox;
                         *
                         *          if (box == null || !box.ConsumeTotal(typeof(Gold), amount))
                         *          {
                         *              this.Say(500384); // Ah, art thou trying to fool me? Thou hast not so much gold!
                         *          }
                         *          else
                         *          {
                         *              e.Mobile.AddToBackpack(new Gold(amount));
                         *
                         *              this.Say(1010005); // Thou hast withdrawn gold from thy account.
                         *          }
                         *      }
                         *  }
                         *
                         *  break;
                         * }
                         */
                        case 0x0001:     // *balance*
                        {
                            e.Handled = true;

                            BankBox box = e.Mobile.BankBox;

                            if (box != null)
                            {
                                this.Say(String.Format("Thy current bank balance is {0} gold.", box.TotalGold.ToString()));
                            }

                            break;
                        }

                        /*
                         * case 0x0002: // *bank*
                         * {
                         *  e.Handled = true;
                         *
                         *  BankBox box = e.Mobile.BankBox;
                         *
                         *  if (box != null)
                         *      box.Open();
                         *
                         *  break;
                         * }
                         */
                        case 0x0003:     // *check*
                        {
                            e.Handled = true;

                            string[] split = e.Speech.Split(' ');

                            if (split.Length >= 2)
                            {
                                int amount;

                                try
                                {
                                    amount = Convert.ToInt32(split[1]);
                                }
                                catch
                                {
                                    break;
                                }

                                if (amount < 5000)
                                {
                                    this.Say(1010006);         // We cannot create checks for such a paltry amount of gold!
                                }
                                else if (amount > 1000000)
                                {
                                    this.Say(1010007);         // Our policies prevent us from creating checks worth that much!
                                }
                                else
                                {
                                    BankCheck check = new BankCheck(amount);

                                    BankBox box = e.Mobile.BankBox;

                                    if (box == null || !box.TryDropItem(e.Mobile, check, false))
                                    {
                                        this.Say(500386);         // There's not enough room in your bankbox for the check!
                                        check.Delete();
                                    }
                                    else if (!box.ConsumeTotal(typeof(Gold), amount))
                                    {
                                        this.Say(500384);         // Ah, art thou trying to fool me? Thou hast not so much gold!
                                        check.Delete();
                                    }
                                    else
                                    {
                                        this.Say(String.Format("Into your bank box I have placed a check in the amount of: {0}", amount.ToString()));
                                    }
                                }
                            }

                            break;
                        }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public override void OnDoubleClick(Mobile from)
        {
            BankBox box = from.FindBankNoCreate();

            if (box != null && IsChildOf(box))
            {
                Delete();

                int deposited = 0;

                int toAdd = m_Worth;

                Gold gold;

                while (toAdd > 60000)
                {
                    gold = new Gold(60000);

                    if (box.TryDropItem(from, gold, false))
                    {
                        toAdd     -= 60000;
                        deposited += 60000;
                    }
                    else
                    {
                        gold.Delete();

                        from.AddToBackpack(new BankCheck(toAdd));
                        toAdd = 0;

                        break;
                    }
                }

                if (toAdd > 0)
                {
                    gold = new Gold(toAdd);

                    if (box.TryDropItem(from, gold, false))
                    {
                        deposited += toAdd;
                    }
                    else
                    {
                        gold.Delete();

                        from.AddToBackpack(new BankCheck(toAdd));
                    }
                }

                // Gold was deposited in your account:
                from.SendLocalizedMessage(1042672, true, " " + deposited.ToString());

                PlayerMobile pm = from as PlayerMobile;

                if (pm != null)
                {
                    QuestSystem qs = pm.Quest;

                    if (qs is Necro.DarkTidesQuest)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(Necro.CashBankCheckObjective));

                        if (obj != null && !obj.Completed)
                        {
                            obj.Complete();
                        }
                    }

                    if (qs is Haven.UzeraanTurmoilQuest)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(Haven.CashBankCheckObjective));

                        if (obj != null && !obj.Completed)
                        {
                            obj.Complete();
                        }
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1047026);                   // That must be in your bank box to use it.
            }
        }
Esempio n. 3
0
            protected override void OnTick()
            {
                m_AContract.m_TimeLeft = m_AContract.m_TimeLeft - 1;

                if (m_AContract.m_TimeLeft > 0)
                {
                    if (m_AContract.m_Debug == true)
                    {
                        m_ContractTimer = new ExpireContractDebugTimer(m_AContract.m_TimeLeft, m_AContract);
                    }
                    else
                    {
                        m_ContractTimer = new ExpireContractTimer(m_AContract.m_TimeLeft, m_AContract);
                    }
                    m_ContractTimer.Start();
                }
                else
                {
                    if (m_AContract.m_Issuer != null)
                    {
                        BankBox box = m_AContract.m_Issuer.BankBox;
                        if (box != null)
                        {
                            int deposited = 0;

                            int toAdd = m_AContract.m_Copper;

                            Copper copper;

                            while (toAdd > 60000)
                            {
                                copper = new Copper(60000);

                                if (box.TryDropItem(m_AContract.m_Issuer, copper, false))
                                {
                                    toAdd     -= 60000;
                                    deposited += 60000;
                                }
                                else
                                {
                                    copper.Delete();

                                    m_AContract.m_Issuer.AddToBackpack(new BankCheck(toAdd));
                                    toAdd = 0;

                                    break;
                                }
                            }

                            if (toAdd > 0)
                            {
                                copper = new Copper(toAdd);

                                if (box.TryDropItem(m_AContract.m_Issuer, copper, false))
                                {
                                    deposited += toAdd;
                                }
                                else
                                {
                                    copper.Delete();

                                    m_AContract.m_Issuer.AddToBackpack(new BankCheck(toAdd));
                                }
                            }

                            // Gold was deposited in your account:
                            m_AContract.m_Issuer.SendLocalizedMessage(1042672, true, " " + deposited.ToString());
                        }

                        /*else
                         * {
                         *      //from.SendLocalizedMessage( 1047026 ); // That must be in your bank box to use it.
                         * }*/
                    }

                    m_AContract.m_Expired = true;
                }
            }