コード例 #1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info.ButtonID == 1 && info.IsSwitched(1) && sender.Mobile is PlayerMobile player)
            {
                QuestSystem qs = player.Quest;

                if (qs is CollectorQuest && qs.FindObjective(typeof(FindSheetMusicObjective)) is FindSheetMusicObjective obj && !obj.Completed)
                {
                    if (player.Backpack != null && player.Backpack.ConsumeTotal(typeof(Gold), 10))
                    {
                        obj.Complete();
                    }
                    else
                    {
                        BankBox bank = player.FindBankNoCreate();
                        if (bank != null && bank.ConsumeTotal(typeof(Gold), 10))
                        {
                            obj.Complete();
                        }
                        else
                        {
                            player.SendLocalizedMessage(1055108); // You don't have enough gold to buy the sheet music.
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: CreateBountyGump.cs プロジェクト: nydehi/imagine-uo
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 1)
            {
                Mobile  from = state.Mobile;
                BankBox box  = from.BankBox;
                string  text = (string)info.GetTextEntry(1).Text;

                if (text.Length > 0)
                {
                    try
                    {
                        int amount = Convert.ToInt32(text);

                        if (amount < 1)
                        {
                            from.SendMessage("Thats to low of an amount.");
                            from.SendGump(new CreateBountyGump(from, m_Killer));
                        }
                        else if (box.TotalGold < amount)
                        {
                            from.SendMessage("You lack the gold for that bounty.");
                            from.SendGump(new CreateBountyGump(from, m_Killer));
                        }
                        else
                        {
                            box.ConsumeTotal(typeof(Gold), amount);
                            FSBountySystem.CreateBounty(m_Killer, amount);
                            from.SendMessage("{0} has been removed from your bank.", amount);
                            from.SendMessage("The bounty has been placed on {0}'s head.", m_Killer.Name);
                        }
                    }
                    catch
                    {
                        from.SendMessage("You must enter a number amount.");
                        from.SendGump(new CreateBountyGump(from, m_Killer));
                    }
                }
            }
        }
コード例 #3
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            if (!e.Handled && e.Mobile.InRange(this.Location, 8))
            {
                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.BankBox;

                                if (box == null || !box.ConsumeTotal(typeof(Gold), amount))
                                {
                                    this.Say(500384);                                                       // Ah, art thou trying to fool me? Thou hast not so much gold!
                                }
                                else
                                {
                                    e.Mobile.AddToBackpack(new Gold(amount));

                                    this.Say(1010005);                                                       // Thou hast withdrawn gold from thy account.
                                }
                            }
                        }

                        break;
                    }

                    case 0x0001:                             // *balance*
                    {
                        e.Handled = true;

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

                        BankBox box = e.Mobile.BankBox;

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

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

                        BankBox box = e.Mobile.BankBox;

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

                        break;
                    }
                    }
                }
            }

            base.OnSpeech(e);
        }
コード例 #4
0
ファイル: Banker.cs プロジェクト: grandhae/RunUO.T2A
        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;

                            Container pack = e.Mobile.Backpack;

                            if (!int.TryParse(split[1], out amount))
                            {
                                break;
                            }

                            if (amount > 5000)
                            {
                                this.Say(500381);         // Thou canst not withdraw so much at one time!
                            }
                            else if (pack == null || pack.Deleted || !(pack.TotalWeight < pack.MaxWeight) || !(pack.TotalItems < pack.MaxItems))
                            {
                                this.Say(1048147);         // Your backpack can't hold anything else.
                            }
                            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
                                {
                                    pack.DropItem(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.
                        }
                        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;
                    }
                    }
                }
            }

            base.OnSpeech(e);
        }
コード例 #5
0
ファイル: Banker.cs プロジェクト: slawdis/uoodyssey-scripts
        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;

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

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

                            Container pack = e.Mobile.Backpack;

                            if (!int.TryParse(split[1], out amount))
                            {
                                break;
                            }

                            if ((!Core.ML && amount > 5000) || (Core.ML && amount > 60000))
                            {
                                this.Say(500381);                                           // Thou canst not withdraw so much at one time!
                            }
                            else if (pack == null || pack.Deleted || !(pack.TotalWeight < pack.MaxWeight) || !(pack.TotalItems < pack.MaxItems))
                            {
                                this.Say(1048147);                                         // Your backpack can't hold anything else.
                            }
                            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
                                {
                                    pack.DropItem(new Gold(amount));

                                    Server.Gumps.WealthBar.RefreshWealthBar(e.Mobile);

                                    this.Say(1010005);                                             // Thou hast withdrawn gold from thy account.
                                }
                            }
                        }

                        break;
                    }

                    case 0x0001:                             // *balance*
                    {
                        e.Handled = true;

                        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.
                        }
                        break;
                    }

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

                        BankBox box = e.Mobile.BankBox;
                        if (box != null)
                        {
                            box.GumpID = BaseContainer.BankGump(e.Mobile, box);
                            box.Open();
                        }

                        break;
                    }

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

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

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

                            if (!int.TryParse(split[1], out amount))
                            {
                                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:
                                }
                                Server.Gumps.WealthBar.RefreshWealthBar(e.Mobile);
                            }
                        }

                        break;
                    }
                    }
                }
            }

            base.OnSpeech(e);
        }
コード例 #6
0
ファイル: Banker.cs プロジェクト: rberiot/imaginenation
        public override void OnSpeech(SpeechEventArgs e)
        {
            if (!e.Handled && e.Mobile.InRange(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.IsInEvent)
                        {
                            e.Mobile.SendAsciiMessage("You can't do this while in an event.");
                            break;
                        }

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

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

                            Container pack = e.Mobile.Backpack;

                            if (!int.TryParse(split[1], out amount))
                            {
                                break;
                            }

                            if ((!Core.ML && amount > 5000) || (Core.ML && amount > 60000))
                            {
                                Say(500381);                                           // Thou canst not withdraw so much at one time!
                            }
                            else if (pack == null || pack.Deleted || !(pack.TotalWeight < pack.MaxWeight) || !(pack.TotalItems < pack.MaxItems))
                            {
                                this.Say(1048147);     // Your backpack can't hold anything else.
                            }
                            else if (amount > 0)
                            {
                                BankBox box = e.Mobile.FindBankNoCreate();

                                if (box == null || !box.ConsumeTotal(typeof(Gold), amount))
                                {
                                    Say(500384);                                               // Ah, art thou trying to fool me? Thou hast not so much gold!
                                }
                                else
                                {
                                    pack.DropItem(new Gold(amount));

                                    Say(1010005);                                               // Thou hast withdrawn gold from thy account.
                                }
                            }
                        }

                        break;
                    }

                    case 0x0001:                             // *balance*
                    {
                        e.Handled = true;

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

                        BankBox box = e.Mobile.FindBankNoCreate();

                        if (box != null)
                        {
                            Say(1042759, GetBalance(e.Mobile).ToString());                                       // Thy current bank balance is ~1_AMOUNT~ gold.
                        }
                        else
                        {
                            Say(1042759, "0");                                       // Thy current bank balance is ~1_AMOUNT~ gold.
                        }
                        break;
                    }

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

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

                        if (e.Mobile.IsInEvent)
                        {
                            e.Mobile.SendAsciiMessage("You can't do this while in an event.");
                            break;
                        }

                        BankBox box = e.Mobile.BankBox;

                        e.Mobile.BankBox.Open();

                        break;
                    }

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

                        if (e.Mobile.IsInEvent)
                        {
                            e.Mobile.SendAsciiMessage("You can't do this while in an event.");
                            break;
                        }

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

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

                            if (!int.TryParse(split[1], out amount))
                            {
                                break;
                            }

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

                                BankBox box = e.Mobile.BankBox;

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

                        break;
                    }
                    }
                }
            }

            base.OnSpeech(e);
        }
コード例 #7
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.BankBox;

                                if (box == null || !box.ConsumeTotal(typeof(Gold), amount))
                                {
                                    this.Say(500384);                                                     // Ah, art thou trying to fool me? Thou hast not so much gold!
                                }
                                else
                                {
                                    e.Mobile.AddToBackpack(new Gold(amount));

                                    this.Say(1010005);                                                     // Thou hast withdrawn gold from thy account.
                                }
                            }
                        }

                        break;
                    }

                    case 0x0001:                             // *balance*
                    {
                        e.Handled = true;

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

                        BankBox box = e.Mobile.BankBox;

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

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

                        if (e.Mobile.Player == true)
                        {
                            if (e.Mobile is PlayerMobile)
                            {
                                PlayerMobile pm = e.Mobile as PlayerMobile;

                                if (DateTime.Now - pm.LastStoleAt < TimeSpan.FromMinutes(2))
                                {
                                    this.Say(500378);                                                     // Thou art a criminal and cannot access thy bank box.
                                    break;
                                }

                                //check that we're not actively involved in a fight:
                                bool bBreak = false;
                                for (int a = 0; a < pm.Aggressed.Count; a++)
                                {
                                    AggressorInfo info = (AggressorInfo)pm.Aggressed[a];
                                    if (!info.Expired)
                                    {
                                        if (info.Attacker == pm && info.Defender is PlayerMobile)
                                        {
                                            this.Say("You seem to be busy to bank, come back when you're not fighting.");
                                            bBreak = true;
                                            break;
                                        }
                                    }
                                }
                                if (bBreak)
                                {
                                    break;
                                }
                            }
                        }
                        BankBox box = e.Mobile.BankBox;

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

                        break;
                    }
                    }
                }
            }

            base.OnSpeech(e);
        }
コード例 #8
0
        public static void HandleSpeech(Mobile vendor, SpeechEventArgs e)
        {
            if (!e.Handled && e.Mobile.InRange(vendor, 12))
            {
                if (e.Mobile.Map.Rules != MapRules.FeluccaRules && vendor is BaseVendor baseVendor && !baseVendor.CheckVendorAccess(e.Mobile))
                {
                    return;
                }

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

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

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

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

                            Container pack = e.Mobile.Backpack;

                            if (!int.TryParse(split[1], out amount))
                            {
                                break;
                            }

                            if (amount > 60000)
                            {
                                // Thou canst not withdraw so much at one time!
                                vendor.Say(500381);
                            }
                            else if (pack == null || pack.Deleted || !(pack.TotalWeight < pack.MaxWeight) ||
                                     !(pack.TotalItems < pack.MaxItems))
                            {
                                // Your backpack can't hold anything else.
                                vendor.Say(1048147);
                            }
                            else if (amount > 0)
                            {
                                BankBox box = e.Mobile.Player ? e.Mobile.BankBox : e.Mobile.FindBankNoCreate();

                                if (box == null || !Withdraw(e.Mobile, amount))
                                {
                                    // Ah, art thou trying to fool me? Thou hast not so much gold!
                                    vendor.Say(500384);
                                }
                                else
                                {
                                    pack.DropItem(new Gold(amount));

                                    // Thou hast withdrawn gold from thy account.
                                    vendor.Say(1010005);
                                }
                            }
                        }
                    }
                    break;

                    case 0x0001:     // *balance*
                    {
                        e.Handled = true;

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

                        if (AccountGold.Enabled && e.Mobile.Account is Account account)
                        {
                            vendor.Say(1155855, string.Format("{0:#,0}\t{1:#,0}",
                                                              account.TotalPlat,
                                                              account.TotalGold), 0x3BC);

                            vendor.Say(1155848, string.Format("{0:#,0}", account.GetSecureAccountAmount(e.Mobile)), 0x3BC);
                        }
                        else
                        {
                            // Thy current bank balance is ~1_AMOUNT~ gold.
                            vendor.Say(1042759, GetBalance(e.Mobile).ToString("#,0"));
                        }
                    }
                    break;

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

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

                        e.Mobile.BankBox.Open();
                    }
                    break;

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

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

                        if (AccountGold.Enabled && e.Mobile.Account != null)
                        {
                            vendor.Say("We no longer offer a checking service.");
                            break;
                        }

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

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

                            if (!int.TryParse(split[1], out amount))
                            {
                                break;
                            }

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

                                BankBox box = e.Mobile.BankBox;

                                if (!box.TryDropItem(e.Mobile, check, false))
                                {
                                    // There's not enough room in your bankbox for the check!
                                    vendor.Say(500386);
                                    check.Delete();
                                }
                                else if (!box.ConsumeTotal(typeof(Gold), amount))
                                {
                                    // Ah, art thou trying to fool me? Thou hast not so much gold!
                                    vendor.Say(500384);
                                    check.Delete();
                                }
                                else
                                {
                                    // Into your bank box I have placed a check in the amount of:
                                    vendor.Say(1042673, AffixType.Append, amount.ToString("#,0"), "");
                                }
                            }
                        }
                    }
                    break;
                    }
                }
            }
        }
コード例 #9
0
ファイル: ReportMurderer.cs プロジェクト: phpjunkie420/RunUO
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            TextRelay         entry0 = info.GetTextEntry(0);
            string            text0  = (entry0 == null ? "0" : entry0.Text.Trim());
            BulletinBoardPost post   = null;

            switch (info.ButtonID)
            {
            case 1:
            {
                Mobile killer = m_Killers[m_Idx];
                if (killer != null && !killer.Deleted)
                {
                    bool emptiedbank = false;

                    //add kills
                    killer.Kills++;
                    killer.ShortTermMurders++;

                    if (killer is PlayerMobile)
                    {
                        ((PlayerMobile)killer).ResetKillTime();

                        //do they have an existing post?
                        post = FindPost(((PlayerMobile)killer));

                        //is there a bounty being set?
                        if (balance >= Int32.Parse(text0) && Int32.Parse(text0) > 0)
                        {
                            //withdraw bounty from victims account
                            bank.ConsumeTotal(typeof(Gold), Int32.Parse(text0));

                            //set bounty
                            ((PlayerMobile)killer).Bounty = ((PlayerMobile)killer).Bounty + Int32.Parse(text0);

                            //make them dread lord
                            killer.Karma = -127;

                            //wipe bank
                            BankBox killerbank = killer.BankBox;
                            if (killerbank.Items.Count > 0)
                            {
                                //add killers gold to his bounty
                                killerbalance = 0;
                                Item[] killergold;

                                if (killerbank != null)
                                {
                                    killergold = killerbank.FindItemsByType(typeof(Gold));

                                    for (int i = 0; i < killergold.Length; ++i)
                                    {
                                        killerbalance += killergold[i].Amount;
                                    }

                                    killerbank.ConsumeTotal(typeof(Gold), killerbalance);
                                    ((PlayerMobile)killer).Bounty += killerbalance;

                                    killer.SendAsciiMessage("A bounty hath been issued for thee, and thy worldly goods are hereby confiscated!");
                                    emptiedbank = true;

                                    //remove all items in the bank
                                    List <Item> list = new List <Item>();
                                    foreach (Item item in killerbank.Items)
                                    {
                                        list.Add(item);
                                    }

                                    foreach (Item i in list)
                                    {
                                        i.Delete();
                                    }
                                }
                            }

                            //make new bounty post
                            if (post != null)
                            {
                                FindEditPost(((PlayerMobile)killer), post);
                            }
                            else
                            {
                                MakePost(((PlayerMobile)killer));
                            }
                        }

                        /*if (!emptiedbank)
                         *  killer.SendAsciiMessage("You have been reported for murder!");*/
                    }
                }
                break;
            }

            case 2:
            {
                break;
            }
            }

            m_Idx++;
            if (m_Idx < m_Killers.Count)
            {
                from.SendGump(new ReportMurdererGump(from, m_Killers, m_Idx));
            }
        }
コード例 #10
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            switch (info.ButtonID)
            {
            case 1:
            {
                v_Counts = from.ShortTermMurders;

                if (v_BankedGoldAmount >= 30000 && v_Counts >= 1 && v_LCounts < from.ShortTermMurders)
                {
                    from.SendMessage("You have increased your bribe by 30,000gp!");

                    v_Bribe   = v_Bribe + 30000;
                    v_LCounts = v_LCounts + 1;

                    v_TotalCost = v_Bribe;
                    v_TotalLost = v_LCounts;

                    if (v_LCounts > 1)
                    {
                        v_s = "s";
                    }
                    else if (v_LCounts == 0)
                    {
                        v_s = "s";
                    }
                    else
                    {
                        v_s = "";
                    }

                    from.SendMessage("If you accept the bribe, you will lose " + v_LCounts + " count" + v_s + " (short term) and " + v_Bribe + " gp!");
                    from.SendGump(new GuardBribeShort(from, from.ShortTermMurders, v_TotalCost, v_TotalLost));
                }
                else if (v_Counts == 0)
                {
                    from.SendMessage("Why would you bribe the guards? You have 0 counts!");
                }
                else if (v_BankedGoldAmount < 30000)
                {
                    from.SendMessage("You do not have enough gold in your bank to increase your bribe!");
                    from.SendGump(new GuardBribeShort(from, from.ShortTermMurders, v_TotalCost, v_TotalLost));
                }
                else if (v_LCounts >= from.ShortTermMurders)
                {
                    v_LCounts = from.ShortTermMurders;

                    from.SendMessage("You cannot bribe off more counts than you have!");
                    from.SendGump(new GuardBribeShort(from, from.ShortTermMurders, 0, 0));
                }
                else
                {
                    from.SendMessage("ERROR Insufficient gold?");
                }
            }
            break;

            case 0:
            {
                if (v_Bribe >= 30000)
                {
                    from.SendMessage("You have decreased your bribe by 30,000gp!");

                    v_Bribe   = v_Bribe - 30000;
                    v_LCounts = v_LCounts - 1;

                    v_TotalCost = v_Bribe;
                    v_TotalLost = v_LCounts;

                    if (v_LCounts > 1)
                    {
                        v_s = "s";
                    }
                    else if (v_LCounts == 0)
                    {
                        v_s = "s";
                    }
                    else
                    {
                        v_s = "";
                    }

                    from.SendMessage("If you accept the bribe, you will lose " + v_LCounts + " count" + v_s + " and " + v_Bribe + " gp!");
                    from.SendGump(new GuardBribeShort(from, from.ShortTermMurders, v_TotalCost, v_TotalLost));
                }
                else
                {
                    from.SendMessage("You cannot decrease your bribe any further!");
                    from.SendGump(new GuardBribeShort(from, from.ShortTermMurders, v_TotalCost, v_TotalLost));

                    v_Bribe   = 0;
                    v_LCounts = 0;
                }
            }
            break;

            case 2:
            {
                if (v_LCounts > 0)
                {
                    if (v_LCounts > 1)
                    {
                        v_s = "s";
                    }
                    else if (v_LCounts == 0)
                    {
                        v_s = "s";
                    }
                    else
                    {
                        v_s = "";
                    }

                    // Banker.Withdraw ( from, v_Bribe ); //Why doesn't this work?

                    BankBox box = from.BankBox;

                    if (box == null || !box.ConsumeTotal(typeof(Gold), v_Bribe))
                    {
                        from.SendMessage("ERROR Insufficient gold?");
                    }
                    else
                    {
                        from.ShortTermMurders = v_Counts - v_LCounts;
                        from.SendMessage("You have bribed the guards and lost " + v_LCounts + " kill" + v_s + " (short term) and " + v_Bribe + " gp!");
                    }
                }
                else
                {
                    from.SendMessage("You have not offered a bribe!");
                }
            }
            break;

            case 3:
            {
                from.SendMessage("You decide not to offer a bribe!");
            }
            break;
            }
        }
コード例 #11
0
ファイル: ReportMenu.cs プロジェクト: phpjunkie420/RunUO
        public override void OnResponse(NetState state, int index)
        {
            Mobile            from = state.Mobile;
            BulletinBoardPost post = null;

            if (index == 0)
            {
                foreach (Mobile killer in m_Killers)
                {
                    //add kills
                    killer.Kills++;
                    killer.ShortTermMurders++;

                    if (killer != null && !killer.Deleted)
                    {
                        if (killer is PlayerMobile)
                        {
                            ((PlayerMobile)killer).ResetKillTime();

                            //do they have an existing post?
                            post = ReportMurdererGump.FindPost(((PlayerMobile)killer));

                            //have they killed too many?
                            if (killer.Kills > 10)
                            {
                                BankBox killerbank    = killer.BankBox;
                                int     killerbalance = 0;
                                Item[]  killergold;
                                ((PlayerMobile)killer).BountyMark = true;

                                //make them dread lord
                                killer.Karma = -127;

                                if (killerbank != null)
                                {
                                    killergold = killerbank.FindItemsByType(typeof(Gold));

                                    for (int i = 0; i < killergold.Length; ++i)
                                    {
                                        killerbalance += killergold[i].Amount;
                                    }

                                    killerbank.ConsumeTotal(typeof(Gold), killerbalance);
                                    ((PlayerMobile)killer).Bounty += killerbalance;

                                    killer.SendAsciiMessage("A bounty hath been issued for thee, and thy worldly goods are hereby confiscated!");

                                    //remove all items in the bank
                                    List <Item> list = new List <Item>();
                                    foreach (Item item in killerbank.Items)
                                    {
                                        list.Add(item);
                                    }

                                    foreach (Item i in list)
                                    {
                                        i.Delete();
                                    }
                                }

                                //make new bounty post
                                if (post != null)
                                {
                                    ReportMurdererGump.FindEditPost(((PlayerMobile)killer), post);
                                }
                                else
                                {
                                    ReportMurdererGump.MakePost(((PlayerMobile)killer));
                                }
                            }
                        }
                    }
                }
            }
        }