Esempio n. 1
0
        public override bool CheckGold(Mobile from, Item dropped)
        {
            if (dropped is Valorite)
            {
                Valorite g = (Valorite)dropped;

                if (g.Amount > 50)
                {
                    PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "I cannot accept so large a tip!", from.NetState);
                }
                else
                {
                    string tip = m_TipMessage;

                    if (tip == null || (tip = tip.Trim()).Length == 0)
                    {
                        PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "It would not be fair of me to take your money and not offer you information in return.", from.NetState);
                    }
                    else
                    {
                        Direction = GetDirectionTo(from);
                        PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, tip, from.NetState);

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

            return(false);
        }
Esempio n. 2
0
        public static void Deposit(Container cont, int amount)
        {
            while (amount > 0)
            {
                Item item;

                if (amount < 5000)
                {
                    item   = new Valorite(amount);
                    amount = 0;
                }
                else if (amount <= 1000000)
                {
                    item   = new BankCheck(amount);
                    amount = 0;
                }
                else
                {
                    item    = new BankCheck(1000000);
                    amount -= 1000000;
                }

                cont.DropItem(item);
            }
        }
Esempio n. 3
0
            protected override void OnTick()
            {
                int  z      = m_Map.GetAverageZ(m_X, m_Y);
                bool canFit = m_Map.CanFit(m_X, m_Y, z, 6, false, false);

                for (int i = -3; !canFit && i <= 3; ++i)
                {
                    canFit = m_Map.CanFit(m_X, m_Y, z + i, 6, false, false);

                    if (canFit)
                    {
                        z += i;
                    }
                }

                if (!canFit)
                {
                    return;
                }

                Valorite g = new Valorite(10, 20);

                g.MoveToWorld(new Point3D(m_X, m_Y, z), m_Map);

                if (0.5 >= Utility.RandomDouble())
                {
                    switch (Utility.Random(3))
                    {
                    case 0:                             // Fire column
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);
                        Effects.PlaySound(g, g.Map, 0x208);

                        break;
                    }

                    case 1:                             // Explosion
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36BD, 20, 10, 5044);
                        Effects.PlaySound(g, g.Map, 0x307);

                        break;
                    }

                    case 2:                             // Ball of fire
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36FE, 10, 10, 5052);

                        break;
                    }
                    }
                }
            }
Esempio n. 4
0
        public override bool OnDragDrop(Mobile from, Item item)
        {
            if (m_PayRate > 0)
            {
                // Is the creature already hired
                if (Controlled == false)
                {
                    // Is the item the payment in gold
                    if (item is Valorite)
                    {
                        Valorite payment = (Valorite)item;

                        // Is the payment in gold sufficient
                        if (payment.Amount >= m_PayRate)
                        {
                            // Check if this mobile already has a hire
                            BaseHire hire = (BaseHire)HireTable[from];

                            if ((hire != null) &&
                                (hire.Deleted == false) &&
                                (hire.Alive == true) &&
                                (hire.GetOwner() == from))
                            {
                                SayTo(from, 500896);                                   // I see you already have an escort.
                                return(false);
                            }

                            // Try to add the hireling as a follower
                            return(AddHire(from, payment));
                        }
                        else
                        {
                            this.SayHireCost();
                        }
                    }
                    else
                    {
                        SayTo(from, 1043268);                           // Tis crass of me, but I want gold
                    }
                }
                else
                {
                    Say(1042495);                      // I have already been hired.
                }
            }
            else
            {
                SayTo(from, 500200);                   // I have no need for that.
            }

            return(base.OnDragDrop(from, item));
        }
Esempio n. 5
0
        public static bool Deposit(Mobile from, int amount)
        {
            BankBox box = from.FindBankNoCreate();

            if (box == null)
            {
                return(false);
            }

            List <Item> items = new List <Item>();

            while (amount > 0)
            {
                Item item;
                if (amount < 5000)
                {
                    item   = new Valorite(amount);
                    amount = 0;
                }
                else if (amount <= 1000000)
                {
                    item   = new BankCheck(amount);
                    amount = 0;
                }
                else
                {
                    item    = new BankCheck(1000000);
                    amount -= 1000000;
                }

                if (box.TryDropItem(from, item, false))
                {
                    items.Add(item);
                }
                else
                {
                    item.Delete();
                    foreach (Item curItem in items)
                    {
                        curItem.Delete();
                    }

                    return(false);
                }
            }

            return(true);
        }
Esempio n. 6
0
        public static int DepositUpTo(Mobile from, int amount)
        {
            BankBox box = from.FindBankNoCreate();

            if (box == null)
            {
                return(0);
            }

            int amountLeft = amount;

            while (amountLeft > 0)
            {
                Item item;
                int  amountGiven;

                if (amountLeft < 5000)
                {
                    item        = new Valorite(amountLeft);
                    amountGiven = amountLeft;
                }
                else if (amountLeft <= 1000000)
                {
                    item        = new BankCheck(amountLeft);
                    amountGiven = amountLeft;
                }
                else
                {
                    item        = new BankCheck(1000000);
                    amountGiven = 1000000;
                }

                if (box.TryDropItem(from, item, false))
                {
                    amountLeft -= amountGiven;
                }
                else
                {
                    item.Delete();
                    break;
                }
            }

            return(amount - amountLeft);
        }
Esempio n. 7
0
        public virtual bool AddHire(Mobile m, Valorite pay)
        {
            Mobile owner = GetOwner();

            if (owner != null)
            {
                Console.Write("BaseHire.AddHire() {0} Owner.Name = ", this.Name);
                Console.WriteLine(owner.Name);
                m.SendLocalizedMessage(1043283, owner.Name);                   // I am following ~1_NAME~.
                return(false);
            }

            if (SetControlMaster(m))
            {
                m_IsHired       = true;
                HireTable[m]    = this;
                m_RemainingPay += pay.Amount;
                m_PayTimer.Start();
                SayTo(m, 1043258, string.Format("{0}", (pay.Amount / m_PayRate)));                    //"I thank thee for paying me. I will work for thee for ~1_NUMBER~ days.", (int)item.Amount / m_PayRate );
                return(true);
            }

            return(false);
        }
Esempio n. 8
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            if (!e.Handled && e.Mobile.InRange(this.Location, 12))
            {
                for (int i = 0; i < e.Keywords.Length; ++i)
                {
                    int keyword = e.Keywords[i];

                    switch (keyword)
                    {
                    case 0x0000:     // *withdraw*
                    {
                        //e.Handled = true;

                        //if( e.Mobile.Criminal )
                        //{
                        //    this.Say( 500389 ); // I will not do business with a criminal!
                        //    break;
                        //}

                        //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.FindBankNoCreate();

                        //        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;

                        if (e.Mobile.Criminal)
                        {
                            this.Say(500389);         // I will not do business with a criminal!
                            break;
                        }

                        BankBox box = e.Mobile.FindBankNoCreate();

                        //if( box != null )
                        //    this.Say( 1042759, box.TotalGold.ToString() ); // Thy current bank balance is ~1_AMOUNT~ gold.
                        //else
                        //    this.Say( 1042759, "0" ); // Thy current bank balance is ~1_AMOUNT~ gold.

                        if (box != null)
                        {
                            Item[] coins = box.FindItemsByType(new Type[] { CurrencySystem.typeofGold, CurrencySystem.typeofVerite, CurrencySystem.typeofValorite });
                            int    valorite = 0, verite = 0, gold = 0;

                            for (int c = 0; c < coins.Length; c++)
                            {
                                if (coins[c].GetType() == CurrencySystem.typeofGold)
                                {
                                    gold += coins[c].Amount;
                                }
                                else if (coins[c].GetType() == CurrencySystem.typeofVerite)
                                {
                                    verite += coins[c].Amount;
                                }
                                else if (coins[c].GetType() == CurrencySystem.typeofValorite)
                                {
                                    valorite += coins[c].Amount;
                                }
                            }

                            Say(String.Format("Thy current bank balance is {0} valorite, {1} verite, and {2} gold.", valorite, verite, gold));
                        }
                        else
                        {
                            Say("Thy bank box doth not have any coins.");
                        }

                        break;
                    }

                    case 0x0002:     // *bank*
                    {
                        e.Handled = true;

                        if (e.Mobile.Criminal)
                        {
                            this.Say(500378);         // Thou art a criminal and cannot access thy bank box.
                            break;
                        }

                        e.Mobile.BankBox.Open();

                        break;
                    }

                    case 0x0003:     // *check*
                    {
                        //e.Handled = true;

                        //if( e.Mobile.Criminal )
                        //{
                        //    this.Say( 500389 ); // I will not do business with a criminal!
                        //    break;
                        //}

                        //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.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( 1042673, AffixType.Append, amount.ToString(), "" ); // Into your bank box I have placed a check in the amount of:
                        //        }
                        //    }
                        //}

                        break;
                    }
                    }
                }

                if (e.Speech.ToLower().IndexOf("exchange") > -1)
                {
                    BankBox box = e.Mobile.FindBankNoCreate();

                    if (box != null)
                    {
                        int     cc = 0, sc = 0, gc = 0;
                        Point3D ccLoc = Point3D.Zero, scLoc = Point3D.Zero, gcLoc = Point3D.Zero;

                        List <BaseCoin> coins = box.FindItemsByType <BaseCoin>();

                        coins.ForEach(
                            delegate(BaseCoin coin)
                        {
                            if (coin.GetType() == CurrencySystem.typeofGold)
                            {
                                cc   += coin.Amount;
                                ccLoc = coin.Location;
                            }
                            else if (coin.GetType() == CurrencySystem.typeofVerite)
                            {
                                sc   += coin.Amount;
                                scLoc = coin.Location;
                            }
                            else if (coin.GetType() == CurrencySystem.typeofValorite)
                            {
                                gc   += coin.Amount;
                                gcLoc = coin.Location;
                            }

                            coin.Delete();
                        });

                        int[] newAmts = CurrencySystem.Compress(cc, sc, gc);

                        if (newAmts[0] > 0)
                        {
                            Gold gold = new Gold(newAmts[0]);

                            box.AddItem(gold);
                            gold.Location = ccLoc;
                        }

                        if (newAmts[1] > 0)
                        {
                            Verite silver = new Verite(newAmts[1]);

                            box.DropItem(silver);
                            silver.Location = scLoc;
                        }

                        if (newAmts[2] > 0)
                        {
                            Valorite gold = new Valorite(newAmts[2]);

                            box.DropItem(gold);
                            gold.Location = gcLoc;
                        }
                    }
                }
            }

            base.OnSpeech(e);
        }