public bool GiveBottle(Mobile m, int amount, Item potion) { Container pack = m.Backpack; if (potion is BaseMixture) { Jar jar = new Jar(amount); if (pack == null || !pack.TryDropItem(m, jar, false)) { jar.Delete(); return(false); } } else { Bottle bottle = new Bottle(amount); if (pack == null || !pack.TryDropItem(m, bottle, false)) { bottle.Delete(); return(false); } } return(true); }
public bool GiveBottle(Mobile m, int amount) { Container pack = m.Backpack; Bottle bottle = new Bottle(amount); if (pack == null || !pack.TryDropItem(m, bottle, false)) { bottle.Delete(); return(false); } return(true); }
public bool GiveBottle( Mobile m ) { Container pack = m.Backpack; Bottle bottle = new Bottle(); if ( pack == null || !pack.TryDropItem( m, bottle, false ) ) { bottle.Delete(); return false; } return true; }
public static void PlayDrinkEffect( Mobile m, BasePotion potion ) { if ( m is PlayerMobile && !(m as PlayerMobile).HiddenWithSpell ) m.RevealingAction(); m.PlaySound( 0x31 ); if (potion != null) { if (!potion.EventItem || (potion.EventItem && potion.EventItemConsume)) { Bottle b = new Bottle(); if (potion.EventItem) { b.EventItem = true; b.Hue = potion.Hue; b.Name = "event Empty bottle"; } #region Add to pack or ground if overweight //Taran: Check to see if player is overweight. If they are and the item drops to the //ground then a check is made to see if it can be stacked. If it can't and more than //20 items of the same type exist in the same tile then the last item gets removed. This //check is made so thousands of items can't exist in 1 tile and crash people in the same area. if (!m.AddToBackpack(b)) { IPooledEnumerable eable = m.Map.GetItemsInRange(m.Location, 0); int amount = 0; Item toRemove = null; foreach (Item i in eable) { if (i != b && i.ItemID == b.ItemID) { if (i.StackWith(m, b, false)) { toRemove = b; break; } amount++; } } m.SendAsciiMessage("You are overweight and put the {0} on the ground.", b.Name ?? CliLoc.LocToString(b.LabelNumber)); if (toRemove != null) toRemove.Delete(); else if (amount >= 5 && amount < 20) m.LocalOverheadMessage(MessageType.Regular, 906, true, string.Format("{0} identical items on the ground detected, no more than 20 is allowed!", amount)); else if (amount >= 20) { m.LocalOverheadMessage(MessageType.Regular, 906, true, "Too many identical items on the ground, removing!"); b.Delete(); } eable.Free(); } #endregion potion.Consume(1); } } if( m.Body.IsHuman ) m.Animate(m.Mounted ? 28 : 34, 5, 1, true, false, 0); }
public override void OnDoubleClick(Mobile from) { base.OnDoubleClick(from); PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!(player.IsUOACZHuman)) { return; } if (Utility.GetDistance(player.Location, Location) > 2) { from.SendMessage("You are too far away to use that."); return; } if (!Map.InLOS(player.Location, Location)) { from.SendMessage("That is not within your line of sight."); return; } if (player.Backpack == null) { return; } bool foundContainer = false; Item[] items = player.Backpack.FindItemsByType(typeof(UOACZWaterTub)); if (!foundContainer) { foreach (Item item in items) { UOACZWaterTub waterContainer = item as UOACZWaterTub; if (waterContainer.Charges < waterContainer.MaxCharges) { waterContainer.Charges++; foundContainer = true; player.SendMessage("You gather the water and place it into a water tub."); break; } } } if (!foundContainer) { items = player.Backpack.FindItemsByType(typeof(UOACZTub)); UOACZTub waterContainer = null; foreach (Item item in items) { waterContainer = item as UOACZTub; foundContainer = true; break; } if (waterContainer != null) { int oldX = waterContainer.X; int oldY = waterContainer.Y; if (waterContainer != null) { waterContainer.Delete(); UOACZWaterTub newWaterTub = new UOACZWaterTub(); newWaterTub.Charges = 1; player.Backpack.DropItem(newWaterTub); newWaterTub.X = oldX; newWaterTub.Y = oldY; player.SendMessage("You gather the water and place it into an empty tub."); } } } if (!foundContainer) { items = player.Backpack.FindItemsByType(typeof(UOACZBottleOfWater)); foreach (Item item in items) { UOACZBottleOfWater waterContainer = item as UOACZBottleOfWater; if (waterContainer.Charges < waterContainer.MaxCharges) { waterContainer.Charges++; foundContainer = true; player.SendMessage("You gather the water and add it to an existing bottle of water."); break; } } } if (!foundContainer) { Item item = player.Backpack.FindItemByType(typeof(Bottle)); if (item != null) { Bottle bottle = item as Bottle; if (bottle.Amount == 1) { bottle.Delete(); } else { bottle.Amount--; } UOACZBottleOfWater newBottleOfWater = new UOACZBottleOfWater(); player.Backpack.DropItem(newBottleOfWater); foundContainer = true; player.SendMessage("You gather the water and place it into an empty bottle."); } } if (!foundContainer) { items = player.Backpack.FindItemsByType(typeof(UOACZGlass)); UOACZGlass waterContainer = null; foreach (Item item in items) { waterContainer = item as UOACZGlass; foundContainer = true; break; } if (waterContainer != null) { int oldX = waterContainer.X; int oldY = waterContainer.Y; if (waterContainer != null) { waterContainer.Delete(); UOACZGlassOfWater newWaterGlass = new UOACZGlassOfWater(); newWaterGlass.Charges = 1; player.Backpack.DropItem(newWaterGlass); newWaterGlass.X = oldX; newWaterGlass.Y = oldY; player.SendMessage("You gather the water and place it into an empty glass."); } } } if (foundContainer) { player.Animate(32, 5, 1, true, false, 0); player.PlaySound(0x4d1); Charges--; UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.ScavengeableWaterItems++; } else { player.SendMessage("You must have a empty bottle, empty glass, or water tub available in order to gather water."); } }
public static void PlayDrinkEffect(Mobile m, BasePotion potion) { if (m is PlayerMobile && !(m as PlayerMobile).HiddenWithSpell) { m.RevealingAction(); } m.PlaySound(0x31); if (potion != null) { if (!potion.EventItem || (potion.EventItem && potion.EventItemConsume)) { Bottle b = new Bottle(); if (potion.EventItem) { b.EventItem = true; b.Hue = potion.Hue; b.Name = "event Empty bottle"; } #region Add to pack or ground if overweight //Taran: Check to see if player is overweight. If they are and the item drops to the //ground then a check is made to see if it can be stacked. If it can't and more than //20 items of the same type exist in the same tile then the last item gets removed. This //check is made so thousands of items can't exist in 1 tile and crash people in the same area. if (!m.AddToBackpack(b)) { IPooledEnumerable eable = m.Map.GetItemsInRange(m.Location, 0); int amount = 0; Item toRemove = null; foreach (Item i in eable) { if (i != b && i.ItemID == b.ItemID) { if (i.StackWith(m, b, false)) { toRemove = b; break; } amount++; } } m.SendAsciiMessage("You are overweight and put the {0} on the ground.", b.Name ?? CliLoc.LocToString(b.LabelNumber)); if (toRemove != null) { toRemove.Delete(); } else if (amount >= 5 && amount < 20) { m.LocalOverheadMessage(MessageType.Regular, 906, true, string.Format("{0} identical items on the ground detected, no more than 20 is allowed!", amount)); } else if (amount >= 20) { m.LocalOverheadMessage(MessageType.Regular, 906, true, "Too many identical items on the ground, removing!"); b.Delete(); } eable.Free(); } #endregion potion.Consume(1); } } if (m.Body.IsHuman) { m.Animate(m.Mounted ? 28 : 34, 5, 1, true, false, 0); } }
protected override void OnTarget( Mobile from, object targeted ) { bool releaseLock = true; if (m_Potion.Deleted) { if (releaseLock && from is PlayerMobile) ((PlayerMobile)from).EndPlayerAction(); return; } bool startTimer = false; if ( targeted is Food || targeted is FukiyaDarts || targeted is Shuriken ) { startTimer = true; } else if ( targeted is BaseWeapon ) { BaseWeapon weapon = (BaseWeapon)targeted; if ( Core.AOS ) { startTimer = ( weapon.PrimaryAbility == WeaponAbility.InfectiousStrike || weapon.SecondaryAbility == WeaponAbility.InfectiousStrike ); } else if (weapon.Layer == Layer.OneHanded && !(weapon is SuperiorDiamondKatana || weapon is DiamondKatana || weapon is HellsHalberd || weapon is SuperiorDragonsBlade || weapon is DragonsBlade || weapon is HeavensFury || weapon is SoV)) //Loki edit: 1H blades only { startTimer = (weapon.Type == WeaponType.Slashing || weapon.Type == WeaponType.Piercing); } } if ( startTimer ) { releaseLock = false; new InternalTimer( from, (Item)targeted, m_Potion ).Start(); from.PlaySound( 0x4F ); if (!m_Potion.EventItem) //Loki edit: Event pots are not consumed and don't create empty bottles { m_Potion.Consume(); Bottle bottle = new Bottle(); #region Add to pack or ground if overweight //Taran: Check to see if player is overweight. If they are and the item drops to the //ground then a check is made to see if it can be stacked. If it can't and more than //20 items of the same type exist in the same tile then the last item gets removed. This //check is made so thousands of items can't exist in 1 tile and crash people in the same area. if (from.AddToBackpack(bottle)) from.SendAsciiMessage("You put the {0} in your pack.", bottle.Name ?? CliLoc.LocToString(bottle.LabelNumber)); else if (!bottle.Deleted) { IPooledEnumerable eable = from.Map.GetItemsInRange(from.Location, 0); int amount = 0; Item toRemove = null; foreach (Item i in eable) { if (i != bottle && i.ItemID == bottle.ItemID) { if (i.StackWith(from, bottle, false)) { toRemove = bottle; break; } amount++; } } from.SendAsciiMessage("You are overweight and put the {0} on the ground.", bottle.Name ?? CliLoc.LocToString(bottle.LabelNumber)); if (toRemove != null) toRemove.Delete(); else if (amount >= 5 && amount < 20) from.LocalOverheadMessage(MessageType.Regular, 906, true, string.Format("{0} identical items on the ground detected, no more than 20 is allowed!", amount)); else if (amount >= 20) { from.LocalOverheadMessage(MessageType.Regular, 906, true, "Too many identical items on the ground, removing!"); bottle.Delete(); } eable.Free(); } #endregion } } else // Target can't be poisoned { if ( Core.AOS ) from.SendLocalizedMessage( 1060204 ); // You cannot poison that! You can only poison infectious weapons, food or drink. else //from.SendLocalizedMessage( 502145 ); // You cannot poison that! You can only poison bladed or piercing weapons, food or drink. from.SendAsciiMessage("You cannot poison that! You can only poison certain weapons, food or drink."); } if (releaseLock && from is PlayerMobile) ((PlayerMobile)from).EndPlayerAction(); }