private void ProcessValidPurchase( int amount, IBuyItemInfo bii, Mobile buyer, Container cont ) { if ( amount > bii.Amount ) amount = bii.Amount; if ( amount < 1 ) return; bii.Amount -= amount; IEntity o = bii.GetEntity(); if ( o is Item ) { Item item = (Item)o; if ( item.Stackable ) { item.Amount = amount; if ( cont == null || !cont.TryDropItem( buyer, item, false ) ) item.MoveToWorld( buyer.Location, buyer.Map ); } else { item.Amount = 1; if ( cont == null || !cont.TryDropItem( buyer, item, false ) ) item.MoveToWorld( buyer.Location, buyer.Map ); for ( int i = 1; i < amount; i++ ) { item = bii.GetEntity() as Item; if ( item != null ) { item.Amount = 1; if ( cont == null || !cont.TryDropItem( buyer, item, false ) ) item.MoveToWorld( buyer.Location, buyer.Map ); } } } } else if ( o is Mobile ) { Mobile m = (Mobile)o; m.Direction = (Direction)Utility.Random( 8 ); m.MoveToWorld( buyer.Location, buyer.Map ); m.PlaySound( m.GetIdleSound() ); if ( m is BaseCreature ) ( (BaseCreature)m ).SetControlMaster( buyer ); for ( int i = 1; i < amount; ++i ) { m = bii.GetEntity() as Mobile; if ( m != null ) { m.Direction = (Direction)Utility.Random( 8 ); m.MoveToWorld( buyer.Location, buyer.Map ); if ( m is BaseCreature ) ( (BaseCreature)m ).SetControlMaster( buyer ); } } } }
private void ProcessValidPurchase(int amount, IBuyItemInfo bii, Mobile buyer, Container cont) { if (!Trading || CashType == null || !CashType.IsNotNull) { return; } if (amount > bii.Amount) { amount = bii.Amount; } if (amount < 1) { return; } bii.Amount -= amount; var o = bii.GetEntity(); if (o is Item) { var item = (Item)o; if (item.Stackable) { item.Amount = amount; if (cont == null || !cont.TryDropItem(buyer, item, false)) { item.MoveToWorld(buyer.Location, buyer.Map); } } else { item.Amount = 1; if (cont == null || !cont.TryDropItem(buyer, item, false)) { item.MoveToWorld(buyer.Location, buyer.Map); } for (var i = 1; i < amount; i++) { item = bii.GetEntity() as Item; if (item == null) { continue; } item.Amount = 1; if (cont == null || !cont.TryDropItem(buyer, item, false)) { item.MoveToWorld(buyer.Location, buyer.Map); } } } } else if (o is Mobile) { var m = (Mobile)o; m.Direction = (Direction)Utility.Random(8); m.MoveToWorld(buyer.Location, buyer.Map); m.PlaySound(m.GetIdleSound()); if (m is BaseCreature) { ((BaseCreature)m).SetControlMaster(buyer); } for (var i = 1; i < amount; ++i) { m = bii.GetEntity() as Mobile; if (m == null) { continue; } m.Direction = (Direction)Utility.Random(8); m.MoveToWorld(buyer.Location, buyer.Map); if (m is BaseCreature) { ((BaseCreature)m).SetControlMaster(buyer); } } } }
private void ProcessValidPurchase(int amount, IBuyItemInfo bii, Mobile buyer, Container cont, Container bankbox) { if (amount > bii.Amount) { amount = bii.Amount; } if (amount < 1) { return; } bii.Amount -= amount; IEntity o = bii.GetEntity(); if (o is Item) { Item item = (Item)o; if (item.Stackable) { item.Amount = amount; if (cont == null || !cont.TryDropItem(buyer, item, false)) { if (bankbox.TryDropItem(buyer, item, false)) { buyer.PrivateOverheadMessage(MessageType.Regular, 0x22, true, "Because of overweight your purchase was delivered to your bankbox.", buyer.NetState); } else { item.MoveToWorld(buyer.Location, buyer.Map); } } } else { item.Amount = 1; item.Quality = Quality.Low; if (cont == null || !cont.TryDropItem(buyer, item, false)) { if (bankbox.TryDropItem(buyer, item, false)) { buyer.PrivateOverheadMessage(MessageType.Regular, 0x22, true, "Because of overencumbrance your purchase was delivered to your bankbox.", buyer.NetState); } else { item.MoveToWorld(buyer.Location, buyer.Map); } } for (int i = 1; i < amount; i++) { if (item != null) { item = bii.GetEntity() as Item; item.Amount = 1; if (cont == null || !cont.TryDropItem(buyer, item, false)) { if (bankbox.TryDropItem(buyer, item, false)) { buyer.PrivateOverheadMessage(MessageType.Regular, 0x22, true, "Because of overencumbrance your purchase was delivered to your bankbox.", buyer.NetState); } else { item.MoveToWorld(buyer.Location, buyer.Map); } } } } } } else if (o is Mobile) { Mobile m = (Mobile)o; m.Direction = (Direction)Utility.Random(8); m.MoveToWorld(buyer.Location, buyer.Map); m.PlaySound(m.GetIdleSound()); if (m is BaseCreature) { ((BaseCreature)m).SetControlMaster(buyer); } for (int i = 1; i < amount; ++i) { m = bii.GetEntity() as Mobile; if (m != null) { m.Direction = (Direction)Utility.Random(8); m.MoveToWorld(buyer.Location, buyer.Map); if (m is BaseCreature) { ((BaseCreature)m).SetControlMaster(buyer); } } } } }
private void ProcessValidPurchase( int amount, IBuyItemInfo bii, Mobile buyer, Container cont ) { if ( amount > bii.Amount ) amount = bii.Amount; if ( amount < 1 ) return; bii.Amount -= amount; IEntity o = bii.GetEntity(); if ( o is Item ) { Item item = (Item)o; if (item is Food) { Food food = item as Food; if (Utility.RandomDouble() <= 0.05) food.Poison = Poison.Lesser; } if (item is BaseWeapon) { BaseWeapon wpn = item as BaseWeapon; if (Utility.RandomDouble() <= 0.05) wpn.Quality = WeaponQuality.Low; } if (item is BaseArmor) { BaseArmor arm = item as BaseArmor; if (Utility.RandomDouble() <= 0.05) arm.Quality = ArmorQuality.Low; } if (item is BaseTool) { BaseTool tool = item as BaseTool; if (Utility.RandomDouble() <= 0.05) tool.UsesRemaining /= 2; } if ( item.Stackable ) { item.Amount = amount; if ( cont == null || !cont.TryDropItem( buyer, item, false ) ) item.MoveToWorld( buyer.Location, buyer.Map ); } else { item.Amount = 1; if ( cont == null || !cont.TryDropItem( buyer, item, false ) ) item.MoveToWorld( buyer.Location, buyer.Map ); for ( int i = 1; i < amount; i++ ) { item = bii.GetEntity() as Item; if ( item != null ) { item.Amount = 1; if ( cont == null || !cont.TryDropItem( buyer, item, false ) ) item.MoveToWorld( buyer.Location, buyer.Map ); } } } } else if ( o is Mobile ) { Mobile m = (Mobile)o; m.Direction = (Direction)Utility.Random( 8 ); m.MoveToWorld( buyer.Location, buyer.Map ); m.PlaySound( m.GetIdleSound() ); if ( m is BaseCreature ) ( (BaseCreature)m ).SetControlMaster( buyer ); for ( int i = 1; i < amount; ++i ) { m = bii.GetEntity() as Mobile; if ( m != null ) { m.Direction = (Direction)Utility.Random( 8 ); m.MoveToWorld( buyer.Location, buyer.Map ); if ( m is BaseCreature ) ( (BaseCreature)m ).SetControlMaster( buyer ); } } } }
private static void ProcessValidPurchase(int amount, IBuyItemInfo bii, Mobile buyer, Container cont) { if (amount > bii.Amount) { amount = bii.Amount; } if (amount < 1) { return; } bii.Amount -= amount; IEntity o = bii.GetEntity(); if (o is Item) { var item = (Item)o; if (item.Stackable) { item.Amount = amount; if (cont is BankBox) { buyer.LocalOverheadMessage( MessageType.Regular, 0x38, false, "Given the cost of the items, they will be delivered to your bank."); } if (cont == null || !cont.TryDropItem(buyer, item, false)) { // try to put it in the bank cont = buyer.BankBox; if (cont == null || !cont.TryDropItem(buyer, item, false)) { //buyer.SendMessage(38, "You don't have enough room for that in your pack OR in your bank. It has been placed on the ground!"); buyer.LocalOverheadMessage( MessageType.Regular, 38, false, "You don't have enough room for that in your pack OR in your bank. It has been placed on the ground!"); item.MoveToWorld(buyer.Location, buyer.Map); } else { //buyer.SendMessage(0x38, "Since you could not carry the item, it has been delivered to your bank."); buyer.LocalOverheadMessage( MessageType.Regular, 38, false, "Since you could not carry the item, it has been delivered to your bank."); } } } else { item.Amount = 1; if (cont is BankBox) { buyer.LocalOverheadMessage( MessageType.Regular, 0x38, false, "Given the cost of the items, they will be delivered to your bank."); } if (cont == null || !cont.TryDropItem(buyer, item, false)) { // try to put it in the bank cont = buyer.BankBox; if (cont == null || !cont.TryDropItem(buyer, item, false)) { buyer.LocalOverheadMessage( MessageType.Regular, 38, false, "You don't have enough room for that in your pack OR in your bank. It has been placed on the ground!"); //buyer.SendMessage(38, ); item.MoveToWorld(buyer.Location, buyer.Map); } else { buyer.LocalOverheadMessage( MessageType.Regular, 38, false, "Since you could not carry the item, it has been delivered to your bank."); //buyer.SendMessage(0x38, "Since you could not carry the item, it has been delivered to your bank."); } } for (int i = 1; i < amount; i++) { item = bii.GetEntity() as Item; if (item == null) { continue; } item.Amount = 1; if (cont != null && cont.TryDropItem(buyer, item, false)) { continue; } // try to put it in the bank cont = buyer.BankBox; if (cont == null || !cont.TryDropItem(buyer, item, false)) { //buyer.SendMessage(38, "You don't have enough room for that in your pack OR in your bank. It has been placed on the ground!"); buyer.LocalOverheadMessage( MessageType.Regular, 38, false, "You don't have enough room for that in your pack OR in your bank. It has been placed on the ground!"); item.MoveToWorld(buyer.Location, buyer.Map); } else { //buyer.SendMessage(0x38, "Since you could not carry the item, it has been delivered to your bank."); buyer.LocalOverheadMessage( MessageType.Regular, 38, false, "Since you could not carry the item, it has been delivered to your bank."); } } if (item is BaseBoatDeed && buyer is PlayerMobile) { Timer.DelayCall(TimeSpan.FromSeconds(3.0), ((PlayerMobile)buyer).BoatDeedWarning); } } } else if (o is Mobile) { var m = (Mobile)o; m.Direction = (Direction)Utility.Random(8); m.MoveToWorld(buyer.Location, buyer.Map); m.PlaySound(m.GetIdleSound()); if (m is BaseCreature) { ((BaseCreature)m).SetControlMaster(buyer); } for (int i = 1; i < amount; ++i) { m = bii.GetEntity() as Mobile; if (m == null) { continue; } m.Direction = (Direction)Utility.Random(8); m.MoveToWorld(buyer.Location, buyer.Map); if (m is BaseCreature) { ((BaseCreature)m).SetControlMaster(buyer); } } } }