public StarterPack() : base() { Name = "Starter Pack"; Hue = 196; Item item = new MiniatureHorse(); DropItem(item); item.X = 30; item.Y = 76; item = new BagOfReagents(50); DropItem(item); item.X = 71; item.Y = 55; Container bag = new Bag(); bag.DropItem(new LeatherCap()); bag.DropItem(new LeatherChest()); bag.DropItem(new LeatherLegs()); bag.DropItem(new LeatherGloves()); bag.DropItem(new LeatherArms()); bag.DropItem(new LeatherGorget()); DropItem(bag); bag.X = 63; bag.Y = 75; /* if ( TestCenter.Enabled ) * { * // item = new SmallBrickHouseDeed(); * // DropItem( item ); * // item.X = 23; * // item.Y = 53; * * item = new Spellbook( ulong.MaxValue ); * item.LootType = LootType.Blessed; * DropItem( item ); * item.X = 72; * item.Y = 92; * * item = new Runebook(); * DropItem( item ); * item.X = 93; * item.Y = 92; * * item = new EtherealLlama(); * item.Name = "a beta testers ethereal llama"; * DropItem( item ); * item.X = 94; * item.Y = 34; * } * else * { */ item = new BankCheck(1000); DropItem(item); item.X = 52; item.Y = 36; //} }
public override void GiveRewards() { //Random gold amount to add BankCheck gold = new BankCheck(Utility.RandomMinMax(5000, 6000)); if (!Owner.AddToBackpack(gold)) { gold.MoveToWorld(Owner.Location, Owner.Map); } //Adding Quest Reward Token(s) for (int x = 0; x < 1; x++) { RandomTalisman talisman = new RandomTalisman(); if (!Owner.AddToBackpack(talisman)) { talisman.MoveToWorld(Owner.Location, Owner.Map); } } Item bonusitem; bonusitem = new RamaRobe(); //Adding Bonus Item #1 if (!Owner.AddToBackpack(bonusitem)) { bonusitem.MoveToWorld(Owner.Location, Owner.Map); } base.GiveRewards(); }
private static void CountGold() { int totalgold = 0; int numberofchecks = 0; int pilesofsixtyk = 0; foreach (Item item in World.Items.Values) { if (item is CheckBook) { CheckBook cb = (CheckBook)item; totalgold += cb.Token; } if (item is BankCheck) { BankCheck bc = (BankCheck)item; totalgold += bc.Worth; } else if (item is Gold) { Gold g = (Gold)item; totalgold += g.Amount; } } World.Broadcast(0x35, true, "Total Gold in world is : {0}", totalgold); numberofchecks = totalgold / 1000000; World.Broadcast(0x35, true, "This is enough for {0} one million gold bank checks", numberofchecks); totalgold = totalgold - 1000000 * numberofchecks; pilesofsixtyk = totalgold / 60000; World.Broadcast(0x35, true, "This is enough for {0} piles of 60K", pilesofsixtyk); totalgold = totalgold - 60000 * pilesofsixtyk; World.Broadcast(0x35, true, "And this leaves {0} spare change :)", totalgold); }
public void EndGame(CockFightingControlStone controller) { if (ChickenList.Count > 0) { for (int i = 0; i < ChickenList.Count; i++) { if (controller != null && !controller.Deleted) { FightingChicken fc = (FightingChicken)ChickenList[i]; if (fc.Owner != null && !(fc.Owner.Deleted)) { controller.LastWinner = fc.Owner; Account acct = (Account)fc.Owner.Account; bool CockFightBetted = Convert.ToBoolean(acct.GetTag("CockFightBetted")); if (controller.Bet > 0) { BankCheck bc = new BankCheck(controller.MaxPlayers * controller.Bet); fc.Owner.AddToBackpack(bc); fc.Owner.SendMessage("You won the c**k fight!"); acct.SetTag("CockFightBetted", "false"); } fc.Delete(); } } } } controller.ChickenList.Clear(); controller.DeadChickens = 0; controller.NumberOfPlayers = 0; controller.GameRunning = false; controller.LastChicken = null; }
public override void GiveRewards() { //Random gold amount to add BankCheck gold = new BankCheck( Utility.RandomMinMax( 100, 150 ) ); if( !Owner.AddToBackpack( gold ) ) { gold.MoveToWorld(Owner.Location,Owner.Map); } base.GiveRewards(); }
public static bool Deposit(Mobile from, int amount) { // If for whatever reason the TOL checks fail, we should still try old methods for depositing currency. if (AccountGold.Enabled && from.Account != null && from.Account.DepositGold(amount)) { return true; } var box = from.FindBankNoCreate(); if (box == null) { return false; } var items = new List<Item>(); while (amount > 0) { Item item; if (amount < 5000) { item = new Gold(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 (var curItem in items) { curItem.Delete(); } return false; } } return true; }
public override void GiveRewards() { //Give Gold to player in form of a bank check BankCheck gold = new BankCheck(Utility.RandomMinMax(500, 1000)); if(!Owner.AddToBackpack( gold )) gold.MoveToWorld(Owner.Location,Owner.Map); Item item; //Random Magic Item #1 item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(); if( item is BaseWeapon ) BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, 3, 10, 50 ); if( item is BaseArmor ) BaseRunicTool.ApplyAttributesTo((BaseArmor)item, 3, 10, 50 ); if( item is BaseJewel ) BaseRunicTool.ApplyAttributesTo((BaseJewel)item, 3, 10, 50 ); if( item is BaseHat ) BaseRunicTool.ApplyAttributesTo((BaseHat)item, 3, 10, 50 ); if(!Owner.AddToBackpack( item ) ) { item.MoveToWorld(Owner.Location,Owner.Map); } //Random Magic Item #2 item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(); if( item is BaseWeapon ) BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, 3, 10, 50 ); if( item is BaseArmor ) BaseRunicTool.ApplyAttributesTo((BaseArmor)item, 3, 10, 50 ); if( item is BaseJewel ) BaseRunicTool.ApplyAttributesTo((BaseJewel)item, 3, 10, 50 ); if( item is BaseHat ) BaseRunicTool.ApplyAttributesTo((BaseHat)item, 3, 10, 50 ); if(!Owner.AddToBackpack( item ) ) { item.MoveToWorld(Owner.Location,Owner.Map); } //Chance of Special Item if ( Utility.RandomMinMax( 1, 1 ) == 1 ) { item = new RalphiesWelcomeNecklace( ); if(!Owner.AddToBackpack( item ) ) { item.MoveToWorld(Owner.Location,Owner.Map); } } base.GiveRewards(); }
public override void OnDoubleClick(Mobile from) { BankBox box = from.BankBox; if (box != null && IsChildOf(box)) { PlayerMobile pm = from as PlayerMobile; base.OnDoubleClick(from); BankCheck check; if (this.Amount == 1) { check = new BankCheck(1000000); this.Delete(); if (box.TryDropItem(pm, check, false)) { pm.SendMessage("You return your gold bar to the bank and receive a 1,000,000 check."); } else { check.Delete(); pm.AddToBackpack(new BankCheck(1000000)); pm.SendMessage("You return your gold bar to the bank and receive a 1,000,000 check."); } } else if (this.Amount >= 2) { check = new BankCheck(1000000); if (box.TryDropItem(pm, check, false)) { this.Amount -= 1; pm.SendMessage("You return your gold bar to the bank and receive a 1,000,000 check."); } else { check.Delete(); pm.SendMessage("There is not enough room in your bank box for the check."); } } } else { from.SendLocalizedMessage(1047026); // That must be in your bank box to use it. } }
/*public override Item Dupe( int amount ) { return base.Dupe( new GoldBar( amount ), amount ); }here for ruo rc1 and maybe rc2*/ public override void OnDoubleClick( Mobile from ) { BankBox box = from.BankBox; if ( box != null && IsChildOf( box ) ) { PlayerMobile pm = from as PlayerMobile; base.OnDoubleClick( from ); BankCheck check; if( this.Amount == 1 ) { check = new BankCheck( 500000 ); this.Delete(); if ( box.TryDropItem( pm, check, false ) ) { pm.SendMessage("You return your gold bar to the bank and receive a 500,000 gp check."); } else { check.Delete(); pm.AddToBackpack( new BankCheck( 500000 ) ); pm.SendMessage("You return your gold bar to the bank and receive a 500,000 gp check."); } } else if( this.Amount >= 2 ) { check = new BankCheck( 500000 ); if ( box.TryDropItem( pm, check, false ) ) { this.Amount -= 1; pm.SendMessage("You return your gold bar to the bank and receive a 500,000 gp check."); } else { check.Delete(); pm.SendMessage("There is not enough room in your bank box for the check."); } } } else { from.SendLocalizedMessage( 1047026 ); // That must be in your bank box to use it. } }
/// <summary> /// award coins to the player /// </summary> /// <param name="m">player to give coins too</param> /// <param name="tourneywinner">is this the tourney winner</param> public void GiveGold(Mobile m, bool tourneywinner) { //set up coin amount based on round and if they are the tourney winner int total = tourneywinner ? m_CoinsPerRound * m_CurrentRound + m_CoinsWinner : m_CoinsPerRound * m_CurrentRound; //create a floating set of coins BankCheck check = new BankCheck(total); //if the players pack is full, delete the floating coins if (!m.AddToBackpack(check)) { check.Delete(); } }
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 Gold(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); }
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 Gold( 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; }
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 Gold(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); }
public static bool Deposit( Mobile from, int amount ) { BankBox box = from.BankBox; if ( box == null ) return false; ArrayList items = new ArrayList(); while ( amount > 0 ) { Item item; if ( amount < 5000 ) { item = new Copper( 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; }
public void EndCombine(Mobile from, object o) { if (o is Item && ((Item)o).IsChildOf(from.Backpack)) { if (!(o is Gold) && !(o is BankCheck)) { from.SendMessage("That is not an item you can put in here."); } if (o is Gold) { if (Token >= 200000000) { from.SendMessage("This check book is too full."); } else { Item curItem = o as Item; Token += curItem.Amount; curItem.Delete(); from.SendGump(new CheckBookGump((PlayerMobile)from, this)); BeginCombine(from); } } if (o is BankCheck) { if (Token >= 200000000) { from.SendMessage("This check book is too full."); } else { BankCheck bankcheck = o as BankCheck; Token += bankcheck.Worth; bankcheck.Delete(); from.SendGump(new CheckBookGump((PlayerMobile)from, this)); BeginCombine(from); } } } else { from.SendLocalizedMessage(1045158); // You must have the item in your backpack to target it. } }
public override void GiveRewards() { //Random gold amount to add BankCheck gold = new BankCheck( Utility.RandomMinMax( 200, 300 ) ); if( !Owner.AddToBackpack( gold ) ) { gold.MoveToWorld(Owner.Location,Owner.Map); } //Adding Quest Reward Token(s) for(int x = 0; x < 1; x++) { RandomTalisman talisman = new RandomTalisman(); if(!Owner.AddToBackpack( talisman ) ) { talisman.MoveToWorld(Owner.Location,Owner.Map); } } Item bonusitem; bonusitem = new Bandage( 10 ); //Adding Bonus Item #1 if(!Owner.AddToBackpack( bonusitem ) ) { bonusitem.MoveToWorld(Owner.Location,Owner.Map); } Item item; //Add Reward Item #1 item = new AdventurersMachete(); if( item is BaseWeapon ) BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, Utility.RandomMinMax( 1,4 ), 10, 50 ); if( item is BaseArmor ) BaseRunicTool.ApplyAttributesTo((BaseArmor)item, Utility.RandomMinMax( 1,4 ), 10, 50 ); if( item is BaseJewel ) BaseRunicTool.ApplyAttributesTo((BaseJewel)item, Utility.RandomMinMax( 1,4 ), 10, 50 ); if( item is BaseHat ) BaseRunicTool.ApplyAttributesTo((BaseHat)item, Utility.RandomMinMax( 1,4 ), 10, 50 ); if(!Owner.AddToBackpack( item ) ) { item.MoveToWorld(Owner.Location,Owner.Map); } base.GiveRewards(); }
public static bool Withdraw(Mobile from, int amount) { Item[] gold, checks; int balance = GetBalance(from, out gold, out checks); if (balance < amount) { return(false); } for (int i = 0; amount > 0 && i < gold.Length; ++i) { if (gold[i].Amount <= amount) { amount -= gold[i].Amount; gold[i].Delete(); } else { gold[i].Amount -= amount; amount = 0; } } for (int i = 0; amount > 0 && i < checks.Length; ++i) { BankCheck check = (BankCheck)checks[i]; if (check.Worth <= amount) { amount -= check.Worth; check.Delete(); } else { check.Worth -= amount; amount = 0; } } return(true); }
public static int GetBalance(Mobile from, Type currencyType, out Item[] currency, out BankCheck[] checks) { int balance = 0; BankBox bank = from.FindBankNoCreate(); if (bank != null) { currency = bank.FindItemsByType(currencyType, true).ToArray(); checks = bank.FindItemsByType<BankCheck>(true).Where(c => c.TypeOfCurrency == currencyType).ToArray(); balance += currency.Sum(t => t.Amount); balance += checks.Sum(t => t.Worth); } else { currency = new Item[0]; checks = new BankCheck[0]; } return balance; }
public override void GiveRewards() { //Random gold amount to add BankCheck gold = new BankCheck( Utility.RandomMinMax( 2000, 3000 ) ); if( !Owner.AddToBackpack( gold ) ) { gold.MoveToWorld(Owner.Location,Owner.Map); } //Add Quest Reward Token(s) //Owner.AddToBackpack( new QuestRewardToken( 1 ) ); //Adding Quest Reward Token(s) for(int x = 0; x < 1; x++) { RandomTalisman talisman = new RandomTalisman(); if(!Owner.AddToBackpack( talisman ) ) { talisman.MoveToWorld(Owner.Location,Owner.Map); } } base.GiveRewards(); }
public override void OnSpeech( SpeechEventArgs e ) { if ( !e.Handled && e.Mobile.InRange( this.Location, 4 ) && CanUseTheBank( e.Mobile ) ) { 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; 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( Copper ), amount ) ) { this.Say( "Ah, art thou trying to fool me? Thou hast not so much copper!" ); } else { e.Mobile.AddToBackpack( new Copper( amount ) ); this.Say( "Thou hast withdrawn copper from thy account." ); } } } break; } case 0x0001: // *balance* { e.Handled = true; BankBox box = e.Mobile.BankBox; if ( box != null ) { this.Say( "Thy current bank balance is " + box.TotalGold.ToString() + " copper." ); } break; } case 0x0002: // *bank* { e.Handled = true; BankBox box = e.Mobile.BankBox; PlayerMobile pm = e.Mobile as PlayerMobile; if ( box != null ) box.Open(); break; } case 0x0003: // *check* { e.Handled = true; string[] split = e.Speech.Split( ' ' ); if ( split.Length >= 2 ) { int amount; try { amount = Convert.ToInt32( split[1] ); } catch { break; } if ( amount < 5000 ) { this.Say( "We cannot create checks for such a paltry amount of copper!" ); // } 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( Copper ), amount ) ) { this.Say( "Ah, art thou trying to fool me? Thou hast not so much copper!" ); // 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 ); }
public void RefundBuyIn(PlayerMobile pm, int amount) { BankBox box = (BankBox)pm.BankBox; if (amount >= 5000) { BankCheck check = new BankCheck(amount); box.DropItem(check); } else { Gold gold = new Gold(amount); box.DropItem(gold); } Handeling.BuyIn = 0; pm.SendMessage("The buy in has been refunded."); }
public static int DepositUpTo( Mobile from, int amount ) { BankBox box = from.BankBox; if ( box == null ) return 0; int amountLeft = amount; while ( amountLeft > 0 ) { Item item; int amountGiven; if ( amountLeft < 5000 ) { item = new Copper( 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; }
public void RemovePlayer(PokerPlayer player) { Mobile from = player.Mobile; if (from is PlayerMobile) { var playermob = from as PlayerMobile; playermob.PokerJoinTimer = DateTime.UtcNow + TimeSpan.FromMinutes(1); playermob.Blessed = false; } if (from == null || !Players.Contains(player)) { return; } Players.Players.Remove(player); if (Players.Peek() == player) //It is currently their turn, fold them. { player.CloseGump(typeof(PokerBetGump)); Timer.m_LastPlayer = null; player.Action = PlayerAction.Fold; } if (Players.Round.Contains(player)) { Players.Round.Remove(player); } if (Players.Turn.Contains(player)) { Players.Turn.Remove(player); } if (Players.Round.Count == 0) { if (PokerPlayers != null && PokerPlayers.Exists(x => x.Serial == player.Mobile.Serial)) { PokerPlayers.Find(x => x.Serial == player.Mobile.Serial).Credit += CommunityCurrency; } player.Currency += CommunityCurrency; CommunityCurrency = 0; if (GameBackup.PokerGames.Contains(this)) { GameBackup.PokerGames.Remove(this); } } if (player.Currency > 0) { if (from.BankBox == null) //Should NEVER happen, but JUST IN CASE! { Utility.PushColor(ConsoleColor.Red); Console.WriteLine( "WARNING: Player \"{0}\" with account \"{1}\" had null bank box while trying to deposit {2:#,0} {3}. Player will NOT recieve their gold.", from.Name, from.Account == null ? "(-null-)" : from.Account.Username, player.Currency, (Dealer.IsDonation ? "donation coins" : "gold")); Utility.PopColor(); try { using (var op = new StreamWriter("poker_error.log", true)) { op.WriteLine( "WARNING: Player \"{0}\" with account \"{1}\" had null bankbox while poker script was trying to deposit {2:#,0} {3}. Player will NOT recieve their gold.", from.Name, from.Account == null ? "(-null-)" : from.Account.Username, player.Currency, (Dealer.IsDonation ? "donation coins" : "gold")); } } catch {} from.SendMessage( 0x22, "WARNING: Could not find your bank box. All of your poker money has been lost in this error. Please contact a Game Master to resolve this issue."); } else { if (Banker.Deposit(from, TypeOfCurrency, player.Currency)) { from.SendMessage(0x22, "{0:#,0} {1} has been deposited into your bank box.", player.Currency, (Dealer.IsDonation ? "donation coins" : "gold")); } else { BankCheck check; if (Dealer.IsDonation) check = new BankCheck(player.Currency, true); else { check = new BankCheck(player.Currency); } from.Backpack.DropItem(check); from.SendMessage(0x22, "{0:#,0} {1} has been placed in your bag.", player.Currency, (Dealer.IsDonation ? "donation coins" : "gold")); } } } player.CloseAllGumps(); ((PlayerMobile) from).PokerGame = null; from.Location = Dealer.ExitLocation; from.Map = Dealer.ExitMap; from.SendMessage(0x22, "You have left the table"); NeedsGumpUpdate = true; }
public void AwardTeamWinnings(int team, int amount) { if(team == 0) return; int count = 0; // go through all of the team members foreach(IChallengeEntry entry in Participants) { if(entry.Team == team) { count++; } } if(count == 0) return; int split = amount/count; // and split the purse foreach(IChallengeEntry entry in Participants) { if(entry.Team == team) { Mobile m = entry.Participant; if(m.Backpack != null && amount > 0) { // give them a check for the winnings BankCheck check = new BankCheck( split); check.Name = String.Format(XmlPoints.GetText(m, 100300),ChallengeName); // "Prize from {0}" m.AddToBackpack( check ); XmlPoints.SendText(m, 100301, split); // "You have received a bank check for {0}" } } } }
public override void OnResponse( NetState state, RelayInfo info ) { if ( info.ButtonID == 1 && !m_House.Deleted ) { if ( m_House.IsOwner( m_Mobile ) ) { if ( m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0 ) { return; } else if( !Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null ) { m_Mobile.SendLocalizedMessage( 501389 ); // You cannot redeed a house with a guildstone inside. return; } /*else if ( m_House.PlayerVendors.Count > 0 ) { m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving. return; }*/ else if ( m_House.HasRentedVendors && m_House.VendorInventories.Count > 0 ) { m_Mobile.SendLocalizedMessage( 1062679 ); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house. return; } else if ( m_House.HasRentedVendors ) { m_Mobile.SendLocalizedMessage( 1062680 ); // You cannot do that that while you still have contract vendors in your house. return; } else if ( m_House.VendorInventories.Count > 0 ) { m_Mobile.SendLocalizedMessage( 1062681 ); // You cannot do that that while you still have unclaimed contract vendor inventory in your house. return; } if ( m_Mobile.AccessLevel >= AccessLevel.GameMaster ) { m_Mobile.SendMessage( "You do not get a refund for your house as you are not a player" ); m_House.RemoveKeys(m_Mobile); m_House.Delete(); } else { Item toGive = null; if ( m_House.IsAosRules ) { if (m_House.Price > 0) { toGive = new BankCheck(m_House.Price); if (m_House.IsFromDeed) toGive = new BankCheck((int)(m_House.Price / 2)); } else toGive = m_House.GetDeed(); } else { toGive = m_House.GetDeed(); if (toGive == null && m_House.Price > 0) { toGive = new BankCheck(m_House.Price); if (m_House.IsFromDeed) toGive = new BankCheck((int)(m_House.Price / 2)); } } if ( toGive != null ) { BankBox box = m_Mobile.BankBox; if ( box.TryDropItem( m_Mobile, toGive, false ) ) { if ( toGive is BankCheck ) m_Mobile.SendLocalizedMessage( 1060397, ( (BankCheck)toGive ).Worth.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box. m_House.RemoveKeys( m_Mobile ); m_House.Delete(); } else { toGive.Delete(); m_Mobile.SendLocalizedMessage( 500390 ); // Your bank box is full. } } else { m_Mobile.SendMessage( "Unable to refund house." ); } } } else { m_Mobile.SendLocalizedMessage( 501320 ); // Only the house owner may do this. } } }
public DarkRedDonationBox() { Weight = 1.0; Hue = 1645; Item item = null; Name = "Defiance Dark Red Member Box"; PlaceItemIn(16, 60, (item = new SkillBall(25))); item.Hue = 5; PlaceItemIn(28, 60, (item = new SkillBall(25))); item.Hue = 5; PlaceItemIn(41, 58, (item = new SevenGMSkillBall())); item.Hue = 1161; PlaceItemIn(53, 58, (item = new StatsBall())); item.Hue = 1161; PlaceItemIn(16, 81, (item = new HoodedShroudOfShadows())); item.Hue = 1645; item.Name = "Dark Red Shroud of Shadows"; item.LootType = LootType.Blessed; BaseContainer cont; PlaceItemIn(58, 57, (cont = new Backpack())); cont.Hue = 1645; cont.Name = "a dark red backpack"; cont.PlaceItemIn(44, 65, new SulfurousAsh(10000)); cont.PlaceItemIn(77, 65, new Nightshade(10000)); cont.PlaceItemIn(110, 65, new SpidersSilk(10000)); cont.PlaceItemIn(143, 65, new Garlic(10000)); cont.PlaceItemIn(44, 128, new Ginseng(10000)); cont.PlaceItemIn(77, 128, new Bloodmoss(10000)); cont.PlaceItemIn(110, 128, new BlackPearl(10000)); cont.PlaceItemIn(143, 128, new MandrakeRoot(10000)); PlaceItemIn(90, 58, (item = new AncientCoat())); item.Hue = 1645; item.Name = "Dark Red Ancient Coat"; item.LootType = LootType.Blessed; PlaceItemIn(74, 64, (item = new WizardGlasses())); item.Hue = Utility.RandomList(1645); PlaceItemIn(103, 58, (item = new Sandals())); item.Hue = Utility.RandomList(1645); item.Name = "Polar Sandals"; item.LootType = LootType.Blessed; PlaceItemIn(122, 53, new SpecialDonateHairDye()); PlaceItemIn(133, 53, new SpecialDonateBeardDye()); PlaceItemIn(156, 55, (item = new EtherealLongManeHorse())); item.Hue = 1645; PlaceItemIn(34, 83, (item = new HolyDeedofBlessing())); item.Hue = 1645; PlaceItemIn(43, 83, (item = new CursedClothingBlessDeed())); item.Hue = 1645; PlaceItemIn(58, 83, (item = new SpecialHairRestylingDeed())); item.Hue = 1645; PlaceItemIn(73, 83, (item = new SmallBrickHouseDeed())); item.Hue = 1645; PlaceItemIn(88, 83, (item = new NameChangeDeed())); item.Hue = 1645; PlaceItemIn(103, 83, (item = new AntiBlessDeed())); item.Hue = 1645; PlaceItemIn(118, 83, (item = new BankCheck(100000))); item.Hue = 1645; PlaceItemIn(130, 83, (item = new MembershipTicket())); item.Hue = 1645; ((MembershipTicket)item).MemberShipTime = TimeSpan.FromDays(730); }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (!Ledger.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. return; } switch (info.ButtonID) { case 0: //Close { int[] switches = info.Switches; for (int i = 0; i < switches.Length; i++) { if (switches[i] == 2) { Ledger.i_Selection = 0; } if (switches[i] == 3) { Ledger.i_Selection = 1; } } Ledger.b_open = false; from.SendMessage(2125, "You close your gold ledger."); break; } case 1: //Withdraw Currency { string WithdrawString = info.GetTextEntry(4).Text.Replace(",", ""); if (WithdrawString != null) { int WithdrawAmount = 0; try { WithdrawAmount = Convert.ToInt32(WithdrawString, 10); } catch { from.SendGump(new GoldLedgerGump(Ledger)); from.SendMessage(2125, "You can't withdraw letters, silly! Only numbers!"); } int[] switches = info.Switches; for (int i = 0; i < switches.Length; i++) { if (switches[i] == 2) { Ledger.i_Selection = 0; } if (switches[i] == 3) { Ledger.i_Selection = 1; } } if (WithdrawAmount < 0) { from.SendGump(new GoldLedgerGump(Ledger)); from.SendMessage(2125, "You can't withdraw negative gold, silly!"); return; } if (WithdrawAmount == 0) { from.SendGump(new GoldLedgerGump(Ledger)); return; } if (WithdrawAmount > Ledger.Gold) { WithdrawAmount = Ledger.Gold; } if (Ledger.i_Selection == 0) { double maxWeight = (WeightOverloading.GetMaxWeight(from)); double newledgerweight = ((Ledger.Gold - WithdrawAmount) * Ledger.d_WeightScale); double curWeight = ((Mobile.BodyWeight + from.TotalWeight) - (Ledger.Weight - newledgerweight)); double maxGold = ((maxWeight - (Mobile.BodyWeight + from.TotalWeight)) / (((GoldLedger.GoldWeight > Ledger.d_WeightScale) ? GoldLedger.GoldWeight : Ledger.d_WeightScale) - ((GoldLedger.GoldWeight > Ledger.d_WeightScale) ? Ledger.d_WeightScale : GoldLedger.GoldWeight))); if ((int)maxGold < 1) { from.SendGump(new GoldLedgerGump(Ledger)); from.SendMessage(2125, "You can't carry that many stones."); } else { if (WithdrawAmount > (int)maxGold) { WithdrawAmount = (int)maxGold; from.SendMessage(2125, "You can only withdraw {0} stones' worth of gold.", (int)Math.Ceiling((int)maxGold * GoldLedger.GoldWeight)); } Ledger.Gold -= WithdrawAmount; from.SendGump(new GoldLedgerGump(Ledger)); Ledger.AppendWeight(); int toAdd = WithdrawAmount; Gold gold; int sixtyk = 60000; while (toAdd > sixtyk) { gold = new Gold(sixtyk); toAdd -= sixtyk; from.Backpack.AddItem(gold); from.SendMessage(2125, "You withdraw {0} gold from your gold ledger.", sixtyk.ToString("#,0")); } if (toAdd > 0) { gold = new Gold(toAdd); from.Backpack.AddItem(gold); from.SendMessage(2125, "You withdraw {0} gold from your gold ledger.", toAdd.ToString("#,0")); } from.PlaySound(0x2E6); } } else if (Ledger.i_Selection == 1) { BankCheck check = new BankCheck(WithdrawAmount); Ledger.Gold -= WithdrawAmount; Ledger.AppendWeight(); from.Backpack.AddItem(check); from.SendGump(new GoldLedgerGump(Ledger)); from.PlaySound(0x42); from.SendMessage(2125, "You withdraw a bank check worth {0} gold from your gold ledger.", WithdrawAmount.ToString("#,0")); } } break; } case 5: //Deposit Currency { int[] switches = info.Switches; for (int i = 0; i < switches.Length; i++) { if (switches[i] == 2) { Ledger.i_Selection = 0; } if (switches[i] == 3) { Ledger.i_Selection = 1; } } from.SendGump(new GoldLedgerGump(Ledger)); Ledger.BeginAddGold(from); break; } case 6: //Gold Sweeper { int[] switches = info.Switches; for (int i = 0; i < switches.Length; i++) { if (switches[i] == 2) { Ledger.i_Selection = 0; } if (switches[i] == 3) { Ledger.i_Selection = 1; } } if (Ledger.GoldSweeper) { Ledger.GoldSweeper = false; from.SendGump(new GoldLedgerGump(Ledger)); from.SendMessage(2125, "Gold Sweeper: Disabled"); } else { Ledger.GoldSweeper = true; from.SendGump(new GoldLedgerGump(Ledger)); from.SendMessage(2125, "Gold Sweeper: Enabled"); } break; } case 7: //Auto-Loot { int[] switches = info.Switches; for (int i = 0; i < switches.Length; i++) { if (switches[i] == 2) { Ledger.i_Selection = 0; } if (switches[i] == 3) { Ledger.i_Selection = 1; } } if (Ledger.GoldAutoLoot) { Ledger.GoldAutoLoot = false; from.SendGump(new GoldLedgerGump(Ledger)); from.SendMessage(2125, "Gold Looting: Manual"); } else { Ledger.GoldAutoLoot = true; from.SendGump(new GoldLedgerGump(Ledger)); from.SendMessage(2125, "Gold Looting: Automatic"); } break; } case 8: //Help { from.SendGump(new GoldLedgerGump(Ledger)); from.CloseGump(typeof(GoldLedgerHelp)); from.SendGump(new GoldLedgerHelp()); break; } } }
public static int DepositUpTo(Mobile from, int amount) { // If for whatever reason the TOL checks fail, we should still try old methods for depositing currency. if (AccountGold.Enabled && from.Account != null && from.Account.DepositGold(amount)) { return amount; } var box = from.FindBankNoCreate(); if (box == null) { return 0; } var amountLeft = amount; while (amountLeft > 0) { Item item; int amountGiven; if (amountLeft < 5000) { item = new Gold(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; }
public StarterPack() : base() { Name = "Welcome bag"; Hue = 196; Item item = new BankCheck(100); DropItem( item ); item.X = 53; item.Y = 36; item = new BagOfReagents( 50 ); DropItem( item ); item.X = 71; item.Y = 55; Container bag = new Bag(); bag.DropItem( new LeatherCap() ); bag.DropItem( new LeatherChest() ); bag.DropItem( new LeatherLegs() ); bag.DropItem( new LeatherGloves() ); bag.DropItem( new LeatherArms() ); bag.DropItem( new LeatherGorget() ); DropItem( bag ); bag.X = 63; bag.Y = 75; /* item = new HalfApron (); item.LootType = LootType.Blessed; item.Name = "Launch Day 2013"; DropItem( item ); item.X = 72; item.Y = 92; item = new FireworksWand(); item.Name = "Launch Day 2013"; DropItem( item ); item.X = 94; item.Y = 34;*/ /* if ( TestCenter.Enabled ) { // item = new SmallBrickHouseDeed(); // DropItem( item ); // item.X = 23; // item.Y = 53; */ /* item = new Runebook(); DropItem( item ); item.X = 93; item.Y = 92; item = new EtherealLlama(); item.Name = "a beta testers ethereal llama"; DropItem( item ); item.X = 94; item.Y = 34; } else { */ // item = new BankCheck( 1000 ); // DropItem( item ); // item.X = 52; // item.Y = 36; //} }
public void EndAddGold(Mobile from, object obj) { from.CloseGump(typeof(GoldLedgerGump)); if (obj is Item) { Item item = obj as Item; double maxWeight = (WeightOverloading.GetMaxWeight(from)); int golda = 0; if (!this.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. return; } if (!item.IsAccessibleTo(from)) { from.SendGump(new GoldLedgerGump(this)); from.SendLocalizedMessage(3000270); // That is not accessible. return; } if (obj is Gold) { Gold gold = obj as Gold; golda = gold.Amount; if ((gold.Amount + this.Gold) > 999999999) { golda = (999999999 - this.Gold); } double maxgold = golda; if (this.d_WeightScale > 0 && gold.RootParent != from) { maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)from.TotalWeight)) / this.d_WeightScale); } if (golda > maxgold) { golda = (int)maxgold; } if (golda < gold.Amount) { gold.Amount -= golda; } else { gold.Delete(); } this.Gold += golda; from.SendGump(new GoldLedgerGump(this)); from.SendMessage(2125, String.Format("You deposit {0} gold into your gold ledger.", golda.ToString("#,0"))); from.PlaySound(0x249); } else if (obj is BankCheck) { BankCheck check = obj as BankCheck; golda = check.Worth; if ((check.Worth + this.Gold) > 999999999) { golda = (999999999 - this.Gold); } double maxgold = golda; if (this.d_WeightScale > 0) { maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)from.TotalWeight)) / this.d_WeightScale); } if (golda > maxgold) { golda = (int)maxgold; } if (golda < check.Worth) { check.Worth -= golda; } else { check.Delete(); } this.Gold += golda; from.SendGump(new GoldLedgerGump(this)); from.SendMessage(2125, String.Format("You deposit a bank check worth {0} gold into your gold ledger.", golda.ToString("#,0"))); from.PlaySound(0x249); } else if (obj is GoldLedger && obj != this) { GoldLedger gledger = obj as GoldLedger; golda = gledger.Gold; if ((gledger.Gold + this.Gold) > 999999999) { golda = (999999999 - this.Gold); } double maxgold = golda; if (this.d_WeightScale > 0) { maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)from.TotalWeight)) / this.d_WeightScale); } if (golda > maxgold) { golda = (int)maxgold; } gledger.Gold -= golda; this.Gold += golda; from.SendGump(new GoldLedgerGump(this)); from.SendMessage(2125, String.Format("You transfer {0} gold into your gold ledger.", golda.ToString("#,0"))); from.PlaySound(0x249); } else { from.SendGump(new GoldLedgerGump(this)); from.SendMessage(2125, "You can only deposit gold or bank checks into your gold ledger."); } } else { from.SendGump(new GoldLedgerGump(this)); from.SendMessage(2125, "You can only deposit gold or bank checks into your gold ledger."); } from.SendMessage(2125, "Do you want to deposit anything else? (ESC to cancel)"); from.Target = new AddGoldTarget(this); }
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) { e.Mobile.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) { e.Mobile.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)) { e.Mobile.Say(500384); // Ah, art thou trying to fool me? Thou hast not so much gold! } else { e.Mobile.AddToBackpack(new Gold(amount)); e.Mobile.Say(1010005); // Thou hast withdrawn gold from thy account. } } } break; } case 0x0001: // *balance* { e.Handled = true; if (e.Mobile.Criminal) { e.Mobile.Say(500389); // I will not do business with a criminal! break; } BankBox box = e.Mobile.FindBankNoCreate(); if (box != null) { e.Mobile.Say(1042759, box.TotalGold.ToString()); // Thy current bank balance is ~1_AMOUNT~ gold. } else { e.Mobile.Say(1042759, "0"); // Thy current bank balance is ~1_AMOUNT~ gold. } break; } case 0x0002: // *bank* { e.Handled = true; if (e.Mobile.Criminal) { e.Mobile.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) { e.Mobile.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) { e.Mobile.Say(1010006); // We cannot create checks for such a paltry amount of gold! } else if (amount > 1000000) { e.Mobile.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)) { e.Mobile.Say(500386); // There's not enough room in your bankbox for the check! check.Delete(); } else if (!box.ConsumeTotal(typeof(Gold), amount)) { e.Mobile.Say(500384); // Ah, art thou trying to fool me? Thou hast not so much gold! check.Delete(); } else { e.Mobile.Say(1042673, amount.ToString()); // Into your bank box I have placed a check in the amount of: } } } break; } } } } base.OnSpeech(e); }
private void GiveAwards(ArrayList players, TrophyRank rank, int cash) { if (players.Count == 0) return; if (players.Count > 1) cash /= (players.Count - 1); cash += 500; cash /= 1000; cash *= 1000; StringBuilder sb = new StringBuilder(); if (this.m_TournyType == TournyType.FreeForAll) { sb.Append(this.m_Participants.Count * this.m_PlayersPerParticipant); sb.Append("-man FFA"); } else if (this.m_TournyType == TournyType.RandomTeam) { sb.Append(this.m_ParticipantsPerMatch); sb.Append("-team"); } else if (this.m_TournyType == TournyType.RedVsBlue) { sb.Append("Red v Blue"); } else { for (int i = 0; i < this.m_ParticipantsPerMatch; ++i) { if (sb.Length > 0) sb.Append('v'); sb.Append(this.m_PlayersPerParticipant); } } if (this.m_EventController != null) sb.Append(' ').Append(this.m_EventController.Title); sb.Append(" Champion"); string title = sb.ToString(); for (int i = 0; i < players.Count; ++i) { Mobile mob = (Mobile)players[i]; if (mob == null || mob.Deleted) continue; Item item = new Trophy(title, rank); if (!mob.PlaceInBackpack(item)) mob.BankBox.DropItem(item); if (cash > 0) { item = new BankCheck(cash); if (!mob.PlaceInBackpack(item)) mob.BankBox.DropItem(item); mob.SendMessage("You have been awarded a {0} trophy and {1:N0}gp for your participation in this tournament.", rank.ToString().ToLower(), cash); } else { mob.SendMessage("You have been awarded a {0} trophy for your participation in this tournament.", rank.ToString().ToLower()); } } }
public void PayBuyIn(PlayerMobile pm, int teamid) { if (Handeling.BuyIn <= 0) return; int playercount = 0; int sharecount = 0; IEnumerator key = Handeling.Teams.Keys.GetEnumerator(); for (int i = 0; i < Handeling.Teams.Count; ++i) { key.MoveNext(); Field_Team d_team = (Field_Team)Handeling.Teams[(int)key.Current]; for (int i2 = 0; i2 < d_team.Players.Count; ++i2) { object o = (object)d_team.Players[i2]; if (o != "@null") playercount += 1; if ((int)key.Current == teamid && o != "@null") sharecount += 1; } } int goldshare = (playercount * Handeling.BuyIn) / sharecount; BankBox box = (BankBox)pm.BankBox; if (goldshare >= 5000) { BankCheck check = new BankCheck(goldshare); box.DropItem(check); } else { Gold gold = new Gold(goldshare); box.DropItem(gold); } pm.SendMessage(String.Format("Congragulations! you have won {0}gp.", goldshare.ToString())); }
public StarterPack() : base() { Name = "Welcome bag"; Hue = 196; Item item = new BankCheck(100); DropItem(item); item.X = 53; item.Y = 36; item = new BagOfReagents(50); DropItem(item); item.X = 71; item.Y = 55; Container bag = new Bag(); bag.DropItem(new LeatherCap()); bag.DropItem(new LeatherChest()); bag.DropItem(new LeatherLegs()); bag.DropItem(new LeatherGloves()); bag.DropItem(new LeatherArms()); bag.DropItem(new LeatherGorget()); DropItem(bag); bag.X = 63; bag.Y = 75; /* item = new HalfApron (); * item.LootType = LootType.Blessed; * item.Name = "Launch Day 2013"; * DropItem( item ); * item.X = 72; * item.Y = 92; * * item = new FireworksWand(); * item.Name = "Launch Day 2013"; * DropItem( item ); * item.X = 94; * item.Y = 34;*/ /* if ( TestCenter.Enabled ) * { * // item = new SmallBrickHouseDeed(); * // DropItem( item ); * // item.X = 23; * // item.Y = 53; */ /* item = new Runebook(); * DropItem( item ); * item.X = 93; * item.Y = 92; * * item = new EtherealLlama(); * item.Name = "a beta testers ethereal llama"; * DropItem( item ); * item.X = 94; * item.Y = 34; * } * else * { */ // item = new BankCheck( 1000 ); // DropItem( item ); // item.X = 52; // item.Y = 36; //} }
public static void HandleSpeech(Mobile vendor, SpeechEventArgs e) { if (!e.Handled && e.Mobile.InRange(vendor, 12)) { foreach (var 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; } var split = e.Speech.Split(' '); if (split.Length >= 2) { int amount; var pack = e.Mobile.Backpack; if (!int.TryParse(split[1], out amount)) { break; } if ((!Core.ML && amount > 5000) || (Core.ML && 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) { var box = 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 != null) { vendor.Say( "Thy current bank balance is {0:#,0} platinum and {1:#,0} gold.", e.Mobile.Account.TotalPlat, e.Mobile.Account.TotalGold); } 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; } var 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 { var check = new BankCheck(amount); var 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; } } } }
public static void Deposit( Container cont, int amount ) { while ( amount > 0 ) { Item item; if ( amount < 5000 ) { item = new Copper( amount ); amount = 0; } else if ( amount <= 1000000 ) { item = new BankCheck( amount ); amount = 0; } else { item = new BankCheck( 1000000 ); amount -= 1000000; } cont.DropItem( item ); } }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 1 && !this.m_House.Deleted) { if (this.m_House.IsOwner(this.m_Mobile)) { if (this.m_House.MovingCrate != null || this.m_House.InternalizedVendors.Count > 0) { this.m_Mobile.SendLocalizedMessage(1080455); // You can not resize your house at this time. Please remove all items fom the moving crate and try again. return; } else if (!Guilds.Guild.NewGuildSystem && this.m_House.FindGuildstone() != null) { this.m_Mobile.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside. return; } /*else if ( m_House.PlayerVendors.Count > 0 ) { m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving. return; }*/ else if (this.m_House.HasRentedVendors && this.m_House.VendorInventories.Count > 0) { this.m_Mobile.SendLocalizedMessage(1062679); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house. return; } else if (this.m_House.HasRentedVendors) { this.m_Mobile.SendLocalizedMessage(1062680); // You cannot do that that while you still have contract vendors in your house. return; } else if (this.m_House.VendorInventories.Count > 0) { this.m_Mobile.SendLocalizedMessage(1062681); // You cannot do that that while you still have unclaimed contract vendor inventory in your house. return; } if (this.m_Mobile.AccessLevel >= AccessLevel.GameMaster) { this.m_Mobile.SendMessage("You do not get a refund for your house as you are not a player"); this.m_House.RemoveKeys(this.m_Mobile); new TempNoHousingRegion(this.m_House, this.m_Mobile); this.m_House.Delete(); } else { Item toGive = null; if (this.m_House.IsAosRules) { if (this.m_House.Price > 0) toGive = new BankCheck(this.m_House.Price); else toGive = this.m_House.GetDeed(); } else { toGive = this.m_House.GetDeed(); if (toGive == null && this.m_House.Price > 0) toGive = new BankCheck(this.m_House.Price); } if (toGive != null) { BankBox box = this.m_Mobile.BankBox; if (box.TryDropItem(this.m_Mobile, toGive, false)) { if (toGive is BankCheck) this.m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)toGive).Worth.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box. this.m_House.RemoveKeys(this.m_Mobile); new TempNoHousingRegion(this.m_House, this.m_Mobile); this.m_House.Delete(); } else { toGive.Delete(); this.m_Mobile.SendLocalizedMessage(500390); // Your bank box is full. } } else { this.m_Mobile.SendMessage("Unable to refund house."); } } } else { this.m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do this. } } else if (info.ButtonID == 0) { this.m_Mobile.CloseGump(typeof(ConfirmHouseResize)); this.m_Mobile.SendGump(new HouseGumpAOS(HouseGumpPageAOS.Customize, this.m_Mobile, this.m_House)); } }
public override void OnSpeech( SpeechEventArgs e ) { if ( !e.Handled && e.Mobile.InLOS( this ) ) { 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; 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; BankBox box = e.Mobile.BankBox; if ( box != null ) { this.Say( String.Format("Thy current bank balance is {0} gold.", box.TotalGold.ToString() ) ); } break; } case 0x0002: // *bank* { e.Handled = true; BankBox box = e.Mobile.BankBox; if ( box != null ) box.Open(); break; } case 0x0003: // *check* { e.Handled = true; 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( String.Format("Into your bank box I have placed a check in the amount of: {0}", amount.ToString() ) ); } } } break; } } } } base.OnSpeech( e ); }
public virtual void AwardWinnings(Mobile m, int amount) { if(m == null) return; if(m.Backpack != null && amount > 0) { // give them a check for the winnings BankCheck check = new BankCheck( amount); check.Name = String.Format(XmlPoints.GetText(m, 100300),ChallengeName); // "Prize from {0}" m.AddToBackpack( check ); XmlPoints.SendText(m, 100301, amount); // "You have received a bank check for {0}" } }
public IceBlueDonationBox() { Weight = 1.0; Hue = 1154; Item item = null; Name = "Defiance Iceblue Member Box"; PlaceItemIn( 16, 60, (item = new SkillBall( 25 )) ); item.Hue = 5; PlaceItemIn( 28, 60, (item = new SkillBall( 25 )) ); item.Hue = 5; PlaceItemIn( 41, 58, (item = new SevenGMSkillBall()) ); item.Hue = 1161; PlaceItemIn( 53, 58, (item = new StatsBall()) ); item.Hue = 1161; PlaceItemIn( 16, 81, (item = new HoodedShroudOfShadows()) ); item.Hue = 1154; item.Name = "Iceblue Shroud of Shadows"; item.LootType = LootType.Blessed; BaseContainer cont; PlaceItemIn( 58, 57, (cont = new Backpack()) ); cont.Hue = 1154; cont.Name = "an iceblue backpack"; cont.PlaceItemIn( 44, 65, new SulfurousAsh(10000) ); cont.PlaceItemIn( 77, 65, new Nightshade(10000) ); cont.PlaceItemIn( 110, 65, new SpidersSilk(10000) ); cont.PlaceItemIn( 143, 65, new Garlic(10000) ); cont.PlaceItemIn( 44, 128, new Ginseng(10000) ); cont.PlaceItemIn( 77, 128, new Bloodmoss(10000) ); cont.PlaceItemIn( 110, 128, new BlackPearl(10000) ); cont.PlaceItemIn( 143, 128, new MandrakeRoot(10000) ); PlaceItemIn( 90, 58, (item = new AncientCoat()) ); item.Hue = 1154; item.Name = "Iceblue Ancient Coat"; item.LootType = LootType.Blessed; PlaceItemIn( 74, 64, (item = new WizardGlasses()) ); item.Hue = Utility.RandomList(1154); PlaceItemIn( 103, 58, (item = new Sandals()) ); item.Hue = Utility.RandomList(1154); item.Name = "Polar Sandals"; item.LootType = LootType.Blessed; PlaceItemIn( 122, 53, new SpecialDonateDye() ); PlaceItemIn( 133, 53, new SpecialDonateDyeBeard() ); PlaceItemIn( 156, 55, (item = new EtherealLongManeHorse()) ); item.Hue = 1154; PlaceItemIn( 34, 83, (item = new HolyDeedofBlessing()) ); item.Hue = 1154; PlaceItemIn( 43, 83, (item = new CursedClothingBlessDeed()) ); item.Hue = 1154; PlaceItemIn( 58, 83, (item = new SpecialHairRestylingDeed()) ); item.Hue = 1154; PlaceItemIn( 73, 83, (item = new SmallBrickHouseDeed()) ); item.Hue = 1154; PlaceItemIn( 88, 83, (item = new NameChangeDeed()) ); item.Hue = 1154; PlaceItemIn( 103, 83, (item = new AntiBlessDeed()) ); item.Hue = 1154; PlaceItemIn( 118, 83, (item = new BankCheck(100000)) ); item.Hue = 1154; PlaceItemIn(130, 83, (item = new MembershipTicket())); item.Hue = 1154; ((MembershipTicket)item).MemberShipTime = TimeSpan.FromDays(730); }
public override bool OnDragDrop( Mobile from, Item dropped ) { /* TODO: Thou art giving me? and fame/karma for gold gifts */ if ( dropped is SmallBOD || dropped is LargeBOD ) { if( Core.ML ) { if( ((PlayerMobile)from).NextBODTurnInTime > DateTime.Now ) { SayTo( from, 1079976 ); // return false; } } SmallBOD sbod = dropped as SmallBOD; LargeBOD lbod = dropped as LargeBOD; if ( !IsValidBulkOrder( dropped ) || !SupportsBulkOrders( from ) ) SayTo( from, 1045130 ); // That order is for some other shopkeeper. else if ( ( sbod != null && !sbod.Complete ) || ( lbod != null && !lbod.Complete ) ) SayTo( from, 1045131 ); // You have not completed the order yet. else { Item reward; int gold, fame; if ( sbod != null ) sbod.GetRewards( out reward, out gold, out fame ); else lbod.GetRewards( out reward, out gold, out fame ); if ( reward != null || gold > 0 ) { Item rewardgold = null; if ( gold > 1000 ) rewardgold = new BankCheck( gold ); else if ( gold > 0 ) rewardgold = new Gold( gold ); /*if ( ( reward != null && !from.Backpack.CheckHold( from, reward, false ) ) || ( rewardgold != null && !from.Backpack.CheckHold( from, rewardgold, false ) ) )*/ if ( reward != null && rewardgold != null && from.Backpack.TryDropItems( from, false, reward, rewardgold ) ) { from.SendSound( 0x3D ); SayTo( from, 1045132 ); // Thank you so much! Here is a reward for your effort. Titles.AwardFame( from, fame, true ); OnSuccessfulBulkOrderReceive( from, dropped ); dropped.Delete(); return true; } else { SayTo( from, 1045129 ); // You do not have enough room in your backpack for the bulk request's reward. if ( reward != null ) reward.Delete(); if ( rewardgold != null ) rewardgold.Delete(); } } } return false; } return base.OnDragDrop( from, dropped ); }
public override void OnSpeech(SpeechEventArgs e) { if (!e.Handled && e.Mobile.InLOS(this)) { 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; 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; BankBox box = e.Mobile.BankBox; if (box != null) { this.Say(String.Format("Thy current bank balance is {0} gold.", box.TotalGold.ToString())); } break; } case 0x0002: // *bank* { e.Handled = true; BankBox box = e.Mobile.BankBox; if (box != null) { box.Open(); } break; } case 0x0003: // *check* { e.Handled = true; 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(String.Format("Into your bank box I have placed a check in the amount of: {0}", amount.ToString())); } } } break; } } } } base.OnSpeech(e); }
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 ( (!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)); 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; } 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; 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: } } } break; } } } } base.OnSpeech( e ); }
private void Finish_Callback() { ArrayList teams = new ArrayList(); for ( int i = 0; i < m_Context.Participants.Count; ++i ) { BRTeamInfo teamInfo = m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length]; if ( teamInfo == null ) continue; teams.Add( teamInfo ); } teams.Sort(); Tournament tourny = m_Context.m_Tournament; StringBuilder sb = new StringBuilder(); if ( tourny != null && tourny.TournyType == TournyType.FreeForAll ) { sb.Append( m_Context.Participants.Count * tourny.PlayersPerParticipant ); sb.Append( "-man FFA" ); } else if ( tourny != null && tourny.TournyType == TournyType.RandomTeam ) { sb.Append( tourny.ParticipantsPerMatch ); sb.Append( "-team" ); } else if ( tourny != null && tourny.TournyType == TournyType.RedVsBlue ) { sb.Append( "Red v Blue" ); } else if ( tourny != null ) { for ( int i = 0; i < tourny.ParticipantsPerMatch; ++i ) { if ( sb.Length > 0 ) sb.Append( 'v' ); sb.Append( tourny.PlayersPerParticipant ); } } if ( m_Controller != null ) sb.Append( ' ' ).Append( m_Controller.Title ); string title = sb.ToString(); BRTeamInfo winner = (BRTeamInfo)( teams.Count > 0 ? teams[0] : null ); for ( int i = 0; i < teams.Count; ++i ) { TrophyRank rank = TrophyRank.Bronze; if ( i == 0 ) rank = TrophyRank.Gold; else if ( i == 1 ) rank = TrophyRank.Silver; BRPlayerInfo leader = ((BRTeamInfo)teams[i]).Leader; foreach ( BRPlayerInfo pl in ((BRTeamInfo)teams[i]).Players.Values ) { Mobile mob = pl.Player; if ( mob == null ) continue; if ( pl != leader && rank != TrophyRank.Gold ) continue; sb = new StringBuilder(); sb.Append( title ); if ( pl == leader ) sb.Append( " Leader" ); if ( pl.Score > 0 ) { sb.Append( ": " ); //sb.Append( pl.Score.ToString( "N0" ) ); //sb.Append( pl.Score == 1 ? " point" : " points" ); sb.Append( pl.Kills.ToString( "N0" ) ); sb.Append( pl.Kills == 1 ? " kill" : " kills" ); if ( pl.Captures > 0 ) { sb.Append( ", " ); sb.Append( pl.Captures.ToString( "N0" ) ); sb.Append( pl.Captures == 1 ? " point" : " points" ); } } Item item = new Trophy( sb.ToString(), rank ); if ( pl == leader ) item.ItemID = 4810; item.Name = String.Format( "{0}, {1} team", item.Name, ((BRTeamInfo)teams[i]).Name.ToLower() ); if ( !mob.PlaceInBackpack( item ) ) mob.BankBox.DropItem( item ); int cash = 0; if (rank != TrophyRank.Gold) cash = pl == leader ? 2500 : 0; else cash = pl == leader ? 7500 : 500; if ( cash > 0 ) { item = new BankCheck( cash ); if ( !mob.PlaceInBackpack( item ) ) mob.BankBox.DropItem( item ); mob.SendMessage( "You have been awarded a {0} trophy and {1:N0}gp for your participation in this game.", rank.ToString().ToLower(), cash ); } else { mob.SendMessage( "You have been awarded a {0} trophy for your participation in this game.", rank.ToString().ToLower() ); } } } for ( int i = 0; i < m_Context.Participants.Count; ++i ) { Participant p = m_Context.Participants[i] as Participant; if ( p == null || p.Players == null ) continue; for ( int j = 0; j < p.Players.Length; ++j ) { DuelPlayer dp = p.Players[j]; if ( dp != null && dp.Mobile != null ) { dp.Mobile.CloseGump( typeof( BRBoardGump ) ); dp.Mobile.SendGump( new BRBoardGump( dp.Mobile, this ) ); } } if ( i == winner.TeamID ) continue; if ( p != null && p.Players != null ) { for ( int j = 0; j < p.Players.Length; ++j ) { if ( p.Players[j] != null ) p.Players[j].Eliminated = true; } } } m_Context.Finish( m_Context.Participants[winner.TeamID] as Participant ); }
/// <summary> /// award coins to the player /// </summary> /// <param name="m">player to give coins too</param> /// <param name="tourneywinner">is this the tourney winner</param> public void GiveGold(Mobile m, bool tourneywinner) { //set up coin amount based on round and if they are the tourney winner int total = tourneywinner ? m_CoinsPerRound * m_CurrentRound + m_CoinsWinner : m_CoinsPerRound * m_CurrentRound; //create a floating set of coins BankCheck check = new BankCheck( total ); //if the players pack is full, delete the floating coins if (!m.AddToBackpack(check)) { check.Delete(); } }