Example #1
0
        public void Carve(Mobile from, Item item)
        {
            Effects.PlaySound(GetWorldLocation(), Map, 0x48F);
            Effects.SendLocationEffect(GetWorldLocation(), Map, 0x3728, 10, 10, 0, 0);

            if (0.3 > Utility.RandomDouble())
            {
                if (ItemID == 0xF7E)
                {
                    from.SendMessage("You destroy the bone.");
                }
                else
                {
                    from.SendMessage("You destroy the bone pile.");
                }

                Verite silver = new Verite(5, 25);

                silver.MoveToWorld(GetWorldLocation(), Map);

                Delete();

                m_Timer.Stop();
            }
            else
            {
                if (ItemID == 0xF7E)
                {
                    from.SendMessage("You damage the bone.");
                }
                else
                {
                    from.SendMessage("You damage the bone pile.");
                }
            }
        }
Example #2
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);
        }