Withdraw() public static méthode

public static Withdraw ( Mobile from, int amount ) : bool
from Mobile
amount int
Résultat bool
Exemple #1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info.ButtonID == 1)
            {
                int[] switches = info.Switches;

                if (switches.Length > 0)
                {
                    int index  = switches[0] % m_Entries.Length;
                    int offset = switches[0] / m_Entries.Length;

                    if (index >= 0 && index < m_Entries.Length)
                    {
                        if (offset >= 0 && offset < m_Entries[index].Hues.Length)
                        {
                            if (m_Hair && m_From.HairItemID > 0 || m_FacialHair && m_From.FacialHairItemID > 0)
                            {
                                if (!Banker.Withdraw(m_From, m_Vendor.TypeOfCurrency, m_Price))
                                {
                                    // You cannot afford my services for that style.
                                    m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState);
                                    return;
                                }

                                int hue = m_Entries[index].Hues[offset];

                                if (m_Hair)
                                {
                                    m_From.HairHue = hue;
                                }

                                if (m_FacialHair)
                                {
                                    m_From.FacialHairHue = hue;
                                }
                            }
                            else
                            {
                                // You have no hair to dye and you cannot use this.
                                m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502623, m_From.NetState);
                            }
                        }
                    }
                }
                else
                {
                    // You decide not to change your hairstyle.
                    m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState);
                }
            }
            else
            {
                // You decide not to change your hairstyle.
                m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState);
            }
        }
Exemple #2
0
            public override void OnClick()
            {
                if (m_Vendor == null || m_Vendor.Deleted)
                {
                    return;
                }

                BaseBoat boat = BaseBoat.GetBoat(m_From);

                if (boat != null)
                {
                    if (Banker.Withdraw(m_From, 100, true))
                    {
                        if (IsSpecialShip(boat))
                        {
                            RecallRune newRune = new RecallRune();
                            newRune.SetGalleon((BaseGalleon)boat);
                            m_From.AddToBackpack(newRune);
                            m_Vendor.Say(1149580); // A recall rune to your ship has been placed in your backpack.
                        }
                        else
                        {
                            List <KeyType> list = new List <KeyType>();

                            foreach (KeyType type in Enum.GetValues(typeof(KeyType)))
                            {
                                list.Add(type);
                            }

                            KeyType[] Types = list.ToArray();

                            Key packKey = new Key(Types[Utility.Random(Types.Length)], boat.PPlank.KeyValue, boat)
                            {
                                MaxRange = 10,
                                Name     = "a ship key"
                            };

                            m_From.AddToBackpack(packKey);
                        }
                    }
                    else
                    {
                        m_Vendor.Say(500192); // Begging thy pardon, but thou canst not afford that.
                    }
                }
                else
                {
                    m_Vendor.Say(1116767); // The ship could not be located.
                }
            }
Exemple #3
0
            public override void OnClick()
            {
                if (m_Vendor == null || m_Vendor.Deleted)
                {
                    return;
                }

                if (BaseBoat.HasBoat(m_From))
                {
                    if (Banker.Withdraw(m_From, 100, true))
                    {
                        BaseBoat boat = World.Items.Values.OfType <BaseBoat>().Where(x => x.Owner == m_From).FirstOrDefault();

                        if (IsSpecialShip(boat))
                        {
                            ShipRune newRune = new ShipRune((BaseGalleon)boat);
                            m_From.AddToBackpack(newRune);
                            m_Vendor.Say(1149580); // A recall rune to your ship has been placed in your backpack.
                        }
                        else
                        {
                            KeyType[] Types   = Enum.GetValues(typeof(KeyType)).Cast <KeyType>().ToArray();
                            Key       packKey = new Key(Types[Utility.Random(Types.Length)], boat.PPlank.KeyValue, boat);

                            packKey.MaxRange = 10;
                            packKey.Name     = "a ship key";

                            m_From.AddToBackpack(packKey);
                        }
                    }
                    else
                    {
                        m_Vendor.Say(500192); // Begging thy pardon, but thou canst not afford that.
                    }
                }
                else
                {
                    m_Vendor.Say(1116767); // The ship could not be located.
                }
            }
Exemple #4
0
        private bool PlaceBid(Mobile bidder, int totalCost)
        {
            bool bought = false;

            if (ValidateBidder(bidder) == false)
            {
                return(false);
            }

            Container cont = bidder.Backpack;

            if (cont != null)
            {
                if (cont.ConsumeTotal(typeof(Gold), totalCost))
                {
                    bought = true;
                }
            }

            if (!bought)
            {
                if (Banker.Withdraw(bidder, totalCost))
                {
                    bought = true;
                }
                else
                {
                    SayTo(bidder, 500191);                     //Begging thy pardon, but thy bank account lacks these funds.
                }
            }

            if (bought)
            {
                bidder.PlaySound(0x32);
            }

            return(bought);
        }
Exemple #5
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (!m_FacialHair || !m_Female)
            {
                if (info.ButtonID == 1)
                {
                    int[] switches = info.Switches;

                    if (switches.Length > 0)
                    {
                        int  index  = switches[0];
                        bool female = m_Female;

                        if (index >= 0 && index < m_Entries.Length)
                        {
                            ChangeHairstyleEntry entry = m_Entries[index];

                            if (m_From is PlayerMobile)
                            {
                                ((PlayerMobile)m_From).SetHairMods(-1, -1);
                            }

                            int hairID       = m_From.HairItemID;
                            int facialHairID = m_From.FacialHairItemID;
                            int itemID       = female ? entry.ItemID_Female : entry.ItemID_Male;

                            if (itemID == 0)
                            {
                                bool invalid = m_FacialHair ? (facialHairID == 0) : (hairID == 0);

                                if (!invalid)
                                {
                                    if (m_Token != null)
                                    {
                                        m_Token.OnChangeHairstyle(m_From, m_FacialHair, 0);
                                        return;
                                    }

                                    if (Banker.Withdraw(m_From, m_Price, true))
                                    {
                                        if (m_FacialHair)
                                        {
                                            m_From.FacialHairItemID = 0;
                                        }
                                        else
                                        {
                                            m_From.HairItemID = 0;
                                        }
                                    }
                                    else
                                    {
                                        if (m_Vendor != null)
                                        {
                                            m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState);
                                            // You cannot afford my services for that style.
                                        }
                                        else
                                        {
                                            m_From.SendLocalizedMessage(1042293);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                bool invalid = m_FacialHair ? facialHairID > 0 && facialHairID == itemID : hairID > 0 && hairID == itemID;

                                if (!invalid)
                                {
                                    if (m_Price <= 0 || Banker.Withdraw(m_From, m_Price))
                                    {
                                        if (m_Token != null)
                                        {
                                            m_Token.OnChangeHairstyle(m_From, m_FacialHair, itemID);
                                            return;
                                        }

                                        if (m_FacialHair)
                                        {
                                            var old = m_From.FacialHairItemID;

                                            m_From.FacialHairItemID = itemID;

                                            if (itemID != 0 && old == 0)
                                            {
                                                m_From.FacialHairHue = m_From.HairHue;
                                            }
                                        }
                                        else
                                        {
                                            m_From.HairItemID = itemID;
                                        }
                                    }
                                    else
                                    {
                                        if (m_Vendor != null)
                                        {
                                            m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState);
                                            // You cannot afford my services for that style.
                                        }
                                        else
                                        {
                                            m_From.SendLocalizedMessage(1042293);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if (m_Vendor != null)
                        {
                            // You decide not to change your hairstyle.
                            m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState);
                        }
                        else
                        {
                            m_From.SendLocalizedMessage(1013009); // You decide not to change your hairstyle.
                        }
                    }
                }
                else
                {
                    if (m_Vendor != null)
                    {
                        // You decide not to change your hairstyle.
                        m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState);
                    }
                    else
                    {
                        m_From.SendLocalizedMessage(1013009); // You decide not to change your hairstyle.
                    }
                }
            }

            if (m_Token != null)
            {
                m_Token.OnFailedHairstyle(m_From, m_FacialHair);
            }
        }
Exemple #6
0
        public void TryRetrieveHold(Mobile from, BaseBoat boat)
        {
            for (int i = 0; i < m_Crates.Count; i++)
            {
                if (m_Crates[i].Owner == from)
                {
                    from.SendLocalizedMessage(1116516); //Thou must return thy current shipping crate before I can retrieve another shipment for you.
                    return;
                }
            }

            Container pack = from.Backpack;
            Container hold;

            if (boat is BaseGalleon galleon)
            {
                hold = galleon.GalleonHold;
            }
            else
            {
                hold = boat.Hold;
            }

            if (hold == null || hold.Items.Count == 0)
            {
                from.SendMessage("Your hold is empty!");
                return;
            }

            ShipCrate crate = new ShipCrate(from, boat);

            m_Crates.Add(crate);

            if (!pack.ConsumeTotal(typeof(Gold), DryDockAmount))
            {
                Banker.Withdraw(from, DryDockAmount);
            }

            bool        cantMove = false;
            List <Item> items    = new List <Item>(hold.Items);

            foreach (Item item in items)
            {
                if (item.Movable)
                {
                    crate.DropItem(item);
                }
                else
                {
                    cantMove = true;
                }
            }

            Point3D pnt = Point3D.Zero;

            if (!CanDropCrate(ref pnt, Map))
            {
                SayTo(from, 1116517); //Arrrgh!  My dock has no more room.  Please come back later.
                from.BankBox.DropItem(crate);
                from.SendMessage("Your shipping crate has been placed in your bank box.");
                //from.SendMessage("You have 30 minutes to obtain the contents of your shipping crate.  You can find it in the wearhouse on the westernmost tip of the floating emproiam");
            }
            else
            {
                from.SendLocalizedMessage(1116542, ShipCrate.DT.ToString()); //Yer ship has been unloaded to a crate inside this here warehouse.  You have ~1_time~ minutes to get yer goods or it be gone.
                crate.MoveToWorld(pnt, Map);
            }

            if (cantMove)
            {
                from.SendMessage("We were unable to pack up one or more of the items in your cargo hold.");
            }
        }
Exemple #7
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            from.Frozen = false;

            switch (info.ButtonID)
            {
            case -1:
            {
                // You decide against paying the Veterinarian, and the ghost of your pet looks at you sadly...
                from.SendLocalizedMessage(1113197);

                break;
            }

            case 1:
            {
                for (int i = 0; i < m_Pets.Length; i++)
                {
                    BaseCreature pet = m_Pets[i];

                    if (info.IsSwitched(i))
                    {
                        int fee = Veterinarian.GetResurrectionFee(pet);

                        if (!pet.IsDeadBondedPet)
                        {
                            from.SendLocalizedMessage(501041);         // Target is not dead.
                        }
                        else if (!from.CanSee(pet) || !from.InLOS(pet))
                        {
                            from.SendLocalizedMessage(503376);         // Target cannot be seen.
                        }
                        else if (!from.InRange(pet, 12))
                        {
                            from.SendLocalizedMessage(500643);         // Target is too far away.
                        }
                        else if (pet.ControlMaster != from)
                        {
                            from.SendLocalizedMessage(1113200);         // You must be the owner of that pet to have it resurrected.
                        }
                        else if (pet.Corpse != null && !pet.Corpse.Deleted)
                        {
                            from.SendLocalizedMessage(1113279);         // That creature's spirit lacks cohesion. Try again in a few minutes.
                        }
                        else if (Banker.Withdraw(from, fee))
                        {
                            pet.PlaySound(0x214);
                            pet.ResurrectPet();

                            for (int j = 0; j < pet.Skills.Length; ++j)         // Decrease all skills on pet.
                            {
                                pet.Skills[j].Base -= 0.2;
                            }

                            if (pet.Map == Map.Internal)
                            {
                                pet.MoveToWorld(from.Location, from.Map);
                            }

                            from.SendLocalizedMessage(1060398, fee.ToString());                           // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString(), 0x16); // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);         // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                        }
                        break;
                    }
                }

                break;
            }
            }
        }
Exemple #8
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_FacialHair && (m_From.Female || m_From.Body.IsFemale))
            {
                return;
            }

            if (m_From.Race == Race.Elf)
            {
                m_From.SendMessage("This isn't implemented for elves yet.  Sorry!");
                return;
            }

            if (info.ButtonID == 1)
            {
                int[] switches = info.Switches;

                if (switches.Length > 0)
                {
                    int index = switches[0];

                    if (index >= 0 && index < m_Entries.Length)
                    {
                        ChangeHairstyleEntry entry = m_Entries[index];

                        if (m_From is PlayerMobile)
                        {
                            ((PlayerMobile)m_From).SetHairMods(-1, -1);
                        }

                        int hairID       = m_From.HairItemID;
                        int facialHairID = m_From.FacialHairItemID;

                        if (entry.ItemID == 0)
                        {
                            if (m_FacialHair ? (facialHairID == 0) : (hairID == 0))
                            {
                                return;
                            }

                            if (Banker.Withdraw(m_From, m_Price))
                            {
                                if (m_FacialHair)
                                {
                                    m_From.FacialHairItemID = 0;
                                }
                                else
                                {
                                    m_From.HairItemID = 0;
                                }
                            }
                            else
                            {
                                m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState); // You cannot afford my services for that style.
                            }
                        }
                        else
                        {
                            if (m_FacialHair)
                            {
                                if (facialHairID > 0 && facialHairID == entry.ItemID)
                                {
                                    return;
                                }
                            }
                            else
                            {
                                if (hairID > 0 && hairID == entry.ItemID)
                                {
                                    return;
                                }
                            }

                            if (Banker.Withdraw(m_From, m_Price))
                            {
                                if (m_FacialHair)
                                {
                                    m_From.FacialHairItemID = entry.ItemID;
                                }
                                else
                                {
                                    m_From.HairItemID = entry.ItemID;
                                }
                            }
                            else
                            {
                                m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState); // You cannot afford my services for that style.
                            }
                        }
                    }
                }
                else
                {
                    // You decide not to change your hairstyle.
                    m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState);
                }
            }
            else
            {
                // You decide not to change your hairstyle.
                m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState);
            }
        }
Exemple #9
0
        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (Deleted || !from.CheckAlive())
            {
                return;
            }

            if (pet.Body.IsHuman)
            {
                SayTo(from, 502672);                 // HA HA HA! Sorry, I am not an inn.
            }
            else if (!pet.Controlled)
            {
                SayTo(from, 1048053);                 // You can't stable that!
            }
            else if (pet.ControlMaster != from)
            {
                SayTo(from, 1042562);                 // You do not own that pet!
            }
            else if (pet.IsDeadPet)
            {
                SayTo(from, 1049668);                 // Living pets only, please.
            }
            else if (pet.Summoned)
            {
                SayTo(from, 502673);                 // I can not stable summoned creatures.
            }
            else if (pet.Allured)
            {
                SayTo(from, 1048053);                 // You can't stable that!
            }
            else if ((pet is PackLlama || pet is PackHorse || pet is Beetle) &&
                     (pet.Backpack != null && pet.Backpack.Items.Count > 0))
            {
                SayTo(from, 1042563);                 // You need to unload your pet.
            }
            else if (pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map)
            {
                SayTo(from, 1042564);                 // I'm sorry.  Your pet seems to be busy.
            }
            else if (from.Stabled.Count >= GetMaxStabled(from))
            {
                SayTo(from, 1042565);                 // You have too many pets in the stables!
            }
            else if ((from.Backpack != null && from.Backpack.ConsumeTotal(typeof(Gold), 30)) || Banker.Withdraw(from, 30))
            {
                pet.ControlTarget = null;
                pet.ControlOrder  = OrderType.Stay;
                pet.Internalize();

                pet.SetControlMaster(null);
                pet.SummonMaster = null;

                pet.IsStabled = true;
                pet.StabledBy = from;

                if (Core.SE)
                {
                    pet.Loyalty = MaxLoyalty;                     // Wonderfully happy
                }

                from.Stabled.Add(pet);

                SayTo(from, Core.AOS ? 1049677 : 502679);
                // [AOS: Your pet has been stabled.] Very well, thy pet is stabled.
                // Thou mayst recover it by saying 'claim' to me. In one real world week,
                // I shall sell it off if it is not claimed!
            }
            else
            {
                SayTo(from, 502677);                 // But thou hast not the funds in thy bank account!
            }
        }
Exemple #10
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Layer == Layer.FacialHair && (m_From.Female || m_From.Body.IsFemale))
            {
                return;
            }

            if (info.ButtonID == 1)
            {
                int[] switches = info.Switches;

                if (switches.Length > 0)
                {
                    int index = switches[0];

                    if (index >= 0 && index < m_Entries.Length)
                    {
                        ChangeHairstyleEntry entry = m_Entries[index];

                        if (m_From is PlayerMobile)
                        {
                            ((PlayerMobile)m_From).SetHairMods(-1, -1);
                        }

                        Item hair = m_From.FindItemOnLayer(m_Layer);

                        if (entry.ItemType == null)
                        {
                            if (hair == null)
                            {
                                return;
                            }

                            if (Banker.Withdraw(m_From, m_Price))
                            {
                                hair.Delete();
                            }
                            else
                            {
                                m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState);                                 // You cannot afford my services for that style.
                            }
                        }
                        else
                        {
                            if (hair != null && hair.GetType() == entry.ItemType)
                            {
                                return;
                            }

                            Item newHair = null;

                            try { newHair = Activator.CreateInstance(entry.ItemType, null) as Item; }
                            catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }

                            if (newHair == null)
                            {
                                return;
                            }

                            if (Banker.Withdraw(m_From, m_Price))
                            {
                                if (hair != null)
                                {
                                    newHair.Hue = hair.Hue;
                                    hair.Delete();
                                }

                                m_From.AddItem(newHair);
                            }
                            else
                            {
                                newHair.Delete();
                                m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState);                                 // You cannot afford my services for that style.
                            }
                        }
                    }
                }
                else
                {
                    // You decide not to change your hairstyle.
                    m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState);
                }
            }
            else
            {
                // You decide not to change your hairstyle.
                m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState);
            }
        }
Exemple #11
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info.ButtonID == 1)
            {
                int[] switches = info.Switches;

                if (switches.Length > 0)
                {
                    int index  = switches[0] % m_Entries.Length;
                    int offset = switches[0] / m_Entries.Length;

                    if (index >= 0 && index < m_Entries.Length)
                    {
                        if (offset >= 0 && offset < m_Entries[index].Hues.Length)
                        {
                            int hue = m_Entries[index].Hues[offset];

                            bool hasConsumed = false;

                            for (int i = 0; i < m_Layers.Length; ++i)
                            {
                                Item item = m_From.FindItemOnLayer(m_Layers[i]);

                                if (item == null)
                                {
                                    continue;
                                }

                                if (!hasConsumed)
                                {
                                    if (!Banker.Withdraw(m_From, m_Price))
                                    {
                                        m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState);                                         // You cannot afford my services for that style.
                                        return;
                                    }

                                    hasConsumed = true;
                                }

                                item.Hue = hue;
                            }

                            if (!hasConsumed)
                            {
                                m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502623, m_From.NetState);                                 // You have no hair to dye and you cannot use this.
                            }
                        }
                    }
                }
                else
                {
                    // You decide not to change your hairstyle.
                    m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState);
                }
            }
            else
            {
                // You decide not to change your hairstyle.
                m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState);
            }
        }
Exemple #12
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is PetClaimTicket)
            {
                PetClaimTicket pct = (PetClaimTicket)dropped;
                if (pct.Time <= DateTime.UtcNow)
                {
                    if (pct.Pet == null)
                    {
                        from.SendMessage("Error! Contact Gamemaster");
                        return(false);
                    }
                    else if (from.Followers == 0)
                    {
                        Type         pettype = pct.Pet.GetType();
                        BaseCreature bc      = (BaseCreature)pct.Pet;

                        bc.IsStabled = true;
                        from.Stabled.Add(bc);
                        this.SayTo(from, "I have put your pet that was mating in the stable under you name.");

                        BaseCreature baby = null;

                        if (pettype != null)
                        {
                            object o = Activator.CreateInstance(pettype);
                            baby = o as BaseCreature;
                        }

                        if (baby == null)
                        {
                            from.SendMessage(38, "There was an internal error and breeding has failed due to lack of type, Please contact a member of the staff.");
                            return(false);
                        }
                        else
                        {
                            if (from == pct.Owner)
                            {
                                if (Banker.Withdraw(from, pct.Price))
                                {
                                    from.SendLocalizedMessage(1060398, pct.Price.ToString());
                                    from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());

                                    baby.Str                    = pct.Str;
                                    baby.Dex                    = pct.Dex;
                                    baby.Int                    = pct.Int;
                                    baby.HitsMaxSeed            = pct.Hits;
                                    baby.StamMaxSeed            = pct.Stam;
                                    baby.ManaMaxSeed            = pct.Mana;
                                    baby.PhysicalResistanceSeed = pct.Phys;
                                    baby.FireResistSeed         = pct.Fire;
                                    baby.ColdResistSeed         = pct.Cold;
                                    baby.EnergyResistSeed       = pct.Nrgy;
                                    baby.PoisonResistSeed       = pct.Pois;
                                    baby.DamageMin              = pct.Dmin;
                                    baby.DamageMax              = pct.Dmax;
                                    baby.MaxLevel               = pct.Mlev;
                                    baby.Generation             = pct.Gen + 1;

                                    baby.Controlled    = true;
                                    baby.ControlMaster = from;
                                    baby.Location      = from.Location;
                                    baby.ControlTarget = from;
                                    baby.Map           = from.Map;
                                    baby.Name          = baby.Name + " baby";

                                    if (pct.AI == 1)
                                    {
                                        baby.AI = AIType.AI_Mage;
                                    }
                                    else if (pct.AI == 2)
                                    {
                                        baby.AI = AIType.AI_Melee;
                                    }

                                    baby.MoveToWorld(from.Location, from.Map);
                                    baby.ControlOrder = OrderType.Follow;

                                    pct.Delete();

                                    return(true);
                                }
                                else
                                {
                                    this.SayTo(from, "Hey! you tring to cheat me! This anit for free buddy.");
                                    from.SendMessage("You lack the gold in your banking account to do this.");
                                    return(false);
                                }
                            }
                            else
                            {
                                this.SayTo(from, "You are not the owner of this deed.");
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        this.SayTo(from, "Please stable or shrink all your pets before we go on.");
                        return(false);
                    }
                }
                else
                {
                    if (pct.Pet != null)
                    {
                        this.SayTo(from, "Your pet {0} is not done mating yet, Please check back later.", pct.Pet.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("Error in your (Pet Claim Ticket) please contact the staff.");
                        return(false);
                    }
                }
            }
            else
            {
                return(false);
            }
        }
            protected override void OnTarget(Mobile from, object s)
            {
                Container bank = from.FindBankNoCreate();

                if (s == from)
                {
                    m_RoomAttendant.Say("Haha! Sorry! I thought we were rooming someone else... You may sleep here for free.");
                }
                else if (s is PlayerMobile)
                {
                    m_RoomAttendant.Say("Haha! Sorry! I think the sir or madam may speak for themselves.");
                }
                else if (!(s is Squire))
                {
                    m_RoomAttendant.Say("That... Doesn't look like a squire to me.");
                }
                else
                {
                    BaseCreature squi = ( BaseCreature )s;

                    if (squi.Combatant != null && squi.InRange(squi.Combatant, 12) && squi.Map == squi.Combatant.Map)
                    {
                        m_RoomAttendant.SayTo(from, "Your squire seems to be distracted...");
                    }
                    else if (!(squi.Controlled && squi.ControlMaster == from))
                    {
                        m_RoomAttendant.SayTo(from, "That is not your squire to room.");
                    }
                    //Uncomment this section if you don't want them to have items in their backpacks before storing them.

                    /*else if ( squi is Squire && squi.Backpack != null && squi.Backpack.Items.Count > 0 )
                     * {
                     *      m_RoomAttendant.SayTo( from, "Please unload your squire before sending them to a room." );
                     * }*/
                    else if (squi.Mounted == true)
                    {
                        m_RoomAttendant.SayTo(from, "This is not a stable, please have your squire dismount before I rent them a room.");
                    }
                    else if (squi.Summoned)
                    {
                        m_RoomAttendant.SayTo(from, "How did you summon a squire with magic?");
                    }
                    else if (!squi.Alive)
                    {
                        m_RoomAttendant.SayTo(from, "I do not provide rooms for ghosts.");
                    }
                    else if (squi is Squire && squi.Controlled == true && from == squi.ControlMaster && from.Backpack.ConsumeTotal(typeof(Gold), 30) || bank != null && Banker.Withdraw(from, 30))                            //bank.ConsumeTotal( typeof( Gold ), 30 ) )
                    {
                        RoomAFunctions.Room(from, squi, true);
                    }
                    else
                    {
                        m_RoomAttendant.SayTo(from, "I will not room... That.");                           // You can't stable that!
                    }
                }
            }
        public override void OnSpeech(SpeechEventArgs e)
        {
            Mobile    from = e.Mobile;
            Container bank = from.FindBankNoCreate();

            object command = RoomAttendantCommands.None;

            if (e.Speech.Length > "vendor ".Length && e.Speech.Substring(0, "vendor ".Length).ToLower() == "vendor ")
            {
                command = s_Keywords[e.Speech.Substring("vendor ".Length)];
            }
            else if (e.Speech.Length > Name.Length + 1 && e.Speech.Substring(0, Name.Length + 1).ToLower() == Name.ToLower() + ' ')
            {
                command = s_Keywords[e.Speech.Substring(Name.Length + 1)];
            }
            else if (e.Speech.Length > "attendant ".Length && e.Speech.Substring(0, "attendant ".Length).ToLower() == "attendant ")
            {
                command = s_Keywords[e.Speech.Substring("attendant ".Length)];
            }

            switch ((command == null ? (int)RoomAttendantCommands.None : (int)command))
            {
            case (int)RoomAttendantCommands.Room:
            {
                if ((from.Backpack == null || from.Backpack.GetAmount(typeof(Gold)) < 30) && (bank == null || Banker.Withdraw(from, 30))) //bank.GetAmount( typeof( Gold ) ) < 30 ) )
                {
                    SayTo(from, "Thou dost not have enough gold, not even in thy bank account.");                                         // Thou dost not have enough gold, not even in thy bank account.
                }
                else
                {
                    SayTo(from, "I need thirty gold for the carrier pigeon rental.");

                    from.Target = new RoomTarget(this);
                }
                break;
            }

            case (int)RoomAttendantCommands.Help:
            {
                SayTo(from, "For a fee I can rent a carrier pigeon for you to call your squire with from their room.");
                break;
            }

            default:
            {
                base.OnSpeech(e);

                if (!e.Handled && InRange(e.Mobile, 3))
                {
                    if (m_NewsTimer == null && e.HasKeyword(0x30))                                 // *news*
                    {
                        TownCrierEntry tce = GlobalTownCrierEntryList.Instance.GetRandomEntry();

                        if (tce == null)
                        {
                            PublicOverheadMessage(MessageType.Regular, 0x3B2, 1005643);                                       // I have no news at this time.
                        }
                        else
                        {
                            m_NewsTimer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(3.0), new TimerStateCallback(ShoutNews_Callback), new object[] { tce, 0 });

                            PublicOverheadMessage(MessageType.Regular, 0x3B2, 502978);                                       // Some of the latest news!
                        }
                    }

                    for (int i = 0; i < m_Rumors.Length; ++i)
                    {
                        RoomAttendantRumor rumor = m_Rumors[i];

                        if (rumor == null)
                        {
                            continue;
                        }

                        string keyword = rumor.Keyword;

                        if (keyword == null || (keyword = keyword.Trim()).Length == 0)
                        {
                            continue;
                        }

                        if (Insensitive.Equals(keyword, e.Speech))
                        {
                            string message = rumor.Message;

                            if (message == null || (message = message.Trim()).Length == 0)
                            {
                                continue;
                            }

                            PublicOverheadMessage(MessageType.Regular, 0x3B2, false, message);
                        }
                    }
                }

                break;
            }
            }
        }
Exemple #15
0
 public static bool Withdraw(Mobile from, int amount)
 {
     return(Banker.Withdraw(from, amount));
 }
Exemple #16
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info.ButtonID == 1)              // Water Bong
            {
                if (Banker.Withdraw(m_From, 250))
                {
                    m_From.AddToBackpack(new WaterBong());
                    m_From.PrivateOverheadMessage(MessageType.Label, 090, true, "A water bong is placed in your backpack.", m_From.NetState);
                }
                else
                {
                    m_Vendor.PrivateOverheadMessage(MessageType.Label, 090, true, "You don't have enough money in your bank.", m_From.NetState);
                }
            }

            if (info.ButtonID == 2)              // Joint
            {
                if (Banker.Withdraw(m_From, 50))
                {
                    m_From.AddToBackpack(new Joint());
                    m_From.PrivateOverheadMessage(MessageType.Label, 090, true, "A joint is placed in your backpack.", m_From.NetState);
                }
                else
                {
                    m_Vendor.PrivateOverheadMessage(MessageType.Label, 090, true, "You don't have enough money in your bank.", m_From.NetState);
                }
            }

            if (info.ButtonID == 3)              // Rolling Paper
            {
                if (Banker.Withdraw(m_From, 10))
                {
                    m_From.AddToBackpack(new RollingPaper());
                    m_From.PrivateOverheadMessage(MessageType.Label, 090, true, "A rolling paper is placed in your backpack.", m_From.NetState);
                }
                else
                {
                    m_Vendor.PrivateOverheadMessage(MessageType.Label, 090, true, "You don't have enough money in your bank.", m_From.NetState);
                }
            }

            if (info.ButtonID == 4)              // Marijuana
            {
                if (Banker.Withdraw(m_From, 200))
                {
                    m_From.AddToBackpack(new Marijuana());
                    m_From.PrivateOverheadMessage(MessageType.Label, 090, true, "Some marijuana's placed in your backpack.", m_From.NetState);
                }
                else
                {
                    m_Vendor.PrivateOverheadMessage(MessageType.Label, 090, true, "You don't have enough money in your bank.", m_From.NetState);
                }
            }
            if (info.ButtonID == 5)              // MarijuanaSeeds
            {
                if (Banker.Withdraw(m_From, 500))
                {
                    m_From.AddToBackpack(new MarijuanaSeeds());
                    m_From.PrivateOverheadMessage(MessageType.Label, 090, true, "Some MarijuanaSeed is placed in your backpack.", m_From.NetState);
                }
                else
                {
                    m_Vendor.PrivateOverheadMessage(MessageType.Label, 090, true, "You don't have enough money in your bank.", m_From.NetState);
                }
            }

            if (info.ButtonID == 6)               // Cigarette
            {
                if (Banker.Withdraw(m_From, 250))
                {
                    m_From.AddToBackpack(new KarmaBong());
                    m_From.PrivateOverheadMessage(MessageType.Label, 090, true, "A Karma Bong is placed in your backpack.", m_From.NetState);
                }
                else
                {
                    m_Vendor.PrivateOverheadMessage(MessageType.Label, 090, true, "You don't have enough money in your bank.", m_From.NetState);
                }
            }
        }