private void OnTargetBottle(Mobile from, object target) { if (target is Bottle) { Bottle bottle = (Bottle)target; object parent = bottle.RootParent; if (parent == from || (parent == null && from.InRange(bottle.GetWorldLocation(), 3))) { Item potion; try { ConstructorInfo ctor = m_Contains.GetConstructor(Type.EmptyTypes); potion = ctor.Invoke(null) as Item; } catch { potion = null; } m_Contains = null; if (potion != null) { from.PublicOverheadMessage(MessageType.Emote, 0x25, true, String.Format("*{0} pours the completed potion into a bottle.*", from.Name)); from.PlaySound(0x240); from.AddToBackpack(potion); bottle.Consume(); } else { from.SendAsciiMessage("Maybe there was nothing in the mortar after all...."); } } else { from.SendAsciiMessage("The bottle must be in your backpack to use."); } } else { from.SendAsciiMessage("That is not an empty bottle."); } }
protected override void OnTarget( Mobile from, object o ) { if ( o is Item ) { Item item = o as Item; if ( item.RootParent != from ) from.SendMessage( "The object needs to be in your pack." ); else { Item[] items; if ( !(item is BaseContainer) ) { items = new Item[1]; items[0] = item; } else items = ((BaseContainer)item).FindItemsByType( new Type[]{ typeof(BasePotion), typeof(BaseBeverage) }, false ); foreach ( Item tmpItem in items ) { if ( tmpItem is BasePotion ) { BasePotion potion = tmpItem as BasePotion; Bottle emptybottle = new Bottle(); from.AddToBackpack( emptybottle ); potion.Delete(); } else if ( tmpItem is BaseBeverage ) { BaseBeverage beverage = tmpItem as BaseBeverage; if (beverage.Quantity > 0) beverage.Quantity = 0; } else from.SendMessage( "Can't empty that." ); } } } else { from.SendMessage( "That's not a liquid container." ); } }
protected override void OnTarget( Mobile from, object o ) { if ( o is DrinkPotion ) { DrinkPotion potion = o as DrinkPotion; if ( potion.RootParent != from ) from.SendMessage( "The potion must be in your pack." ); else if ( potion.Enhanced ) from.SendMessage( "This potion has already been enhanced." ); else if ( potion.Effects.Count == 0 ) from.SendMessage( "There is no substance present to enhance." ); else { if ( Utility.RandomBool() ) // 50% chance to succeed { double bonusFactor; bonusFactor = 1 + ( 0.2 * ((PlayerMobile)from).Feats.GetFeatLevel(FeatList.EnhancePotion) ); // 30% increase, change this to accomodate feat levels CustomEffect[] keyarray = new CustomEffect[potion.Effects.Count]; int k = 0; foreach ( KeyValuePair<CustomEffect, int> kvp in potion.Effects ) keyarray[k++] = kvp.Key; foreach ( CustomEffect key in keyarray ) potion.Effects[key] = (int)(potion.Effects[key] * bonusFactor); potion.Enhanced = true; from.SendMessage( "You successfully enhance the potion." ); } else { Bottle emptybottle = new Bottle(); from.AddToBackpack( emptybottle ); potion.Consume( 1 ); from.SendMessage( "You have failed in your attempt at enhancing the potion, and have thus rendered it worthless." ); } } } else from.SendMessage( "You can only enhance drinkable potions." ); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Bottle) { Bottle bottle = targeted as Bottle; Container pack = from.Backpack; from.SendLocalizedMessage(502242); // You pour some of the keg's contents into an empty bottle... BasePotion pot = m_Keg.FillBottle(); if (pack.TryDropItem(from, pot, false)) { from.SendLocalizedMessage(502243); // ...and place it into your backpack. from.PlaySound(0x240); if (--m_Keg.Held == 0) { from.SendLocalizedMessage(502245); // The keg is now empty. } else { m_Keg.Unknown = false; } bottle.Consume(); } else { from.SendLocalizedMessage(502244); // ...but there is no room for the bottle in your backpack. from.SendLocalizedMessage(502217); // Nothing comes out of the tap! pot.Delete(); } } else { from.SendLocalizedMessage(502227); // That cannot be used to hold a potion. } }
protected override void OnTarget( Mobile from, object target ) { if ( target is BasePotion ) { BasePotion p = (BasePotion)target; Bottle bottle = new Bottle(); from.AddToBackpack( bottle ); p.Delete(); from.SendMessage( "You have dumped the potion out, and put the empty bottle in your pack." ); ConsumeCharge( from, m_screw ); } else if ( target is Container ) { Container c = (Container)target; BasePotion p; bool cont = true; int amount = 0; if ( c.FindItemByType( typeof (BasePotion) ) != null ) { amount = c.GetAmount( typeof (BasePotion) ); while ( cont ) { p = (BasePotion)c.FindItemByType( typeof (BasePotion) ); p.Delete(); if ( c.FindItemByType( typeof (BasePotion) ) == null ) cont = false; } c.DropItem( new Bottle( amount ) ); from.SendMessage( "The potions have been emptied." ); ConsumeCharge( from, m_screw ); } else from.SendMessage( "That container holds no potions!" ); } else from.SendMessage( "You may only use this on a full potion or a container with potions in it!" ); }
protected override void OnTarget(Mobile from, object targeted) { if (this.m_Item.Deleted) return; PlantPigment pigment = targeted as PlantPigment; if (null == pigment) { from.SendLocalizedMessage(1112124); // You may only mix this with another non-saturated plant pigment. return; } if (from.Skills[SkillName.Alchemy].Base < 75.0 && from.Skills[SkillName.Cooking].Base < 75.0) { from.SendLocalizedMessage(1112214); // You lack the alchemy or cooking skills to mix plant pigments. } else if ((PlantPigmentHue.White == pigment.PigmentHue || PlantPigmentHue.Black == pigment.PigmentHue || PlantPigmentHue.White == this.m_Item.PigmentHue || PlantPigmentHue.Black == this.m_Item.PigmentHue) && from.Skills[SkillName.Alchemy].Base < 100.0 && from.Skills[SkillName.Cooking].Base < 100.0) { from.SendLocalizedMessage(1112213); // You lack the alchemy or cooking skills to mix so unstable a pigment. } else if (this.m_Item.PigmentHue == pigment.PigmentHue) { from.SendLocalizedMessage(1112242); // You decide not to waste pigments by mixing two identical colors. } else if ((this.m_Item.PigmentHue & ~(PlantPigmentHue.Bright | PlantPigmentHue.Dark | PlantPigmentHue.Ice)) == (pigment.PigmentHue & ~(PlantPigmentHue.Bright | PlantPigmentHue.Dark | PlantPigmentHue.Ice))) { from.SendLocalizedMessage(1112243); // You decide not to waste pigments by mixing variations of the same hue. } else if ((PlantPigmentHue.White == this.m_Item.PigmentHue && PlantPigmentHueInfo.IsBright(pigment.PigmentHue)) || (PlantPigmentHue.White == pigment.PigmentHue && PlantPigmentHueInfo.IsBright(this.m_Item.PigmentHue))) { from.SendLocalizedMessage(1112241); // This pigment is too diluted to be faded further. } else if (!PlantPigmentHueInfo.IsMixable(pigment.PigmentHue)) from.SendLocalizedMessage(1112125); // This pigment is saturated and cannot be mixed further. else { PlantPigmentHue newHue = PlantPigmentHueInfo.Mix(this.m_Item.PigmentHue, pigment.PigmentHue); if (PlantPigmentHue.None == newHue) from.SendLocalizedMessage(1112125); // This pigment is saturated and cannot be mixed further. else { pigment.PigmentHue = newHue; Bottle bottle = new Bottle(); bottle.MoveToWorld(this.m_Item.Location, this.m_Item.Map); this.m_Item.Delete(); from.PlaySound(0x240); } } }
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 InternalTarget(Bottle bottle) : base(4, false, TargetFlags.None) { _bottle = bottle; }
public InternalTarget( Bottle bottle ) : base( 4, false, TargetFlags.None ) { _bottle = bottle; }
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(); }
public override bool OnDragDrop( Mobile from, Item item ) { if ( item is BasePotion ) { BasePotion pot = (BasePotion)item; if (pot.PotionEffect != m_Type && m_Held != 0) from.SendLocalizedMessage(502236); // You decide that it would be a bad idea to mix different types of potions. else if (m_Held >= m_MaxAmount) from.SendLocalizedMessage(502233); // The keg will not hold any more! else if (pot.Amount > (m_MaxAmount - m_Held)) from.SendAsciiMessage("That keg can't contain all those potions!"); else { if ( m_Held == 0) { m_Type = pot.PotionEffect; } int toConsume = m_MaxAmount - m_Held; if (toConsume > pot.Amount) toConsume = pot.Amount; m_Held += toConsume; pot.Consume(toConsume); Bottle emptyBottles = new Bottle(toConsume); if (!from.AddToBackpack(emptyBottles)) { from.SendAsciiMessage(string.Format("You are too heavey, you place the bottle{0} on the ground.", emptyBottles.Amount == 1 ? string.Empty : "s")); emptyBottles.MoveToWorld(from.Location); } else from.SendAsciiMessage(string.Format("You place the empty bottle{0} in your backpack.", emptyBottles.Amount == 1 ? string.Empty : "s")); ColorKeg(); from.PlaySound(0x240); } } else from.SendLocalizedMessage( 502232 ); // The keg is not designed to hold that type of object. //Always return false return false; }
public override void Empty( Item item ) { if( item is BasePotion ) { Bottle bottle = new Bottle(); BaseStoreKey.StoreAt( item, bottle ); item.Delete(); } else if( item is PotionKeg ) { ((PotionKeg)item).Held = 0; } }
public void CompleteCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool) { int badCraft = craftSystem.CanCraft(from, tool, m_Type); if (badCraft > 0) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) from.SendGump(new CraftGump(from, craftSystem, tool, badCraft)); else from.SendLocalizedMessage(badCraft); return; } int checkResHue = 0, checkMaxAmount = 0; object checkMessage = null; // Not enough resource to craft it if (!ConsumeRes(from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage)); else if (checkMessage is int && (int)checkMessage > 0) from.SendLocalizedMessage((int)checkMessage); else if (checkMessage is string) from.SendMessage((string)checkMessage); return; } else if (!ConsumeAttributes(from, ref checkMessage, false)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage)); else if (checkMessage is int && (int)checkMessage > 0) from.SendLocalizedMessage((int)checkMessage); else if (checkMessage is string) from.SendMessage((string)checkMessage); return; } bool toolBroken = false; int ignored = 1; int endquality = 1; bool allRequiredSkills = true; // pla, 01/04/07 // ----------------------------------------------------------------- // Additional checks required here to prevent skill gain exploit with special dye tubs. if (craftSystem is DefAlchemy && (ItemType == typeof(SpecialDyeTub) || ItemType == typeof(SpecialDye))) { // note here that if lighten or darken was chosen, there will always be at least one special tub, // as it's set as a resource requirement. if (m_NameString == "> Darken the mix" || m_NameString == "> Lighten the mix") { // darken/lighten requires a special tub // Get list of all special tubs Item[] sdtubs = ((Container)from.Backpack).FindItemsByType(typeof(SpecialDyeTub), true); SpecialDyeTub sdtub; if (sdtubs.Length == 0) { //should be impossible as in reqs return; } else if (sdtubs.Length == 1) { // in this case we have just one tub. This means we will leave skill gain and execution to the // standard craft code below. However, we need to first check if the tub can be lightened/darkened, // and if not then return to prevent skill gain with no resource use. sdtub = (SpecialDyeTub)sdtubs[0]; if (sdtub != null) { if (m_NameString == "> Darken the mix") { if (!sdtub.CanDarken) { from.SendMessage("You attempt to darken the mix, but it will go no darker."); from.SendGump(new CraftGump(from, craftSystem, tool, 0)); return; } } else { if (!sdtub.CanLighten) { from.SendMessage("You attempt to lighten the mix, but it will go no lighter."); from.SendGump(new CraftGump(from, craftSystem, tool, 0)); return; } } } } else if (sdtubs.Length > 1) { // in this case we have more than one possible tub to select so we hand execution over to the target. //target also deals with all skill gain and failure/tool use etc. int resHue = 0; int maxAmount = 0; object message = null; from.SendMessage("Select the dye tub you wish to use for the process."); from.Target = new SpecialDyeTubTarget(this, typeRes, craftSystem, ref resHue, ref maxAmount, ref message, m_NameString, (m_NameString == "> Darken the mix" ? 1 : 2), tool); //and now return to prevent the rest of the code executing return; } } else { // Create/append dye. This can either add to a same coloured special tub, or a fresh non-special tub. // So first we find all the valid tubs... Item[] dtubs = ((Container)from.Backpack).FindItemsByType(typeof(DyeTub), true); int iFound = 0; if (dtubs.Length > 0) { for (int i = 0; i < dtubs.Length; i++) { if (dtubs[i] is SpecialDyeTub) { // Is the same color? if (((SpecialDyeTub)dtubs[i]).StoredColorName == m_NameString && ((SpecialDyeTub)dtubs[i]).Uses < 100 && !((SpecialDyeTub)dtubs[i]).Prepped) { iFound++; } } else { iFound++; } } } if (iFound == 0) { from.SendMessage("You need a fresh dye tub or one that is not yet full and of the same color as the dye you are preparing."); from.SendGump(new CraftGump(from, craftSystem, tool, 0)); return; } else if (iFound == 1) { // once again if no target is required then we just let it fall through } else if (iFound > 1) { //ok in this case we found more than one valid tub so hand execution over to the target and end int resHue = 0; int maxAmount = 0; object message = null; from.SendMessage("Select the dye tub you wish to use for the process."); from.Target = new SpecialDyeTubTarget(this, typeRes, craftSystem, ref resHue, ref maxAmount, ref message, m_NameString, 0, tool); return; } } } // ----------------------------------------------------------------- / //This check is where skill is (possibly) gained! //PLA: 04/06/09 - Prevent skillgain from special tubs entirely if (!(craftSystem is DefAlchemy && (ItemType == typeof(SpecialDyeTub) || ItemType == typeof(SpecialDye)))) { CheckSkills(from, typeRes, craftSystem, ref ignored, ref allRequiredSkills); } if (quality >= 0) { // Resource int resHue = 0; int maxAmount = 0; object message = null; ConsumeType ct = ConsumeType.All; // erl: if this is special dye, forget about consumption for now // .. if (craftSystem is DefAlchemy && (ItemType == typeof(SpecialDyeTub) || ItemType == typeof(SpecialDye))) ct = ConsumeType.None; // .. // Not enough resource to craft it ha if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ct, ref message)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) from.SendGump(new CraftGump(from, craftSystem, tool, message)); else if (message is int && (int)message > 0) from.SendLocalizedMessage((int)message); else if (message is string) from.SendMessage((string)message); return; } if (!ConsumeAttributes(from, ref message, true)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) from.SendGump(new CraftGump(from, craftSystem, tool, message)); else if (message is int && (int)message > 0) from.SendLocalizedMessage((int)message); else if (message is string) from.SendMessage((string)message); return; } tool.UsesRemaining--; if (tool.UsesRemaining < 1) toolBroken = true; if (toolBroken) tool.Delete(); // Adam: this is it. Make the item Item item = Activator.CreateInstance(ItemType) as Item; bool bTinkerTrap = false; if (item != null) { // Adam: mark it as PlayerCrafted item.PlayerCrafted = true; if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; weapon.Quality = (WeaponQuality)quality; endquality = quality; if (makersMark) weapon.Crafter = from; // Adam: one day we can obsolete and and use item.PlayerCrafted // erl: 10 Nov 05: that day is today! // weapon.PlayerConstructed = true; /*if ( Core.AOS ) { Type resourceType = typeRes; if ( resourceType == null ) resourceType = Ressources.GetAt( 0 ).ItemType; weapon.Resource = CraftResources.GetFromType( resourceType ); CraftContext context = craftSystem.GetContext( from ); if ( context != null && context.DoNotColor ) weapon.Hue = 0; if ( tool is BaseRunicTool ) ((BaseRunicTool)tool).ApplyAttributesTo( weapon ); if ( quality == 2 ) { if ( weapon.Attributes.WeaponDamage > 35 ) weapon.Attributes.WeaponDamage -= 20; else weapon.Attributes.WeaponDamage = 15; } } else */ if (tool is BaseRunicTool) { Type resourceType = typeRes; if (resourceType == null) resourceType = Ressources.GetAt(0).ItemType; CraftResource thisResource = CraftResources.GetFromType(resourceType); if (thisResource == ((BaseRunicTool)tool).Resource) { weapon.Resource = thisResource; CraftContext context = craftSystem.GetContext(from); if (context != null && context.DoNotColor) weapon.Hue = 0; switch (thisResource) { case CraftResource.DullCopper: { weapon.Identified = true; weapon.DurabilityLevel = WeaponDurabilityLevel.Durable; weapon.AccuracyLevel = WeaponAccuracyLevel.Accurate; break; } case CraftResource.ShadowIron: { weapon.Identified = true; weapon.DurabilityLevel = WeaponDurabilityLevel.Durable; weapon.DamageLevel = WeaponDamageLevel.Ruin; break; } case CraftResource.Copper: { weapon.Identified = true; weapon.DurabilityLevel = WeaponDurabilityLevel.Fortified; weapon.DamageLevel = WeaponDamageLevel.Ruin; weapon.AccuracyLevel = WeaponAccuracyLevel.Surpassingly; break; } case CraftResource.Bronze: { weapon.Identified = true; weapon.DurabilityLevel = WeaponDurabilityLevel.Fortified; weapon.DamageLevel = WeaponDamageLevel.Might; weapon.AccuracyLevel = WeaponAccuracyLevel.Surpassingly; break; } case CraftResource.Gold: { weapon.Identified = true; weapon.DurabilityLevel = WeaponDurabilityLevel.Indestructible; weapon.DamageLevel = WeaponDamageLevel.Force; weapon.AccuracyLevel = WeaponAccuracyLevel.Eminently; break; } case CraftResource.Agapite: { weapon.Identified = true; weapon.DurabilityLevel = WeaponDurabilityLevel.Indestructible; weapon.DamageLevel = WeaponDamageLevel.Power; weapon.AccuracyLevel = WeaponAccuracyLevel.Eminently; break; } case CraftResource.Verite: { weapon.Identified = true; weapon.DurabilityLevel = WeaponDurabilityLevel.Indestructible; weapon.DamageLevel = WeaponDamageLevel.Power; weapon.AccuracyLevel = WeaponAccuracyLevel.Exceedingly; break; } case CraftResource.Valorite: { weapon.Identified = true; weapon.DurabilityLevel = WeaponDurabilityLevel.Indestructible; weapon.DamageLevel = WeaponDamageLevel.Vanq; weapon.AccuracyLevel = WeaponAccuracyLevel.Supremely; break; } } } } } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; armor.Quality = (ArmorQuality)quality; endquality = quality; if (makersMark) armor.Crafter = from; Type resourceType = typeRes; if (resourceType == null) resourceType = Ressources.GetAt(0).ItemType; armor.Resource = CraftResources.GetFromType(resourceType); // Adam: one day we can obsolete and and use item.PlayerCrafted // erl: 10 Nov 05: that day is today! // armor.PlayerConstructed = true; CraftContext context = craftSystem.GetContext(from); if (context != null && context.DoNotColor) armor.Hue = 0; if (quality == 2) armor.DistributeBonuses((tool is BaseRunicTool ? 6 : 14)); if (Core.AOS && tool is BaseRunicTool) ((BaseRunicTool)tool).ApplyAttributesTo(armor); } else if (item is FullBookcase || item is FullBookcase2 || item is FullBookcase3) { // Does it now become a ruined bookcase? 5% chance. if (Utility.RandomDouble() > 0.95) { from.SendMessage("You craft the bookcase, but it is ruined."); item.Delete(); item = new RuinedBookcase(); item.Movable = true; } else from.SendMessage("You finish the bookcase and fill it with books."); // Consume single charge from scribe pen... Item[] spens = ((Container)from.Backpack).FindItemsByType(typeof(ScribesPen), true); if (--((ScribesPen)spens[0]).UsesRemaining == 0) { from.SendMessage("You have worn out your tool!"); spens[0].Delete(); } } else if (item is DragonBardingDeed) { DragonBardingDeed deed = (DragonBardingDeed)item; deed.Exceptional = (quality >= 2); endquality = quality; if (makersMark) deed.Crafter = from; Type resourceType = typeRes; if (resourceType == null) resourceType = Ressources.GetAt(0).ItemType; deed.Resource = CraftResources.GetFromType(resourceType); CraftContext context = craftSystem.GetContext(from); if (context != null && context.DoNotColor) deed.Hue = 0; } else if (item is BaseInstrument) { BaseInstrument instrument = (BaseInstrument)item; instrument.Quality = (InstrumentQuality)quality; endquality = quality; if (makersMark) instrument.Crafter = from; } else if (item is BaseJewel) { BaseJewel jewel = (BaseJewel)item; Type resourceType = typeRes; endquality = quality; if (resourceType == null) resourceType = Ressources.GetAt(0).ItemType; jewel.Resource = CraftResources.GetFromType(resourceType); if (1 < Ressources.Count) { resourceType = Ressources.GetAt(1).ItemType; if (resourceType == typeof(StarSapphire)) jewel.GemType = GemType.StarSapphire; else if (resourceType == typeof(Emerald)) jewel.GemType = GemType.Emerald; else if (resourceType == typeof(Sapphire)) jewel.GemType = GemType.Sapphire; else if (resourceType == typeof(Ruby)) jewel.GemType = GemType.Ruby; else if (resourceType == typeof(Citrine)) jewel.GemType = GemType.Citrine; else if (resourceType == typeof(Amethyst)) jewel.GemType = GemType.Amethyst; else if (resourceType == typeof(Tourmaline)) jewel.GemType = GemType.Tourmaline; else if (resourceType == typeof(Amber)) jewel.GemType = GemType.Amber; else if (resourceType == typeof(Diamond)) jewel.GemType = GemType.Diamond; } if (makersMark) jewel.Crafter = from; jewel.Quality = (JewelQuality)quality; } else if (item is BaseClothing) { BaseClothing clothing = (BaseClothing)item; clothing.Quality = (ClothingQuality)quality; endquality = quality; if (makersMark) clothing.Crafter = from; // Adam: one day we can obsolete and and use item.PlayerCrafted // erl: 10 Nov 05: that day is today! // clothing.PlayerConstructed = true; if (item is BaseShoes) { BaseShoes shoes = (BaseShoes)item; if (shoes.Resource != CraftResource.None) { Type resourceType = typeRes; if (resourceType == null) resourceType = Ressources.GetAt(0).ItemType; shoes.Resource = CraftResources.GetFromType(resourceType); CraftContext context = craftSystem.GetContext(from); if (context != null && context.DoNotColor) shoes.Hue = 0; } else { shoes.Hue = resHue; } } else if ((item is BaseGloves) && (resHue == 0)) { clothing.Hue = 1001; // Rhi: The default color for cloth gloves should be white, // not the leather gloves color, which is what it will be if the hue is 0. } else { clothing.Hue = resHue; } // erl: give clothing initial hitpoint values // .. int iMax = clothing.InitMaxHits; int iMin = clothing.InitMinHits; if (clothing.Quality == ClothingQuality.Exceptional) { // Add 50% to both iMax = (iMax * 3) / 2; // Fixed order of precedence bug iMin = (iMin * 3) / 2; // make exceptional clothes newbied clothing.LootType = LootType.Newbied; } else if (clothing.Quality == ClothingQuality.Low) { // Lose 20% to both iMax = (iMax * 4) / 5; // Fixed order of precedence bug iMin = (iMin * 4) / 5; } clothing.HitPoints = clothing.MaxHitPoints = (short)Utility.RandomMinMax(iMin, iMax); // .. } else if (item is BaseTool || item is BaseHarvestTool && quality == 2) { endquality = quality; if (item is BaseTool) ((BaseTool)item).UsesRemaining *= 3; else ((BaseHarvestTool)item).UsesRemaining *= 3; } else if (item is MapItem) { ((MapItem)item).CraftInit(from); } else if (item is LockableContainer) { if (from.CheckSkill(SkillName.Tinkering, -5.0, 15.0)) { LockableContainer cont = (LockableContainer)item; from.SendLocalizedMessage(500636); // Your tinker skill was sufficient to make the item lockable. Key key = new Key(KeyType.Copper, Key.RandomValue()); cont.KeyValue = key.KeyValue; cont.DropItem(key); /* double tinkering = from.Skills[SkillName.Tinkering].Value; int level = (int)(tinkering * 0.8); cont.RequiredSkill = level - 4; cont.LockLevel = level - 14; cont.MaxLockLevel = level + 35; if ( cont.LockLevel == 0 ) cont.LockLevel = -1; else if ( cont.LockLevel > 95 ) cont.LockLevel = 95; if ( cont.RequiredSkill > 95 ) cont.RequiredSkill = 95; if ( cont.MaxLockLevel > 95 ) cont.MaxLockLevel = 95; Commented out by darva to try new tinker lock strength code.*/ double tinkering = from.Skills[SkillName.Tinkering].Value; int level = (int)(tinkering); cont.RequiredSkill = 36; if (level >= 65) cont.RequiredSkill = 76; if (level >= 80) cont.RequiredSkill = 84; if (level >= 90) cont.RequiredSkill = 92; if (level >= 100) cont.RequiredSkill = 100; cont.LockLevel = cont.RequiredSkill - 10; cont.MaxLockLevel = cont.RequiredSkill + 40; } else { from.SendLocalizedMessage(500637); // Your tinker skill was insufficient to make the item lockable. } } else if (item is Runebook) { int charges = 5 + quality + (int)(from.Skills[SkillName.Inscribe].Value / 30); endquality = quality; if (charges > 10) charges = 10; ((Runebook)item).MaxCharges = charges; if (makersMark) ((Runebook)item).Crafter = from; ((Runebook)item).Quality = (RunebookQuality)quality; } else if (item is Bola) { Bola b = (Bola)item; b.Quality = (WeaponQuality)quality; endquality = quality; if (makersMark) b.Crafter = from; } else if (item.Hue == 0) { item.Hue = resHue; } if (maxAmount > 0) item.Amount = maxAmount; // ********************************************** if (craftSystem is DefAlchemy && item is BasePotion) { BasePotion pot = (BasePotion)item; Container pack = from.Backpack; if (pack != null) { Item[] kegs = pack.FindItemsByType(typeof(PotionKeg), true); for (int i = 0; i < kegs.Length; ++i) { PotionKeg keg = kegs[i] as PotionKeg; if (keg == null) continue; if (keg.Held <= 0 || keg.Held >= 100) continue; if (keg.Type != pot.PotionEffect) continue; ++keg.Held; item.Delete(); item = new Bottle(); endquality = -1; // signal placed in keg break; } } } if (craftSystem is DefAlchemy && (item is SpecialDye || item is SpecialDyeTub)) { // Which special dye tub do we want to use? Item[] sdtubs = ((Container)from.Backpack).FindItemsByType(typeof(SpecialDyeTub), true); SpecialDyeTub sdtub; if (m_NameString == "> Darken the mix" || m_NameString == "> Lighten the mix" && sdtubs.Length > 0) { sdtub = (SpecialDyeTub)sdtubs[0]; if (sdtubs.Length > 1) { // Pla, 04/01/07 // This code will never be called now but left it in for sanity. // ----------------------------------------------------------------- // Let the target take over from here //from.Target = new SpecialDyeTubTarget( this, typeRes, craftSystem, ref resHue, ref maxAmount, ref message, ref item, m_NameString, (m_NameString == "> Darken the mix" ? 1 : 2) ); //from.SendMessage("Select the dye tub you wish to use for the process."); } else { int iConsume = 0; if (m_NameString == "> Darken the mix") { if (sdtub.DarkenMix()) { from.SendMessage("You darken the mix with black pearl..."); double dCalc = sdtub.Uses; dCalc /= 5; iConsume = ((int)dCalc) + 1; } else //pla: This will never happen now from.SendMessage("You attempt to darken the mix, but it will go no darker."); } else { if (sdtub.LightenMix()) { from.SendMessage("You lighten the mix with sulfurous ash..."); double dCalc = sdtub.Uses; dCalc /= 5; iConsume = ((int)dCalc) + 1; } else //pla: This will never happen now from.SendMessage("You attempt to lighten the mix, but it will go no lighter."); } for (int i = 0; i < iConsume; i++) ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message); from.PlaySound(0x242); } } else { // Make sure they've got a regular dye tub / a special one of the same color Item[] dtub = ((Container)from.Backpack).FindItemsByType(typeof(DyeTub), true); DyeTub dt = null; int iFound = 0; if (dtub.Length > 0) { for (int i = 0; i < dtub.Length; i++) { if (dtub[i] is SpecialDyeTub) { // Is the same color? if (((SpecialDyeTub)dtub[i]).StoredColorName == m_NameString && ((SpecialDyeTub)dtub[i]).Uses < 100 && !((SpecialDyeTub)dtub[i]).Prepped) { dt = (DyeTub)dtub[i]; iFound++; } continue; } else { dt = (DyeTub)dtub[i]; iFound++; } } } sdtub = (SpecialDyeTub)item; if (dt == null) { from.SendMessage("You need a fresh dye tub or one that is not yet full and of the same color as the dye you are preparing."); sdtub.Delete(); } else { if (iFound > 1) { // Pla, 04/01/07 // This code will never be called now but left it in for sanity // ----------------------------------------------------------------- // Let the target take over from here //from.Target = new SpecialDyeTubTarget( this, typeRes, craftSystem, ref resHue, ref maxAmount, ref message, ref item, m_NameString, 0 ); //from.SendMessage("Select the dye tub you wish to use for the process."); } else { if (dt is SpecialDyeTub) { sdtub.Delete(); ((SpecialDyeTub)dt).Uses++; from.SendMessage("You mix the dye and add it to an existing batch."); } else { sdtub.StoreColor(m_NameString); dt.Delete(); from.SendMessage("You successfully mix the dye."); from.AddToBackpack(item); } ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message); } } } } if (craftSystem is DefTinkering && item is BaseTinkerTrap) { //Need to send target cursor to target //the trappable container bTinkerTrap = true; int power = (int)from.Skills[SkillName.Tinkering].Value + Utility.Random(0, 15); if (power <= 10) power = 10; ((BaseTinkerTrap)item).Power = power; from.SendMessage("Target the container you wish to trap."); from.Target = new TrappableContainerTarget(this, item, craftSystem, toolBroken, tool); } if (!bTinkerTrap && (!(item is SpecialDyeTub || item is SpecialDye))) { from.AddToBackpack(item); } //from.PlaySound( 0x57 ); } if (!bTinkerTrap) { int num = craftSystem.PlayEndingEffect(from, false, true, toolBroken, endquality, makersMark, this); if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) from.SendGump(new CraftGump(from, craftSystem, tool, num)); else if (num > 0) from.SendLocalizedMessage(num); } } else if (!allRequiredSkills) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) from.SendGump(new CraftGump(from, craftSystem, tool, 1044153)); else from.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item. } else { ConsumeType consumeType = (UseAllRes ? ConsumeType.Fail : ConsumeType.Half); int resHue = 0; int maxAmount = 0; object message = null; // Not enough resource to craft it if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) from.SendGump(new CraftGump(from, craftSystem, tool, message)); else if (message is int && (int)message > 0) from.SendLocalizedMessage((int)message); else if (message is string) from.SendMessage((string)message); return; } tool.UsesRemaining--; if (tool.UsesRemaining < 1) toolBroken = true; if (toolBroken) tool.Delete(); // SkillCheck failed. int num = craftSystem.PlayEndingEffect(from, true, true, toolBroken, endquality, false, this); if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) from.SendGump(new CraftGump(from, craftSystem, tool, num)); else if (num > 0) from.SendLocalizedMessage(num); } }
public override void OnSpeech(SpeechEventArgs e) { #region Here is the list of Random Words you can use string dat_Facet = TalkingNPCsXMLReader.RandomName("dat_Facet"); string dat_TownRegion = TalkingNPCsXMLReader.RandomName("dat_TownRegion"); string dat_DungeonRegion = TalkingNPCsXMLReader.RandomName("dat_DungeonRegion"); string dat_NoHousingRegion = TalkingNPCsXMLReader.RandomName("dat_NoHousingRegion"); string dat_Other = TalkingNPCsXMLReader.RandomName("dat_Other"); string dat_Shrine = TalkingNPCsXMLReader.RandomName("dat_Shrine"); string dat_article1 = TalkingNPCsXMLReader.RandomName("dat_article"); string dat_article2 = TalkingNPCsXMLReader.RandomName("dat_article"); string dat_noun1 = TalkingNPCsXMLReader.RandomName("dat_noun"); string dat_noun2 = TalkingNPCsXMLReader.RandomName("dat_noun"); string dat_noun3 = TalkingNPCsXMLReader.RandomName("dat_noun"); string dat_noun4 = TalkingNPCsXMLReader.RandomName("dat_noun"); string dat_verb1 = TalkingNPCsXMLReader.RandomName("dat_verb"); string dat_verb2 = TalkingNPCsXMLReader.RandomName("dat_verb"); string dat_verbing1 = TalkingNPCsXMLReader.RandomName("dat_verbing"); string dat_verbing2 = TalkingNPCsXMLReader.RandomName("dat_verbing"); string dat_verb3rd1 = TalkingNPCsXMLReader.RandomName("dat_verb3rd"); string dat_verb3rd2 = TalkingNPCsXMLReader.RandomName("dat_verb3rd"); string dat_verbed1 = TalkingNPCsXMLReader.RandomName("dat_verbed"); string dat_verbed2 = TalkingNPCsXMLReader.RandomName("dat_verbed"); string dat_preposition1 = TalkingNPCsXMLReader.RandomName("dat_preposition"); string dat_preposition2 = TalkingNPCsXMLReader.RandomName("dat_preposition"); string dat_adj1 = TalkingNPCsXMLReader.RandomName("dat_adj"); string dat_adj2 = TalkingNPCsXMLReader.RandomName("dat_adj"); string dat_Greeting = TalkingNPCsXMLReader.RandomName("dat_Greeting"); string dat_Language1 = TalkingNPCsXMLReader.RandomName("dat_Language"); string dat_Language2 = TalkingNPCsXMLReader.RandomName("dat_Language"); string dat_Language3 = TalkingNPCsXMLReader.RandomName("dat_Language"); string dat_Armor = TalkingNPCsXMLReader.RandomName("dat_Armor"); string dat_Creature1 = TalkingNPCsXMLReader.RandomName("dat_Creature"); string dat_Creature2 = TalkingNPCsXMLReader.RandomName("dat_Creature"); string dat_Room1 = TalkingNPCsXMLReader.RandomName("dat_Room"); string dat_Room2 = TalkingNPCsXMLReader.RandomName("dat_Room"); string dat_Furniture1 = TalkingNPCsXMLReader.RandomName("dat_Furniture"); string dat_Furniture2 = TalkingNPCsXMLReader.RandomName("dat_Furniture"); string dat_Liquid1 = TalkingNPCsXMLReader.RandomName("dat_Liquid"); string dat_Number1 = TalkingNPCsXMLReader.RandomName("dat_Number"); string dat_PlayingCards = TalkingNPCsXMLReader.RandomName("dat_PlayingCards"); string dat_MinocShop = TalkingNPCsXMLReader.RandomName("dat_MinocShop"); string dat_MinocShopQuestItem = TalkingNPCsXMLReader.RandomName("dat_MinocShopQuestItem"); #endregion string playername = e.Mobile.Name; string speech = e.Speech.ToLower(); #region Player says "Hi" for (int i = 0; i < Greetings.Length; i++) if (speech == Greetings[i]) { switch (Utility.Random(4)) //picks one of the following { case 0: { Say(String.Format("{0} {1}, I am {2} a {3} do you want to assist?", dat_Greeting, playername, dat_verb1, dat_Creature1)); break; } case 1: { Say(String.Format("That {0} bottle. Oh, {1} {2}!", dat_adj1, dat_Greeting, playername)); break; } case 2: { Say(String.Format("{0}{1} are so..ah, uhm. {2} {3}", dat_adj1, dat_Creature1, dat_Greeting, playername)); break; } case 3: { Say(String.Format("{0} {1} {2}, AGH! My spell! {3} you are so distracting.", dat_Language1, dat_Language2, dat_Language3, playername)); break; } } } #endregion #region Player says "Yes" or some other response for (int i = 0; i < Response.Length; i++) if (speech == Response[i]) { if (m_ItemHasBeenReturned == true) { switch (Utility.Random(4)) //picks one of the following { case 0: { Say(String.Format("{0} help me find my {1} bottle. It should be around here somewhere, just hand it to me.", playername, dat_noun1)); break; } case 1: { dat_article1 = char.ToUpper(dat_article1[0]) + dat_article1.Substring(1); Say(String.Format("{0} somewhere around here I have a {1} bottle.", playername, dat_noun1)); break; } case 2: { dat_article1 = char.ToUpper(dat_article1[0]) + dat_article1.Substring(1); Say(String.Format("I am {0} a {1} potion and need my {2} bottle.", dat_verb1, dat_adj1, dat_noun1)); break; } case 3: { dat_article1 = char.ToUpper(dat_article1[0]) + dat_article1.Substring(1); Say(String.Format("Maybe some blood of {0} would work. No I need a bottle of {1}.", dat_Creature1, dat_noun1)); break; } } //Choose Item Location int x = Location.X + Utility.RandomMinMax(-5, 5); int y = Location.Y + Utility.RandomMinMax(-5, 5); int z = Map.GetAverageZ(x, y); if (Map.CanFit(x, y, Location.Z, 1)) { Item item = new Bottle(); item.Name = String.Format("{0} bottle", dat_noun1); item.MoveToWorld(new Point3D(x, y, Location.Z), Map); m_ItemHasBeenReturned = false; ProfessorItemTimer t = new ProfessorItemTimer(); t.Start(); } else if (Map.CanFit(x, y, z, 1)) { Item item = new Bottle(); item.Name = String.Format("{0} bottle", dat_noun1); item.MoveToWorld(new Point3D(x, y, z), Map); m_ItemHasBeenReturned = false; ProfessorItemTimer t = new ProfessorItemTimer(); t.Start(); } } else { Say(String.Format("A bottle, {0} or {1}. Hurry any bottle will due!", dat_adj1, dat_noun1)); } } #endregion }
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 targ ) { if ( targ is BaseMeleeWeapon ) { BaseMeleeWeapon weapon = targ as BaseMeleeWeapon; OilAttachment attachment = XmlAttach.FindAttachment( weapon, typeof( OilAttachment ) ) as OilAttachment; if ( weapon.RootParent != from ) from.SendMessage( "The item must be in your pack." ); else if ( attachment != null ) from.SendMessage( "There's already oil present on that weapon. Remove it with an oil cloth first." ); else { attachment = new OilAttachment( m_Potion.Effects, m_Potion.Duration, m_Potion.Corrosivity ); XmlAttach.AttachTo( weapon, attachment ); from.PlaySound( 0x4F ); Bottle emptybottle = new Bottle(); from.AddToBackpack( emptybottle ); m_Potion.Consume( 1 ); from.SendMessage( "You apply the oil onto the weapon." ); } } else from.SendMessage( "You cannot apply oil to that." ); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Item.Deleted) { return; } PlantPigment pigment = targeted as PlantPigment; if (null == pigment) { from.SendLocalizedMessage(1112124); // You may only mix this with another non-saturated plant pigment. return; } if (from.Skills[SkillName.Alchemy].Base < 75.0 && from.Skills[SkillName.Cooking].Base < 75.0) { from.SendLocalizedMessage(1112214); // You lack the alchemy or cooking skills to mix plant pigments. } else if ((PlantPigmentHue.White == pigment.PigmentHue || PlantPigmentHue.Black == pigment.PigmentHue || PlantPigmentHue.White == m_Item.PigmentHue || PlantPigmentHue.Black == m_Item.PigmentHue) && from.Skills[SkillName.Alchemy].Base < 100.0 && from.Skills[SkillName.Cooking].Base < 100.0) { from.SendLocalizedMessage(1112213); // You lack the alchemy or cooking skills to mix so unstable a pigment. } else if (m_Item.PigmentHue == pigment.PigmentHue) { from.SendLocalizedMessage(1112242); // You decide not to waste pigments by mixing two identical colors. } else if ((m_Item.PigmentHue & ~(PlantPigmentHue.Bright | PlantPigmentHue.Dark | PlantPigmentHue.Ice)) == (pigment.PigmentHue & ~(PlantPigmentHue.Bright | PlantPigmentHue.Dark | PlantPigmentHue.Ice))) { from.SendLocalizedMessage(1112243); // You decide not to waste pigments by mixing variations of the same hue. } else if ((PlantPigmentHue.White == m_Item.PigmentHue && PlantPigmentHueInfo.IsBright(pigment.PigmentHue)) || (PlantPigmentHue.White == pigment.PigmentHue && PlantPigmentHueInfo.IsBright(m_Item.PigmentHue))) { from.SendLocalizedMessage(1112241); // This pigment is too diluted to be faded further. } else if (!PlantPigmentHueInfo.IsMixable(pigment.PigmentHue)) { from.SendLocalizedMessage(1112125); // This pigment is saturated and cannot be mixed further. } else { PlantPigmentHue newHue = PlantPigmentHueInfo.Mix(m_Item.PigmentHue, pigment.PigmentHue); if (PlantPigmentHue.None == newHue) { from.SendLocalizedMessage(1112125); // This pigment is saturated and cannot be mixed further. } else { pigment.PigmentHue = newHue; Bottle bottle = new Bottle(); bottle.MoveToWorld(m_Item.Location, m_Item.Map); m_Item.Delete(); from.PlaySound(0x240); } } }
protected override void OnTarget( Mobile from, object targ ) { Item item = targ as Item; if ( item == null ) { from.SendMessage( "You cannot poison that." ); return; } if ( item.RootParent != from ) { from.SendMessage( "The item must be in your pack." ); return; } OilAttachment attachment = XmlAttach.FindAttachment( item, typeof( OilAttachment ) ) as OilAttachment; PoisonedFoodAttachment attachment2 = XmlAttach.FindAttachment( item, typeof( PoisonedFoodAttachment ) ) as PoisonedFoodAttachment; if ( attachment != null || attachment2 != null ) { if ( item is BaseMeleeWeapon ) from.SendMessage( "There's some substance present on that weapon already. Remove it with an oil cloth first." ); else from.SendMessage( "There's some poisonous substance present on that item already." ); return; } // passed all basic checks, now see what they're applying it to double skill = Math.Max( from.Skills[SkillName.Poisoning].Value, 0.1 ); int actualOilDuration = (int)((skill/100.0) * m_Potion.m_Duration); ToxinAttachment toxAtt = new ToxinAttachment( m_Potion.Effects, m_Potion.PoisonDuration, m_Potion.ActingSpeed, actualOilDuration, m_Potion.Corrosivity ); if ( (targ is BaseAxe || targ is BaseKnife || targ is BasePoleArm || targ is BaseSword || targ is BaseSpear) && !(targ is AzhuranBoomerang) ) { XmlAttach.AttachTo( targ, toxAtt ); from.PlaySound( 0x4F ); Bottle emptybottle = new Bottle(); from.AddToBackpack( emptybottle ); m_Potion.Consume( 1 ); from.SendMessage( "You apply the toxin onto the weapon." ); } else if ( targ is Food || targ is BaseBeverage || targ is DrinkPotion || targ is AzhuranBlowGun ) { if( targ is AzhuranBlowGun && ( (AzhuranBlowGun)targ ).UsesRemaining < 1 ) { from.SendMessage( "You cannot poison an empty blowgun." ); return; } attachment2 = new PoisonedFoodAttachment( m_Potion.Effects, m_Potion.PoisonDuration, m_Potion.ActingSpeed, from ); from.PlaySound( 0x4F ); XmlAttach.AttachTo( item, attachment2 ); from.SendMessage( "You apply the poison." ); Bottle emptybottle = new Bottle(); from.AddToBackpack( emptybottle ); m_Potion.Consume( 1 ); } else from.SendMessage( "You cannot poison that." ); }
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 override void Drink( Mobile from ) { bool candrink = false; foreach ( KeyValuePair<CustomEffect, int> kvp in Effects ) // if none of the effects can be applied, the potion won't be drank { if ( kvp.Value > 0 ) // only effects count, not side-effects { CustomPotionEffect effect = CustomPotionEffect.GetEffect( kvp.Key ); if ( effect != null ) { candrink = effect.CanDrink( from ); if ( candrink == true ) break; } } } if ( !candrink ) from.SendMessage( "Drinking this potion would yield no effect in your current state." ); else { PoisonedFoodAttachment attachment = XmlAttach.FindAttachment( this, typeof( PoisonedFoodAttachment ) ) as PoisonedFoodAttachment; if ( attachment != null ) attachment.OnConsumed( from ); foreach ( KeyValuePair<CustomEffect, int> kvp in Effects ) { CustomPotionEffect effect = CustomPotionEffect.GetEffect( kvp.Key ); if ( effect != null ) effect.ApplyEffect( from, from, kvp.Value, this ); } from.RevealingAction(); from.PlaySound( 0x2D6 ); Bottle emptybottle = new Bottle(); from.AddToBackpack( emptybottle ); if ( from.Body.IsHuman ) from.Animate( 34, 5, 1, true, false, 0 ); this.Consume( 1 ); } }