public void Fire( Mobile from ) { BaseRanged bow = from.Weapon as BaseRanged; if ( bow == null ) { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this.")); //from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You must practice with ranged weapons on this."); //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } if ( DateTime.Now < (m_LastUse + UseDelay) ) return; Point3D worldLoc = GetWorldLocation(); if ( FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You would do better to stand in front of the archery butte." ); // You would do better to stand in front of the archery butte. return; } if ( FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You aren't properly lined up with the archery butte to get an accurate shot." ); // You aren't properly lined up with the archery butte to get an accurate shot. return; } if ( !from.InRange( worldLoc, 6 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You are too far away from the archery butte to get an accurate shot." ); // You are too far away from the archery butte to get an accurate shot. return; } else if ( from.InRange( worldLoc, 4 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You are too close to the target." ); // You are too close to the target. return; } Container pack = from.Backpack; Type ammoType = bow.AmmoType; bool isArrow = ( ammoType == typeof( Arrow ) ); bool isBolt = ( ammoType == typeof( Bolt ) ); bool isKnown = ( isArrow || isBolt ); if ( pack == null || !pack.ConsumeTotal( ammoType, 1 ) ) { if ( isArrow ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You do not have any arrows with which to practice." ); // You do not have any arrows with which to practice. else if ( isBolt ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You do not have any crossbow bolts with which to practice." ); // You do not have any crossbow bolts with which to practice. else from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this.")); //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } m_LastUse = DateTime.Now; from.Direction = from.GetDirectionTo( GetWorldLocation() ); bow.PlaySwingAnimation( from ); from.MovingEffect( this, bow.EffectID, 18, 1, false, false ); ScoreEntry se = GetEntryFor( from ); if ( !from.CheckSkill( bow.Skill, m_MinSkill, m_MaxSkill ) ) { from.PlaySound( bow.MissSound ); PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} misses the target altogether.", from.Name)); //PublicOverheadMessage( MessageType.Regular, 0x3B2, 500604, from.Name ); // You miss the target altogether. se.Record( 0 ); if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.",se.Total.ToString() )); else PublicOverheadMessage( MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count));//1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); if (0.4 >= Utility.RandomDouble()) { if (isArrow) { Item Ammo = new Arrow(); Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map); } else if (isBolt) { Item Ammo = new Bolt(); Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map); } } return; } Effects.PlaySound( Location, Map, /*0x2B1*/ 564 ); double rand = Utility.RandomDouble(); int area, score, splitScore; if ( 0.10 > rand ) { area = 0; // bullseye score = 50; splitScore = 100; } else if ( 0.25 > rand ) { area = 1; // inner ring score = 10; splitScore = 20; } else if ( 0.50 > rand ) { area = 2; // middle ring score = 5; splitScore = 15; } else { area = 3; // outer ring score = 2; splitScore = 5; } bool split = ( isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble() ); if ( split ) { if (isArrow) { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the outer ring.", from.Name)); break; } } else { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the outer ring.", from.Name)); break; } } //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010027 + (isArrow ? 0 : 4) + area, from.Name ); } else { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the outer ring.", from.Name)); break; } //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010035 + area, from.Name ); if ( isArrow ) ++m_Arrows; else if ( isBolt ) ++m_Bolts; } se.Record( split ? splitScore : score ); /*if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() ); else PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) );*/ if (se.Count == 1) PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.", se.Total.ToString())); else PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count));//1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); }
public void OnChop(Mobile from) { if (from.InRange(this.GetWorldLocation(), 2)) { Effects.SendLocationEffect(Location, Map, 0x3728, 20, 10); //smoke or dust Effects.PlaySound(Location, Map, 0x11C); switch (Utility.Random(25)) { case 0: Effects.SendLocationEffect(from, from.Map, 0x113A, 20, 10); // Poison Player from.PlaySound(0x231); from.ApplyPoison(from, Poison.Lesser); break; case 1: Effects.SendLocationEffect(from, from.Map, 0x3709, 30); // Burn Player from.PlaySound(0x54); AOS.Damage(from, from, Utility.RandomMinMax(2, 5), 0, 100, 0, 0, 0); break; case 2: new BarrelLid().MoveToWorld(Location, Map); new BarrelHoops().MoveToWorld(Location, Map); break; case 3: Bandage b = new Bandage(Utility.RandomMinMax(5, 10)); b.MoveToWorld(Location, Map); break; case 4: new BarrelStaves().MoveToWorld(Location, Map); new BarrelHoops().MoveToWorld(Location, Map); break; case 5: Gold g = new Gold(Utility.RandomMinMax(25, 50)); g.MoveToWorld(Location, Map); break; case 6: new AgilityPotion().MoveToWorld(Location, Map); break; case 7: new LesserCurePotion().MoveToWorld(Location, Map); break; case 8: new LesserExplosionPotion().MoveToWorld(Location, Map); break; case 9: new LesserHealPotion().MoveToWorld(Location, Map); break; case 10: new LesserLightningPotion().MoveToWorld(Location, Map); break; case 11: new LesserManaPotion().MoveToWorld(Location, Map); break; case 12: new MindPotion().MoveToWorld(Location, Map); break; case 13: new LesserPoisonPotion().MoveToWorld(Location, Map); break; case 14: new LesserShatterPotion().MoveToWorld(Location, Map); break; case 15: new StrengthPotion().MoveToWorld(Location, Map); break; case 16: new LesserToxicPotion().MoveToWorld(Location, Map); break; case 17: Arrow arrow = new Arrow(Utility.RandomMinMax(5, 25)); arrow.MoveToWorld(Location, Map); break; case 18: Bolt bolt = new Bolt(Utility.RandomMinMax(5, 25)); bolt.MoveToWorld(Location, Map); break; case 19: IronIngot ii = new IronIngot(Utility.RandomMinMax(5, 25)); ii.MoveToWorld(Location, Map); break; case 20: Leather leather = new Leather(Utility.RandomMinMax(5, 25)); leather.MoveToWorld(Location, Map); break; case 21: Log log = new Log(Utility.RandomMinMax(5, 25)); log.MoveToWorld(Location, Map); break; case 22: BoltOfCloth boc = new BoltOfCloth(Utility.RandomMinMax(1, 25)); boc.MoveToWorld(Location, Map); break; case 23: SpidersSilk spiderssilk = new SpidersSilk(Utility.RandomMinMax(5, 25)); spiderssilk.MoveToWorld(Location, Map); break; case 24: SulfurousAsh sulfurousash = new SulfurousAsh(Utility.RandomMinMax(1, 25)); sulfurousash.MoveToWorld(Location, Map); break; } Destroy(); } else { from.SendLocalizedMessage(500446); // That is too far away. } }
public void Fire(Mobile from) { BaseRanged bow = from.Weapon as BaseRanged; if (bow == null) { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this.")); //from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You must practice with ranged weapons on this."); //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } if (DateTime.Now < (m_LastUse + UseDelay)) { return; } Point3D worldLoc = GetWorldLocation(); if (FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You would do better to stand in front of the archery butte."); // You would do better to stand in front of the archery butte. return; } if (FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You aren't properly lined up with the archery butte to get an accurate shot."); // You aren't properly lined up with the archery butte to get an accurate shot. return; } if (!from.InRange(worldLoc, 6)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You are too far away from the archery butte to get an accurate shot."); // You are too far away from the archery butte to get an accurate shot. return; } else if (from.InRange(worldLoc, 4)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You are too close to the target."); // You are too close to the target. return; } Container pack = from.Backpack; Type ammoType = bow.AmmoType; bool isArrow = (ammoType == typeof(Arrow)); bool isBolt = (ammoType == typeof(Bolt)); bool isKnown = (isArrow || isBolt); if (pack == null || !pack.ConsumeTotal(ammoType, 1)) { if (isArrow) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You do not have any arrows with which to practice."); // You do not have any arrows with which to practice. } else if (isBolt) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You do not have any crossbow bolts with which to practice."); // You do not have any crossbow bolts with which to practice. } else { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this.")); } //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } m_LastUse = DateTime.Now; from.Direction = from.GetDirectionTo(GetWorldLocation()); bow.PlaySwingAnimation(from); from.MovingEffect(this, bow.EffectID, 18, 1, false, false); ScoreEntry se = GetEntryFor(from); if (!from.CheckSkill(bow.Skill, m_MinSkill, m_MaxSkill)) { from.PlaySound(bow.MissSound); PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} misses the target altogether.", from.Name)); //PublicOverheadMessage( MessageType.Regular, 0x3B2, 500604, from.Name ); // You miss the target altogether. se.Record(0); if (se.Count == 1) { PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.", se.Total.ToString())); } else { PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count)); //1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); } if (0.4 >= Utility.RandomDouble()) { if (isArrow) { Item Ammo = new Arrow(); Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map); } else if (isBolt) { Item Ammo = new Bolt(); Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map); } } return; } Effects.PlaySound(Location, Map, /*0x2B1*/ 564); double rand = Utility.RandomDouble(); int area, score, splitScore; if (0.10 > rand) { area = 0; // bullseye score = 50; splitScore = 100; } else if (0.25 > rand) { area = 1; // inner ring score = 10; splitScore = 20; } else if (0.50 > rand) { area = 2; // middle ring score = 5; splitScore = 15; } else { area = 3; // outer ring score = 2; splitScore = 5; } bool split = (isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble()); if (split) { if (isArrow) { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the outer ring.", from.Name)); break; } } else { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the outer ring.", from.Name)); break; } } //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010027 + (isArrow ? 0 : 4) + area, from.Name ); } else { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the outer ring.", from.Name)); break; } //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010035 + area, from.Name ); if (isArrow) { ++m_Arrows; } else if (isBolt) { ++m_Bolts; } } se.Record(split ? splitScore : score); /*if ( se.Count == 1 ) * PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() ); * else * PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) );*/ if (se.Count == 1) { PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.", se.Total.ToString())); } else { PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count));//1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); } }