Deposit() public static method

public static Deposit ( Mobile from, int amount ) : bool
from Mobile
amount int
return bool
Ejemplo n.º 1
0
            protected override void OnTick()
            {
                BaseHouse house = m_Inventory.House;

                if (house != null)
                {
                    if (m_Inventory.Currency > 0)
                    {
                        if (house.MovingCrate == null)
                        {
                            house.MovingCrate = new MovingCrate(house);
                        }

                        Banker.Deposit(house.MovingCrate, m_Inventory.TypeOfCurrency, m_Inventory.Currency);
                    }

                    foreach (Item item in m_Inventory.Items.Where(item => !item.Deleted))
                    {
                        house.DropToMovingCrate(item);
                    }

                    m_Inventory.Currency = 0;
                    m_Inventory.Items.Clear();
                }

                m_Inventory.Delete();
            }
Ejemplo n.º 2
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                Mobile from = sender.Mobile;

                if (info.ButtonID == 2)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Deposit(from, 5000, true))
                        {
                            SphynxFortune.ApplyFortune(from, Sphynx);
                            SphynxFortune.ApplyFortune(from, Sphynx);

                            from.UpdateResistances();
                        }
                        else
                        {
                            from.SendLocalizedMessage(1061006); // You haven't got the coin to make the proper donation to the Sphynx.  Your fortune has not been read.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1061007); // You decide against having your fortune told.
                    }
                }
            }
Ejemplo n.º 3
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is HouseDeed)
            {
                HouseDeed deed  = (HouseDeed)dropped;
                int       price = ComputePriceFor(deed);

                if (price > 0)
                {
                    if (Banker.Deposit(from, price))
                    {
                        // For the deed I have placed gold in your bankbox :
                        PublicOverheadMessage(MessageType.Regular, 0x3B2, 1008000, AffixType.Append, price.ToString(), "");

                        deed.Delete();
                        return(true);
                    }
                    else
                    {
                        PublicOverheadMessage(MessageType.Regular, 0x3B2, 500390);                           // Your bank box is full.
                        return(false);
                    }
                }
                else
                {
                    PublicOverheadMessage(MessageType.Regular, 0x3B2, 500607);                       // I'm not interested in that.
                    return(false);
                }
            }

            return(base.OnDragDrop(from, dropped));
        }
Ejemplo n.º 4
0
        private void AwardBounty(Mobile bountyHunter, string killer, int total)
        {
            var bountySize = 0;

            if (total > 15000)
            {
                bountySize = 2;
            }
            else if (total > 100)
            {
                bountySize = 1;
            }

            switch (bountySize)
            {
            case 2:
                bountyHunter.PlaySound(0x2E6);
                Say("Thou hast brought the infamous " + killer + " to justice!  Thy reward of " + total + "gp hath been deposited in thy bank account.");
                break;

            case 1:
                bountyHunter.PlaySound(0x2E5);
                Say("Tis a minor criminal, thank thee. Thy reward of " + total + "gp hath been deposited in thy bank account.");
                break;

            default:
                bountyHunter.PlaySound(0x2E4);
                Say("Thou hast wasted thy time for " + total + "gp.");
                break;
            }

            Banker.Deposit(bountyHunter, total);
        }
            protected override void OnTick()
            {
                BaseHouse house = m_Inventory.House;

                if (house != null)
                {
                    if (m_Inventory.Gold > 0)
                    {
                        if (house.MovingCrate == null)
                        {
                            house.MovingCrate = new MovingCrate(house);
                        }

                        Banker.Deposit(house.MovingCrate, m_Inventory.Gold);
                    }

                    foreach (Item item in m_Inventory.Items)
                    {
                        if (!item.Deleted)
                        {
                            house.DropToMovingCrate(item);
                        }
                    }

                    m_Inventory.Gold = 0;
                    m_Inventory.Items.Clear();
                }

                m_Inventory.Delete();
            }
Ejemplo n.º 6
0
        public virtual void Destroy(bool toBackpack)
        {
            FixDresswear();

            List <Item> list = GetItems();

            if (list.Count > 0 || HoldGold > 0)
            {
                if (this.Map != Map.Internal)
                {
                    Container backpack = new Backpack();

                    if (HoldGold > 0)
                    {
                        Banker.Deposit(backpack, HoldGold);
                    }

                    foreach (Item item in list)
                    {
                        backpack.DropItem(item);
                    }

                    backpack.MoveToWorld(this.Location, this.Map);
                }
            }

            Delete();
        }
Ejemplo n.º 7
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is Head)
            {
                Head ph = dropped as Head;

                Mobile p = World.FindMobile(ph.PlayerSerial);

                if (p != null && p is PlayerMobile && (ph.WhenKilled + TimeSpan.FromHours(24.0)) > DateTime.Now)
                {
                    PlayerMobile pm = p as PlayerMobile;
                    if (pm.Bounty > 0)
                    {
                        if (from.Karma < 1)
                        {
                            Say(true, "We only accept bounty hunting from honorable folk! Away with thee!");
                            return(false);
                        }

                        Say(true, "Ah, a head!  Let me check to see if there is a bounty on this.");
                        if (Banker.Deposit(from, pm.Bounty))
                        {
                            FindDeletePost(pm);
                            Timer m_timer = new GiveBountyTimer(pm, this, ph, from);
                            m_timer.Start();
                            ph.Delete();
                            return(true);
                        }
                        else
                        {
                            Say(true, String.Format("There is a bounty on {0}, but your bank box is full.", pm.Name));
                            return(false);
                        }
                    }
                    else
                    {
                        if (from.Karma < 1)
                        {
                            Say(true, "We only accept bounty hunting from honorable folk! Away with thee!");
                            return(false);
                        }
                        //GetSpeech();
                        Say(true, "Ah, a head!  Let me check to see if there is a bounty on this.");
                        Timer m_timer = new GiveBountyTimer(pm, this, ph, from);
                        m_timer.Start();
                        ph.Delete();
                        return(true);
                    }
                }
                else
                {
                    GetSpeech();
                    ph.Delete();
                    return(true);
                }
            }
            return(base.OnDragDrop(from, dropped));
        }
Ejemplo n.º 8
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is BaseLottoTicket)
            {
                BaseLottoTicket ticket = (BaseLottoTicket)dropped;
                int             payOut = ticket.Payout;
                Container       pack   = from.Backpack;

                if (!ticket.Checked)
                {
                    Say("You haven't played this ticket yet!");
                    return(false);
                }

                if (!ticket.CashedOut && ticket.FreeTicket)
                {
                    GiveFreeTicket(from, ticket);
                }

                if (ticket.CashedOut)
                {
                    Say("This ticket has already been cashed out!");
                }

                else if (payOut == 0)
                {
                    Say("I'm sorry, but this ticket is not a winning ticket.");
                }

                else
                {
                    if (payOut <= 1000000 && pack != null)
                    {
                        pack.DropItem(new BankCheck(payOut));
                        from.SendMessage("Your winnings of {0} has been placed into your backpack. Please play again.", payOut);
                    }
                    else
                    {
                        Banker.Deposit(from, payOut);
                        from.SendMessage("Your winnings of {0} has been deposited into your bankbox. Please play again.", payOut);
                    }

                    from.PlaySound(52);
                    from.PlaySound(53);
                    from.PlaySound(54);
                    from.PlaySound(55);
                    ticket.CashedOut = true;
                }

                dropped.Delete();
            }

            return(false);
        }
Ejemplo n.º 9
0
        public override void Destroy(bool toBackpack)
        {
            //if any gold held for landlord deposit it
            if (RentalGold > 0)
            {
                Banker.Deposit(Landlord, RentalGold);
                RentalGold = 0;
            }

            base.Destroy(toBackpack);
        }
Ejemplo n.º 10
0
        public override void Destroy(bool toBackpack)
        {
            if (RentalGold > 0 && House?.IsAosRules == true)
            {
                House.MovingCrate ??= new MovingCrate(House);

                Banker.Deposit(House.MovingCrate, RentalGold);
                RentalGold = 0;
            }

            base.Destroy(toBackpack);
        }
Ejemplo n.º 11
0
        public override void Destroy(bool toBackpack)
        {
            if (RentalGold > 0 && House != null && House.IsAosRules)
            {
                if (House.MovingCrate == null)
                {
                    House.MovingCrate = new MovingCrate(House);
                }

                Banker.Deposit(House.MovingCrate, RentalGold);
                RentalGold = 0;
            }

            base.Destroy(toBackpack);
        }
Ejemplo n.º 12
0
        public override void Destroy(bool toBackpack)
        {
            if (RentalCurrency > 0 && House != null && House.IsAosRules)
            {
                if (House.MovingCrate == null)
                {
                    House.MovingCrate = new MovingCrate(House);
                }

                Banker.Deposit(House.MovingCrate, TypeOfCurrency, RentalCurrency);
                RentalCurrency = 0;
            }

            base.Destroy(toBackpack);
        }
Ejemplo n.º 13
0
        private void RefundBid()
        {
            Mobile m = World.FindMobile(m_HighBidMobile);

            if (CheckID() && m != null)
            {
                // deposit the refund
                BankBox box = m.BankBox;
                //Item item = (m_HighBid >= 1000 ? (Item)new BankCheck(m_HighBid) : (Item)new Gold(m_HighBid));
                if (Misc.Diagnostics.Assert(box != null, "box == null"))
                {
                    //box.AddItem(item);
                    Banker.Deposit(box, m_HighBid);
                    LogEvent(String.Format("RefundBid() : player: {0}, amount: {1} gold", m, m_HighBid));
                }
            }
        }
Ejemplo n.º 14
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            // trigger returns true if returnoverride
            if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) &&
                UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, dropped))
            {
                return(true);
            }

            if (!TestCenter.Enabled && dropped is HouseDeed)
            {
                Faction fact = Faction.Find(from);

                if (FactionAllegiance != null && fact != null && FactionAllegiance != fact)
                {
                    Say("I will not do business with the enemy!");
                }
                else
                {
                    var deed  = (HouseDeed)dropped;
                    int price = ComputePriceFor(deed);

                    if (price > 0)
                    {
                        if (Banker.Deposit(from, TypeOfCurrency, price))
                        {
                            Say("For the deed I have placed {0} in your bank box : {1:#,0}", TypeOfCurrency.Name, price);

                            deed.Delete();
                            return(true);
                        }

                        Say(500390);                         // Your bank box is full.
                        return(false);
                    }

                    Say(500607);                     // I'm not interested in that.
                    return(false);
                }
            }

            return(base.OnDragDrop(from, dropped));
        }
Ejemplo n.º 15
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (!TestCenter.Enabled && dropped is HouseDeed)
            {
                Faction fact = Faction.Find(from);
                if (FactionAllegiance != null && fact != null && FactionAllegiance != fact)
                {
                    Say("I will not do business with the enemy!");
                }
                else
                {
                    HouseDeed deed  = (HouseDeed)dropped;
                    int       price = ComputePriceFor(deed);

                    if (price > 0)
                    {
                        if (Banker.Deposit(from, price))
                        {
                            // For the deed I have placed gold in your bankbox :
                            PublicOverheadMessage(MessageType.Regular, 0x3B2, 1008000, AffixType.Append, price.ToString(), "");

                            deed.Delete();
                            return(true);
                        }
                        else
                        {
                            PublicOverheadMessage(MessageType.Regular, 0x3B2, 500390);                               // Your bank box is full.
                            return(false);
                        }
                    }
                    else
                    {
                        PublicOverheadMessage(MessageType.Regular, 0x3B2, 500607);                           // I'm not interested in that.
                        return(false);
                    }
                }
            }

            return(base.OnDragDrop(from, dropped));
        }
Ejemplo n.º 16
0
        public override void Destroy(bool toBackpack)
        {
            if (RentalGold > 0 && House != null && House.IsAosRules)
            {
                if (House.MovingCrate == null)
                {
                    House.MovingCrate = new MovingCrate(House);
                }

                if (AccountGold.Enabled && Landlord != null)
                {
                    Banker.Deposit(Landlord, RentalGold, true);
                }
                else
                {
                    Banker.Deposit(House.MovingCrate, RentalGold);
                }

                RentalGold = 0;
            }

            base.Destroy(toBackpack);
        }
Ejemplo n.º 17
0
        public virtual void Destroy(bool toBackpack)
        {
            Return();

            /* Possible cases regarding item return:
             *
             * 1. No item must be returned
             *       -> do nothing.
             * 2. ( toBackpack is false OR the vendor is in the internal map ) AND the vendor is associated with a AOS house
             *       -> put the items into the moving crate or a vendor inventory,
             *          depending on whether the vendor owner is also the house owner.
             * 3. ( toBackpack is true OR the vendor isn't associated with any AOS house ) AND the vendor isn't in the internal map
             *       -> put the items into a backpack.
             * 4. The vendor isn't associated with any house AND it's in the internal map
             *       -> do nothing (we can't do anything).
             */

            var items = GetAllItems();

            if (items.Any() || HoldGold > 0)                                    // No case 1
            {
                if ((!toBackpack || this.Map == Map.Internal) && House != null) // Case 2
                {
                    if (House.IsOwner(Owner))                                   // Move to moving crate
                    {
                        if (House.MovingCrate == null)
                        {
                            House.MovingCrate = new MovingCrate(House);
                        }

                        if (HoldGold > 0)
                        {
                            Banker.Deposit(House.MovingCrate, HoldGold);
                        }

                        foreach (Item item in items)
                        {
                            House.MovingCrate.DropItem(item);
                        }
                    }
                    else                     // Move to vendor inventory
                    {
                        VendorInventory inventory = new VendorInventory(House, Owner, Name, ShopName);
                        inventory.Gold = HoldGold;

                        foreach (var item in items)
                        {
                            inventory.AddItem(item);
                        }

                        House.VendorInventories.Add(inventory);
                    }
                }
                else if ((toBackpack || House == null) && this.Map != Map.Internal)                     // Case 3 - Move to backpack
                {
                    Container backpack = new Backpack();

                    if (HoldGold > 0)
                    {
                        Banker.Deposit(backpack, HoldGold);
                    }

                    foreach (var item in items)
                    {
                        backpack.DropItem(item);
                    }

                    backpack.MoveToWorld(this.Location, this.Map);
                }
            }

            Delete();
        }
Ejemplo n.º 18
0
 public static void Deposit(Container cont, int amount)
 {
     Banker.Deposit(cont, amount);
 }
Ejemplo n.º 19
0
 public static bool Deposit(Mobile from, int amount)
 {
     return(Banker.Deposit(from, amount));
 }