protected override void OnTick() { if (cycles == 15) { new MovingEffectInfo(new Point3D(corpse.X, corpse.Y, 100), corpse, corpse.Map, 3823, 0, 10, EffectRender.Lighten) .MovingImpact( e => { int amount = Utility.RandomMinMax(200, 400); if (amount <= 0) { return; } var g = new Gold(amount); g.MoveToWorld(e.Target.Location, e.Map); new EffectInfo(e.Target, e.Map, 14202, 51, 10, 40, EffectRender.Lighten).Send(); Effects.PlaySound(e.Target, e.Map, g.GetDropSound()); }); Stop(); return; } if (count == 9) { count = 1; cycles++; } corpse.Hue = Utility.RandomBrightHue(); corpse.Direction = (Direction)count; count++; }
protected override void OnTick() { Container theirPack = m_Target.Backpack; double badKarmaChance = 0.5 - ((double)m_From.Karma / 8570); if ( theirPack == null ) { m_From.SendLocalizedMessage( 500404 ); // They seem unwilling to give you any money. } else if ( m_From.Karma < 0 && badKarmaChance > Utility.RandomDouble() ) { m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500406 ); // Thou dost not look trustworthy... no gold for thee today! } else if ( m_From.CheckTargetSkill( SkillName.Begging, m_Target, 0.0, 100.0 ) ) { int toConsume = theirPack.GetAmount( typeof( Gold ) ) / 10; int max = 10 + (m_From.Fame / 2500); if ( max > 14 ) max = 14; else if ( max < 10 ) max = 10; if ( toConsume > max ) toConsume = max; if ( toConsume > 0 ) { int consumed = theirPack.ConsumeUpTo( typeof( Gold ), toConsume ); if ( consumed > 0 ) { m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500405 ); // I feel sorry for thee... Gold gold = new Gold( consumed ); m_From.AddToBackpack( gold ); m_From.PlaySound( gold.GetDropSound() ); if ( m_From.Karma > -3000 ) { int toLose = m_From.Karma + 3000; if ( toLose > 40 ) toLose = 40; Titles.AwardKarma( m_From, -toLose, true ); } } else { m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500407 ); // I have not enough money to give thee any! } } else { m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500407 ); // I have not enough money to give thee any! } } else { m_Target.SendLocalizedMessage( 500404 ); // They seem unwilling to give you any money. } m_From.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 ); }
protected override void OnTick() { Container theirPack = m_Target.Backpack; if (theirPack == null || ( m_Target is Mobiles.BaseCreature && ((Mobiles.BaseCreature)m_Target).FightMode == Server.Mobiles.FightMode.Closest ) ) { m_From.SendLocalizedMessage(500404); // They seem unwilling to give you any money. } else if ((m_From.Karma < 0 && 0.5 > Utility.RandomDouble()) || m_From.Criminal) { m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500406); // Thou dost not look trustworthy... no gold for thee today! } else if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0.0, 100.0)) { int totalGold = theirPack.GetAmount(typeof(Gold)); if (totalGold >= 25) { int toConsume = (int)(totalGold * m_From.Skills[SkillName.Begging].Value / 1000.0 * Utility.RandomDouble()); if (toConsume <= 0) toConsume = 1; toConsume = theirPack.ConsumeUpTo(typeof(Gold), toConsume); if (toConsume > 0) { m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500405); // I feel sorry for thee... Gold gold = new Gold(toConsume); m_From.AddToBackpack(gold); m_From.PlaySound(gold.GetDropSound()); if (m_From.Karma > -3000) { int toLose = m_From.Karma + 3000; if (toLose > 40) toLose = 40; Titles.AwardKarma(m_From, -toLose, true); } } else { m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407); // I have not enough money to give thee any! } } else { m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407); // I have not enough money to give thee any! } } else { m_Target.SendLocalizedMessage(500404); // They seem unwilling to give you any money. } m_From.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0); }
protected override void OnTick() { if (cycles == 15) { new MovingEffectInfo(new Point3D(corpse.X, corpse.Y, 100), corpse, corpse.Map, 3823, 0, 10, EffectRender.Lighten) .MovingImpact( e => { int amount = Utility.RandomMinMax(200, 400); if (amount <= 0) { return; } var g = new Gold(amount); g.MoveToWorld(e.Target.Location, e.Map); new EffectInfo(e.Target, e.Map, 14202, 51, 10, 40, EffectRender.Lighten).Send(); Effects.PlaySound(e.Target, e.Map, g.GetDropSound()); }); Stop(); return; } if (count == 9) { count = 1; cycles++; } corpse.Hue = Utility.RandomBrightHue(); corpse.Direction = (Direction) count; count++; }
public static void EndGoldExplosion( ExplodeFX fx, Point3D center, Map map, int range, int minGold, int maxGold, int[] dropSounds = null) { BaseExplodeEffect efx = fx.CreateInstance(center, map, range); if (efx == null) { return; } efx.AverageZ = false; efx.Callback = () => { var points = new List<Point3D>(); center.ScanRange( map, range, r => { if (!r.Excluded) { if (r.QueryMap.CanFit(r.Current, 1, false, false) || r.QueryMap.HasWater(r.Current)) { points.Add(r.Current); } else { r.Exclude(); } } return false; }); if (points.Count == 0) { return; } dropSounds = dropSounds ?? new[] {553, 554}; Timer goldTimer = null; goldTimer = Timer.DelayCall( TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(100), points.Count, () => { if (points.Count == 0) { if (goldTimer != null) { goldTimer.Running = false; goldTimer = null; } return; } Point3D p = points.GetRandom(); points.Remove(p); Effects.PlaySound(p, map, dropSounds.GetRandom()); new MovingEffectInfo(p.Clone3D(0, 0, Utility.RandomMinMax(30, 50)), p, map, 3823, 0, 10, EffectRender.Lighten) .MovingImpact( e => { int amount = Utility.RandomMinMax(minGold, maxGold); if (amount <= 0) { return; } var g = new Gold(amount); g.MoveToWorld(e.Target.Location, e.Map); new EffectInfo(e.Target, e.Map, 14202, 51, 10, 40, EffectRender.Lighten).Send(); Effects.PlaySound(e.Target, e.Map, g.GetDropSound()); }); }); }; efx.Send(); }
protected override void OnTick() { Container theirPack = m_Target.Backpack; if ( theirPack == null ) { m_From.SendLocalizedMessage( 500404 ); // They seem unwilling to give you any money. } else if ( ( m_From.Karma < 0 && 0.5 > Utility.RandomDouble() ) || m_From.Criminal ) { m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500406 ); // Thou dost not look trustworthy... no gold for thee today! } else if ( m_From.CheckTargetSkill( SkillName.Begging, m_Target, 0.0, 100.0 ) ) { int totalGold = theirPack.GetAmount( typeof( Gold ) ); if ( totalGold >= 25 ) { int toConsume = (int)(totalGold * m_From.Skills[SkillName.Begging].Value / 100.0); if ( toConsume <= 0 ) toConsume = 1; toConsume = theirPack.ConsumeUpTo( typeof( Gold ), toConsume ); if ( toConsume > 0 ) { m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500405 ); // I feel sorry for thee... Gold gold = new Gold( toConsume ); m_From.AddToBackpack( gold ); m_From.PlaySound( gold.GetDropSound() ); Titles.AlterNotoriety( m_From, -1, NotoCap.Dishonorable ); } else { m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500407 ); // I have not enough money to give thee any! } } else { m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500407 ); // I have not enough money to give thee any! } } else { m_Target.SendLocalizedMessage( 500404 ); // They seem unwilling to give you any money. } m_From.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 ); }
protected override void OnTick() { Container theirPack = m_Target.Backpack; double badKarmaChance = 0.5 - ( (double) m_From.Karma / 8570 ); if ( theirPack == null ) { m_From.SendLocalizedMessage( 500404 ); // They seem unwilling to give you any money. } else if ( m_From.Karma < 0 && badKarmaChance > Utility.RandomDouble() ) { m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500406 ); // Thou dost not look trustworthy... no gold for thee today! } else if ( m_From.CheckTargetSkill( SkillName.Begging, m_Target, 0.0, 100.0 ) ) { if ( m_Target.Race == Race.Elf ) { Item item = null; string name = string.Empty; double random = Utility.RandomDouble(); if ( 0.01 > random ) { switch ( Utility.RandomMinMax( 1, 8 ) ) { case 1: item = new Begging_Bedroll(); name = "a bedroll."; break; case 2: item = new Begging_CookieMix(); name = "a plate of cookies."; break; case 3: item = new Begging_FishingPole(); name = "a fishing pole."; break; case 4: item = new Begging_FishSteak(); name = "a fish steak."; break; case 5: item = new Begging_FlowerGarland(); name = "a flower garland."; break; case 6: item = new Begging_PitcherOfWine1(); name = "a pitcher of wine."; break; case 7: item = new Begging_PitcherOfWine2(); name = "a pitcher of wine."; break; case 8: item = new Begging_Sake(); name = "a bottle of sake."; break; case 9: item = new Begging_Turnip(); name = "a turnip."; break; } } else if ( 0.24 > random ) { switch ( Utility.RandomMinMax( 1, 8 ) ) { case 1: item = new Begging_BowlOfStew(); name = "a bowl of stew."; break; case 2: item = new Begging_CheeseWedge(); name = "a wedge of cheese."; break; case 3: item = new Begging_Dates(); name = "a bunch of dates."; break; case 4: item = new Begging_Lantern(); name = "a lantern."; break; case 5: item = new Begging_PitcherOfLiquor1(); name = "a pitcher of liquor."; break; case 6: item = new Begging_PitcherOfLiquor2(); name = "a pitcher of liquor."; break; case 7: item = new Begging_Shirt(); name = "a shirt."; break; case 8: item = new Begging_Pizza(); name = "a pizza."; break; } } else { switch ( Utility.RandomMinMax( 1, 3 ) ) { case 1: item = new Begging_FrenchBread(); name = "a french bread."; break; case 2: item = new Begging_PitcherOfWater1(); name = "a pitcher of water."; break; case 3: item = new Begging_PitcherOfWater2(); name = "a pitcher of water."; break; } } m_Target.Say( 1074854 ); // Here, take this... m_From.AddToBackpack( item ); m_From.SendLocalizedMessage( 1074853, name ); // You have been given ~1_name~ if ( m_From.Karma > -3000 ) { int toLose = m_From.Karma + 3000; Utility.FixMax( ref toLose, 40 ); Titles.AwardKarma( m_From, -toLose, true ); } } else { int toConsume = theirPack.GetAmount( typeof( Gold ) ) / 10; int max = 10 + ( m_From.Fame / 2500 ); Utility.FixMinMax( ref max, 10, 14 ); Utility.FixMax( ref toConsume, max ); if ( toConsume > 0 ) { int consumed = theirPack.ConsumeUpTo( typeof( Gold ), toConsume ); if ( consumed > 0 ) { m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500405 ); // I feel sorry for thee... Gold gold = new Gold( consumed ); m_From.AddToBackpack( gold ); m_From.PlaySound( gold.GetDropSound() ); if ( m_From.Karma > -3000 ) { int toLose = m_From.Karma + 3000; Utility.FixMax( ref toLose, 40 ); Titles.AwardKarma( m_From, -toLose, true ); } } else { m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500407 ); // I have not enough money to give thee any! } } else { m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500407 ); // I have not enough money to give thee any! } } } else { m_Target.SendLocalizedMessage( 500404 ); // They seem unwilling to give you any money. } m_From.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 ); }
protected override void OnTick() { Container theirPack = m_Target.Backpack; double badKarmaChance = 0.5 - ((double)m_From.Karma / 8570); if (theirPack == null && m_Target.Race != Race.Elf) { m_From.SendLocalizedMessage(500404); // They seem unwilling to give you any money. } else if (m_From.Karma < 0 && badKarmaChance > Utility.RandomDouble()) { m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500406); // Thou dost not look trustworthy... no gold for thee today! } else if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0.0, 100.0)) { if (m_Target.Race != Race.Elf) { int toConsume = theirPack.GetAmount(typeof(Gold)) / 10; int max = 10 + (m_From.Fame / 2500); if (max > 14) { max = 14; } else if (max < 10) { max = 10; } if (toConsume > max) { toConsume = max; } if (toConsume > 0) { int consumed = theirPack.ConsumeUpTo(typeof(Gold), toConsume); if (consumed > 0) { m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500405); // I feel sorry for thee... Gold gold = new Gold(consumed); m_From.AddToBackpack(gold); m_From.PlaySound(gold.GetDropSound()); if (m_From.Karma > -3000) { int toLose = m_From.Karma + 3000; if (toLose > 40) { toLose = 40; } Titles.AwardKarma(m_From, -toLose, true); } } else { m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407); // I have not enough money to give thee any! } } else { m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407); // I have not enough money to give thee any! } } else { double chance = Utility.RandomDouble(); Item reward = new Gold(1); string rewardName = ""; if (chance >= .99) { int rand = Utility.Random(8); if (rand == 0) { reward = new BegBedRoll(); rewardName = "a bedroll"; } else if (rand == 1) { reward = new BegCookies(); rewardName = "a plate of cookies."; } else if (rand == 2) { reward = new BegFishSteak(); rewardName = "a fish steak."; } else if (rand == 3) { reward = new BegFishingPole(); rewardName = "a fishing pole."; } else if (rand == 4) { reward = new BegFlowerGarland(); rewardName = "a flower garland."; } else if (rand == 5) { reward = new BegSake(); rewardName = "a bottle of Sake."; } else if (rand == 6) { reward = new BegTurnip(); rewardName = "a turnip."; } else if (rand == 7) { reward = new BegWine(); rewardName = "a Bottle of wine."; } else if (rand == 8) { reward = new BegWinePitcher(); rewardName = "a Pitcher of wine."; } } else if (chance >= .76) { int rand = Utility.Random(6); if (rand == 0) { reward = new BegStew(); rewardName = "a bowl of stew."; } else if (rand == 1) { reward = new BegCheeseWedge(); rewardName = "a wedge of cheese."; } else if (rand == 2) { reward = new BegDates(); rewardName = "a bunch of dates."; } else if (rand == 3) { reward = new BegLantern(); rewardName = "a lantern."; } else if (rand == 4) { reward = new BegLiquorPitcher(); rewardName = "a Pitcher of liquor"; } else if (rand == 5) { reward = new BegPizza(); rewardName = "pizza"; } else if (rand == 6) { reward = new BegShirt(); rewardName = "a shirt."; } } else if (chance >= .25) { int rand = Utility.Random(1); if (rand == 0) { reward = new BegFrenchBread(); rewardName = "french bread."; } else { reward = new BegWaterPitcher(); rewardName = "a Pitcher of water."; } } m_Target.Say(1074854); // Here, take this... m_From.AddToBackpack(reward); m_From.SendLocalizedMessage(1074853, rewardName); // You have been given ~1_name~ if (m_From.Karma > -3000) { int toLose = m_From.Karma + 3000; if (toLose > 40) { toLose = 40; } Titles.AwardKarma(m_From, -toLose, true); } } } else { m_Target.SendLocalizedMessage(500404); // They seem unwilling to give you any money. } m_From.NextSkillTime = Core.TickCount + 10000; }
public static bool Gold(Mobile from, Item item) { if (item is Gold) { Party party = Party.Get(from); if (party != null) { int dividedGold = item.Amount / party.Members.Count; if (dividedGold > 0) { item.Delete(); for (int j = 0; j < party.Members.Count; j++) { PartyMemberInfo info = party.Members[j] as PartyMemberInfo; if (info != null && info.Mobile != null && info.Mobile is PlayerMobile) { PlayerMobile pm = info.Mobile as PlayerMobile; if (pm.Backpack != null) { if (pm != from) { pm.SendMessage("{0} takes gold from the corpse and divides equally among the party members: {1} for each.", from.Name, dividedGold); } else { pm.SendMessage("You take gold from the corpse and divide equally among the party members: {0} for each.", dividedGold); } Item playerGold = pm.Backpack.FindItemByType(typeof(Gold)); Gold gold = new Gold(dividedGold); if (playerGold != null) { playerGold.Amount += gold.Amount; } else { pm.Backpack.AddItem(gold); } if (pm != from && WeightOverloading.IsOverloaded(pm)) { pm.SendMessage("{0} keeps your share, cause you are overloaded.", from.Name); from.SendMessage("You keep {0}'s share, who is overloaded.", pm.Name); Item goldAdded = pm.Backpack.FindItemByType(typeof(Gold)); goldAdded.Amount -= gold.Amount; Item goldReturned = from.Backpack.FindItemByType(typeof(Gold)); goldReturned.Amount += gold.Amount; } else { pm.PlaySound(gold.GetDropSound()); } } } } return true; } } } return false; }