//public override bool DisplayLootType{ get{ return true; } } public override void OnDoubleClick( Mobile from ) // Override double click of the deed to call our target { if ( !IsChildOf( from.Backpack ) ) // Make sure its in their pack { from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it. } else { this.Delete(); from.SendMessage( "The item has been placed in your backpack." ); switch ( Utility.Random( 5 ) ) //Random chance of armor { case 0: from.AddToBackpack( new Vicodin( ) ); break; case 1: from.AddToBackpack( new Vicodin( ) ); break; case 2: from.AddToBackpack( new Vicodin( ) ); break; case 3: from.AddToBackpack( new Vicodin( ) ); break; case 4: from.AddToBackpack( new Vicodin( ) ); break; } } }
private void Chop( Mobile from ) { from.SendMessage( "You make sure no one is looking and rip the gift open!" ); switch (Utility.Random(12)) //picks one of the following { case 0: from.AddToBackpack( new HolidayRose() ); break; case 1: from.AddToBackpack( new SnowDrift() ); break; case 2: from.AddToBackpack( new SantasReindeer1() ); break; case 3: from.AddToBackpack( new SantasReindeer3() ); break; case 4: from.AddToBackpack( new HolidayRose() ); break; case 5: from.AddToBackpack( new SantasBoots() ); break; case 6: from.AddToBackpack( new HolidayRose() ); break; case 7: from.AddToBackpack( new SantasChairAddonDeed() ); break; case 8: from.AddToBackpack( new SantasElfBoots() ); break; case 9: from.AddToBackpack( new HolidayRose() ); break; case 10: from.AddToBackpack( new SnowDrift() ); break; case 11: from.AddToBackpack( new HolidayRose() ); break; } this.Delete(); }
public override bool OnDragDrop( Mobile from, Item dropped ) { if (dropped.LootType == LootType.Blessed || dropped.LootType == LootType.Newbied || dropped is Gold || dropped is TrTokens || dropped is BoardingVoucher || dropped is ChaosCoin || dropped is OrderCoin || dropped is GauntletToken || dropped is StarWarToken || dropped is BankCheck || dropped is ImagineNickel || dropped is ShrinkItem || dropped is Key || dropped is Container && TotalItems >= 1) { from.SendMessage( 38,"You can not trash that for a reward!"); return false; } int prize = GetSellPriceFor( dropped ); int totalPrize = prize; while (prize > 65000) { from.AddToBackpack(new TrTokens(65000)); prize -= 65000; } from.AddToBackpack( new TrTokens( prize ) ); from.SendMessage( 53, "You got {0} silver coins for your trash!", totalPrize); dropped.Internalize(); if (m_TrashedItem != null) m_TrashedItem.Delete(); m_TrashedItem = dropped; trashedReward = totalPrize; return true; }
public static TimeSpan OnUse( Mobile m ) { m.RevealingAction(); if ( m.Target != null ) { m.SendLocalizedMessage( 501845 ); // You are busy doing something else and cannot focus. return TimeSpan.FromSeconds( 5.0 ); } else if ( m.Hits < (m.HitsMax / 10) ) // Less than 10% health { m.SendLocalizedMessage( 501849 ); // The mind is strong but the body is weak. return TimeSpan.FromSeconds( 5.0 ); } else if ( m.Mana >= m.ManaMax ) { m.SendLocalizedMessage( 501846 ); // You are at peace. return TimeSpan.FromSeconds( 5.0 ); } else { Item oneHanded = m.FindItemOnLayer( Layer.OneHanded ); Item twoHanded = m.FindItemOnLayer( Layer.TwoHanded ); if ( Core.AOS ) { if ( !CheckOkayHolding( oneHanded ) ) m.AddToBackpack( oneHanded ); if ( !CheckOkayHolding( twoHanded ) ) m.AddToBackpack( twoHanded ); } else if ( !CheckOkayHolding( oneHanded ) || !CheckOkayHolding( twoHanded ) ) { m.SendLocalizedMessage( 502626 ); // Your hands must be free to cast spells or meditate. return TimeSpan.FromSeconds( 2.5 ); } if ( m.CheckSkill( SkillName.Meditation, 0, 100 ) ) { m.SendLocalizedMessage( 501851 ); // You enter a meditative trance. m.Meditating = true; if ( m.Player || m.Body.IsHuman ) m.PlaySound( 0xF9 ); } else { m.SendLocalizedMessage( 501850 ); // You cannot focus your concentration. } return TimeSpan.FromSeconds( 10.0 ); } }
public static TimeSpan OnUse( Mobile m ) { m.RevealingAction(); if ( m.Target != null ) { m.SendLocalizedMessage( 501845 ); // You are busy doing something else and cannot focus. return TimeSpan.FromSeconds( 5.0 ); } else if ( m.Mana >= m.ManaMax ) { m.SendLocalizedMessage( 501846 ); // You are at peace. return TimeSpan.FromSeconds( 10.0 ); } else if ( !RegenRates.AllowMeditation( m ) ) { m.SendLocalizedMessage( 500135 ); // Regenative forces cannot penetrate your armor! return TimeSpan.FromSeconds( 10.0 ); } else { Item oneHanded = m.FindItemOnLayer( Layer.OneHanded ); Item twoHanded = m.FindItemOnLayer( Layer.TwoHanded ); if ( !CheckOkayHolding( oneHanded ) ) m.AddToBackpack( oneHanded ); if ( !CheckOkayHolding( twoHanded ) ) m.AddToBackpack( twoHanded ); double skillVal = m.Skills[SkillName.Meditation].Value; double chance = ( 75.0 + ( ( skillVal - ( m.ManaMax - m.Mana ) ) * 2 ) ) / 100; if ( chance > Utility.RandomDouble() ) { m.CheckSkill( SkillName.Meditation, 0.0, 100.0 ); m.SendLocalizedMessage( 501851 ); // You enter a meditative trance. m.Meditating = true; BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.ActiveMeditation, 1075657 ) ); if ( m.IsPlayer || m.Body.IsHuman ) m.PlaySound( 0xF9 ); } else { m.SendLocalizedMessage( 501850 ); // You cannot focus your concentration. } return TimeSpan.FromSeconds( 10.0 ); } }
public override void OnDoubleClick(Mobile from) { Container pack = from.Backpack; if (pack != null && pack.ConsumeTotal(typeof(Gold), 10)) { m_GamblePot += 5; InvalidateProperties(); int roll = Utility.Random(1200); if (roll == 0) // Jackpot { int maxCheck = 1000000; from.SendMessage(0x35, "You win the {0}gp jackpot!", m_GamblePot); while (m_GamblePot > maxCheck) { from.AddToBackpack(new BankCheck(maxCheck)); m_GamblePot -= maxCheck; } from.AddToBackpack(new BankCheck(m_GamblePot)); m_GamblePot = 100; } else if (roll <= 20) // Chance for a regbag { from.SendMessage(0x35, "You win a bag of reagents!"); from.AddToBackpack(new BagOfReagents(50)); } else if (roll <= 40) // Chance for gold { from.SendMessage(0x35, "You win 150gp!"); from.AddToBackpack(new BankCheck(150)); } else if (roll <= 100) // Another chance for gold { from.SendMessage(0x35, "You win 100gp!"); from.AddToBackpack(new BankCheck(100)); } else // Loser! { from.SendMessage(0x22, "You lose!"); } } else { from.SendMessage(0x22, "You need at least 10gp in your backpack to use this."); } }
public override void OnDoubleClick(Mobile from) { if (!this.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1040019); // The bola must be in your pack to use it. } else if (!from.CanBeginAction(typeof(Bola))) { from.SendLocalizedMessage(1049624); // You have to wait a few moments before you can use another bola! } else if (from.Target is BolaTarget) { from.SendLocalizedMessage(1049631); // This bola is already being used. } else if (!Core.AOS && (from.FindItemOnLayer(Layer.OneHanded) != null || from.FindItemOnLayer(Layer.TwoHanded) != null)) { from.SendLocalizedMessage(1040015); // Your hands must be free to use this } else if (from.Mounted) { from.SendLocalizedMessage(1040016); // You cannot use this while riding a mount } else if (Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(from)) { from.SendLocalizedMessage(1070902); // You can't use this while in an animal form! } else if (from.Flying) { from.SendLocalizedMessage(1113414); // You cannot use this while flying! } else { EtherealMount.StopMounting(from); if (Core.AOS) { Item one = from.FindItemOnLayer(Layer.OneHanded); Item two = from.FindItemOnLayer(Layer.TwoHanded); if (one != null) from.AddToBackpack(one); if (two != null) from.AddToBackpack(two); } from.Target = new BolaTarget(this); from.LocalOverheadMessage(MessageType.Emote, 0x3B2, 1049632); // * You begin to swing the bola...* from.NonlocalOverheadMessage(MessageType.Emote, 0x3B2, 1049633, from.Name); // ~1_NAME~ begins to menacingly swing a bola... } }
public override bool LootItem(Mobile from) { if (Utility.RandomDouble() <= .05) { FlaxSeed item = new FlaxSeed(); from.AddToBackpack(item); from.SendMessage("You manage to gather 1 flax seed."); } Flax c = new Flax(); c.ItemID = 6812; from.AddToBackpack(c); from.SendMessage("You manage to gather 1 flax bundle."); return true; }
public override bool LootItem(Mobile from) { if (Utility.RandomDouble() <= .05) { WheatSeed item = new WheatSeed(); from.AddToBackpack(item); from.SendMessage("You manage to gather 1 wheat seed."); } WheatSheaf c = new WheatSheaf(); c.ItemID = 7869; from.AddToBackpack(c); from.SendMessage("You manage to gather 1 wheat sheaf."); return true; }
public override bool LootItem(Mobile from) { if (Utility.RandomDouble() <= .05) { MandrakeSeed item = new MandrakeSeed(); from.AddToBackpack(item); from.SendMessage("You manage to gather 1 mandrake seed."); } MandrakeRoot c = new MandrakeRoot(); c.ItemID = 3974; from.AddToBackpack(c); from.SendMessage("You manage to gather 1 mandrake."); return true; }
public override bool LootItem(Mobile from) { if (Utility.RandomDouble() <= .05) { GinsengSeed item = new GinsengSeed(); from.AddToBackpack(item); from.SendMessage("You manage to gather 1 ginseng seed."); } Ginseng c = new Ginseng(); c.ItemID = 3973; from.AddToBackpack(c); from.SendMessage("You manage to gather 1 ginseng."); return true; }
public override bool LootItem(Mobile from) { if (Utility.RandomDouble() <= .05) { CarrotSeed item = new CarrotSeed(); from.AddToBackpack(item); from.SendMessage("You manage to gather 1 carrot seed."); } Carrot c = new Carrot(); c.ItemID = 3191; from.AddToBackpack(c); from.SendMessage("You manage to gather 1 carrot."); return true; }
public override bool LootItem(Mobile from) { if (Utility.RandomDouble() <= .05) { PumpkinSeed item = new PumpkinSeed(); from.AddToBackpack(item); from.SendMessage("You manage to gather 1 pumpkin seed."); } Pumpkin c = new Pumpkin(); c.ItemID = 3178; from.AddToBackpack(c); from.SendMessage("You manage to gather 1 pumpkin."); return true; }
public override bool LootItem(Mobile from) { if (Utility.RandomDouble() <= .05) { GarlicSeed item = new GarlicSeed(); from.AddToBackpack(item); from.SendMessage("You manage to gather 1 garlic seed."); } Garlic c = new Garlic(); c.ItemID = 3972; from.AddToBackpack(c); from.SendMessage("You manage to gather 1 garlic."); return true; }
public override bool LootItem(Mobile from) { if (Utility.RandomDouble() <= .05) { NightshadeSeed item = new NightshadeSeed(); from.AddToBackpack(item); from.SendMessage("You manage to gather 1 nightshade seed."); } Nightshade c = new Nightshade(); c.ItemID = 3976; from.AddToBackpack(c); from.SendMessage("You manage to gather 1 nightshade."); return true; }
public override bool LootItem(Mobile from) { if (Utility.RandomDouble() <= .05) { OnionSeed item = new OnionSeed(); from.AddToBackpack(item); from.SendMessage("You manage to gather 1 onion seed."); } Onion c = new Onion(); c.ItemID = 3182; from.AddToBackpack(c); from.SendMessage("You manage to gather 1 onion."); return true; }
public override bool LootItem(Mobile from) { if (Utility.RandomDouble() <= .05) { BloodmossSeed item = new BloodmossSeed(); from.AddToBackpack(item); from.SendMessage("You manage to gather 1 bloodmoss seed."); } Bloodmoss c = new Bloodmoss(); c.ItemID = 3963; from.AddToBackpack(c); from.SendMessage("You manage to gather 1 bloodmoss."); return true; }
public override bool LootItem(Mobile from) { if (Utility.RandomDouble() <= .05) { TurnipSeed item = new TurnipSeed(); from.AddToBackpack(item); from.SendMessage("You manage to gather 1 turnip seed."); } Turnip c = new Turnip(); c.ItemID = 3385; from.AddToBackpack(c); from.SendMessage("You manage to gather 1 turnip."); return true; }
public override bool LootItem(Mobile from) { if (Utility.RandomDouble() <= .05) { LettuceSeed item = new LettuceSeed(); from.AddToBackpack(item); from.SendMessage("You manage to gather 1 lettuce seed."); } Lettuce c = new Lettuce(); c.ItemID = 3184; from.AddToBackpack(c); from.SendMessage("You manage to gather 1 lettuce."); return true; }
public override void OnDoubleClick( Mobile from ) { if ( !Movable ) return; if ( from.InRange( this.GetWorldLocation(), 1 ) ) { from.SendMessage( "You split up the silverware set." ); from.AddToBackpack( new Fork() ); from.AddToBackpack( new Knife() ); from.AddToBackpack( new Spoon() ); this.Delete(); } }
public override void OnDoubleClick(Mobile from) { if (Utility.RandomDouble() < 0.05) { from.AddToBackpack(MusicBoxGears.RandomMusixBoxGears(TrackRarity.Rare)); } else { if (Utility.RandomBool()) from.AddToBackpack(MusicBoxGears.RandomMusixBoxGears(TrackRarity.Common)); else from.AddToBackpack(MusicBoxGears.RandomMusixBoxGears(TrackRarity.UnCommon)); } Delete(); }
public override void OnDoubleClick( Mobile from ) { ScribeBag scribeBag = new ScribeBag(); if ( !from.AddToBackpack( scribeBag ) ) scribeBag.Delete(); }
public override void OnDoubleClick(Mobile from) { CarpentryBag carpentryBag = new CarpentryBag(5000); if (!from.AddToBackpack(carpentryBag)) carpentryBag.Delete(); }
public override void OnDoubleClick(Mobile from) { Container backpack = from.Backpack; ShadowIronIngot item1 = (ShadowIronIngot)backpack.FindItemByType(typeof(ShadowIronIngot)); if (item1 != null) { BaseIngot m_Ore1 = item1 as BaseIngot; int toConsume = m_Ore1.Amount; if ((m_Ore1.Amount > 499) && (m_Ore1.Amount < 501)) { m_Ore1.Delete(); from.SendMessage("You've successfully converted the Metal."); from.AddToBackpack(new AgapiteIngot(500)); this.Delete(); } else if ((m_Ore1.Amount < 500) || (m_Ore1.Amount > 500)) { from.SendMessage("You can only convert 500 ShadowIron Ingots at a time."); } } else { from.SendMessage("There isn't ShadowIron Ingots in your Backpack."); } }
public override void OnDoubleClick(Mobile from) { SmithBag SmithBag = new SmithBag(5000); if (!from.AddToBackpack(SmithBag)) SmithBag.Delete(); }
public override void OnDoubleClick(Mobile from) { if ( from == null || !from.Alive ) return; // lumbervalue = 100; will give 100% sucsess in picking mageValue = from.Skills[SkillName.Magery].Value + 20; if ( DateTime.Now > lastpicked.AddSeconds(1) ) // 3 seconds between picking changed to 1 sec { lastpicked = DateTime.Now; if ( from.InRange( this.GetWorldLocation(), 1 ) ) { if ( mageValue > Utility.Random( 100 ) ) { from.Direction = from.GetDirectionTo( this ); from.Animate( 32, 5, 1, true, false, 0 ); // Bow from.SendMessage("You pull the plant up by the root."); this.Delete(); from.AddToBackpack( new MandrakeUprooted() ); } else from.SendMessage("The plant is hard to pull up."); } else { from.SendMessage( "You are too far away to harvest anything." ); } } }
public override void OnDoubleClick( Mobile from ) { AlchemyBag alcBag = new AlchemyBag(); if ( !from.AddToBackpack( alcBag ) ) alcBag.Delete(); }
public override void OnDoubleClick(Mobile from) { if ( from == null || !from.Alive ) return; // lumbervalue = 100; will give 100% sucsess in picking lumberValue = from.Skills[SkillName.Lumberjacking].Value / 5; if ( DateTime.Now > lastpicked.AddSeconds(3) ) // 3 seconds between picking { lastpicked = DateTime.Now; if ( from.InRange( this.GetWorldLocation(), 2 ) ) { if ( lumberValue > Utility.Random( 100 ) ) { from.Direction = from.GetDirectionTo( this ); from.Animate( 32, 5, 1, true, false, 0 ); // Bow from.SendMessage(AgriTxt.PullRoot); this.Delete(); from.AddToBackpack( new NightshadeUprooted() ); } else from.SendMessage(AgriTxt.HardPull); } else { from.SendMessage(AgriTxt.HardPull); } } }
public override void OnDoubleClick( Mobile from ) { BagOfingots ingotBag = new BagOfingots( 5000 ); if ( !from.AddToBackpack( ingotBag ) ) ingotBag.Delete(); }
public override void OnDoubleClick( Mobile from ) { TailorBag tailorBag = new TailorBag(); if ( !from.AddToBackpack( tailorBag ) ) tailorBag.Delete(); }
private static void OrganizeMe_OnCommand(CommandEventArgs arg) { Console.WriteLine("---------------- OrganizeMe -------------------"); OrganizePouch weaponPouch = null; OrganizePouch armorPouch = null; OrganizePouch clothingPouch = null; OrganizePouch jewelPouch = null; OrganizePouch potionPouch = null; OrganizePouch currencyPouch = null; OrganizePouch resourcePouch = null; OrganizePouch toolPouch = null; OrganizePouch regsPouch = null; OrganizePouch miscPouch = null; Mobile from = arg.Mobile; var bp = from.Backpack as Backpack; if (@from == null || bp == null) { return; } if (bp.TotalWeight >= bp.MaxWeight && from.AccessLevel < AccessLevel.GameMaster) { if (from is PlayerMobile && from.NetState != null) { from.SendMessage("You have too much weight in your pack to use the organizer."); } return; } if (bp.TotalItems >= (bp.MaxItems - 10) && from.AccessLevel < AccessLevel.GameMaster) { if (from is PlayerMobile && from.NetState != null) { from.SendMessage("You do not have enough room in your pack to use the organizer."); } return; } var backpackitems = new List <Item>(bp.Items); var subcontaineritems = new List <Item>(); foreach (var item in backpackitems.OfType <BaseContainer>()) { var lockable = item as LockableContainer; if (lockable != null) { if (lockable.CheckLocked(from)) { continue; } } var trapped = item as TrapableContainer; if (trapped != null) { if (trapped.TrapType != TrapType.None) { continue; } } // Skip the pouches that are already created if (item is OrganizePouch) { if (item.Name == "Weapons") { weaponPouch = item as OrganizePouch; } if (item.Name == "Armor") { armorPouch = item as OrganizePouch; } if (item.Name == "Clothing") { clothingPouch = item as OrganizePouch; } if (item.Name == "Jewelry") { jewelPouch = item as OrganizePouch; } if (item.Name == "Potions") { potionPouch = item as OrganizePouch; } if (item.Name == "Currency") { currencyPouch = item as OrganizePouch; } if (item.Name == "Resources") { resourcePouch = item as OrganizePouch; } if (item.Name == "Tools") { toolPouch = item as OrganizePouch; } if (item.Name == "Reagents") { regsPouch = item as OrganizePouch; } if (item.Name == "Misc") { miscPouch = item as OrganizePouch; } // Skip all the items in the pouches since they should already be organized continue; } // Add all the subcontainer items, but dont go all the way to comeplete depth subcontaineritems.AddRange(item.Items); } backpackitems.AddRange(subcontaineritems); if (weaponPouch == null) { weaponPouch = new OrganizePouch { Name = "Weapons", Hue = Utility.RandomMetalHue() }; } if (armorPouch == null) { armorPouch = new OrganizePouch { Name = "Armor", Hue = Utility.RandomMetalHue() }; } if (clothingPouch == null) { clothingPouch = new OrganizePouch { Name = "Clothing", Hue = Utility.RandomBrightHue() }; } if (jewelPouch == null) { jewelPouch = new OrganizePouch { Name = "Jewelry", Hue = Utility.RandomPinkHue() }; } if (potionPouch == null) { potionPouch = new OrganizePouch { Name = "Potions", Hue = Utility.RandomOrangeHue() }; } if (currencyPouch == null) { currencyPouch = new OrganizePouch { Name = "Currency", Hue = Utility.RandomYellowHue() }; } if (resourcePouch == null) { resourcePouch = new OrganizePouch { Name = "Resources", Hue = Utility.RandomNondyedHue() }; } if (toolPouch == null) { toolPouch = new OrganizePouch { Name = "Tools", Hue = Utility.RandomMetalHue() }; } if (regsPouch == null) { regsPouch = new OrganizePouch { Name = "Reagents", Hue = Utility.RandomGreenHue() }; } if (miscPouch == null) { miscPouch = new OrganizePouch { Name = "Misc" }; } var pouches = new List <OrganizePouch> { weaponPouch, armorPouch, clothingPouch, jewelPouch, potionPouch, currencyPouch, resourcePouch, toolPouch, regsPouch, miscPouch }; foreach ( Item item in backpackitems.Where( item => item.LootType != LootType.Blessed && !(item is Runebook) && !(item is Spellbook) && item.Movable && item.LootType != LootType.Newbied)) { // Lets not add the pouches to themselves if (item is OrganizePouch) { continue; } if (item is BaseWeapon) { weaponPouch.TryDropItem(from, item, false); } else if (item is BaseArmor) { armorPouch.TryDropItem(from, item, false); } else if (item is BaseClothing) { clothingPouch.TryDropItem(from, item, false); } else if (item is BaseJewel) { jewelPouch.TryDropItem(from, item, false); } else if (item is BasePotion) { potionPouch.TryDropItem(from, item, false); } else if (item is Gold || item is Silver) { currencyPouch.TryDropItem(from, item, false); } else if (item is BaseIngot || item is BaseOre || item is Feather || item is BaseBoard || item is Log || item is BaseLeather || item is Sand || item is BaseGranite) { resourcePouch.TryDropItem(from, item, false); } else if (item is BaseTool) { toolPouch.TryDropItem(from, item, false); } else if (item is BaseReagent) { regsPouch.TryDropItem(from, item, false); } else { miscPouch.TryDropItem(from, item, false); } } var x = 45; foreach (var pouch in pouches) { if (pouch.TotalItems <= 0) { continue; } // AddToBackpack doesnt do anything if the item is already in the backpack // calls DropItem internally if (!from.Backpack.Items.Contains(pouch)) { from.AddToBackpack(pouch); } pouch.X = x; pouch.Y = 65; x += 10; } }
public static TimeSpan OnUse(Mobile m) { m.RevealingAction(); if (m.Target != null) { m.SendLocalizedMessage(501845); // You are busy doing something else and cannot focus. return(TimeSpan.FromSeconds(5.0)); } else if (m.Mana >= m.ManaMax) { m.SendLocalizedMessage(501846); // You are at peace. return(TimeSpan.FromSeconds(10.0)); } else if (!RegenRates.AllowMeditation(m)) { m.SendLocalizedMessage(500135); // Regenative forces cannot penetrate your armor! return(TimeSpan.FromSeconds(10.0)); } else { Item oneHanded = m.FindItemOnLayer(Layer.OneHanded); Item twoHanded = m.FindItemOnLayer(Layer.TwoHanded); if (!CheckOkayHolding(oneHanded)) { m.AddToBackpack(oneHanded); } if (!CheckOkayHolding(twoHanded)) { m.AddToBackpack(twoHanded); } double skillVal = m.Skills[SkillName.Meditation].Value; double chance = (75.0 + ((skillVal - (m.ManaMax - m.Mana)) * 2)) / 100; if (chance > Utility.RandomDouble()) { m.CheckSkill(SkillName.Meditation, 0.0, 100.0); m.SendLocalizedMessage(501851); // You enter a meditative trance. m.Meditating = true; BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.ActiveMeditation, 1075657)); if (m.Player || m.Body.IsHuman) { m.PlaySound(0xF9); } } else { m.SendLocalizedMessage(501850); // You cannot focus your concentration. } return(TimeSpan.FromSeconds(10.0)); } }
public void GivePowerScrolls() { List <Mobile> toGive = new List <Mobile>(); List <DamageStore> rights = GetLootingRights(); for (int i = rights.Count - 1; i >= 0; --i) { DamageStore ds = rights[i]; if (ds.m_HasRight) { toGive.Add(ds.m_Mobile); } } if (toGive.Count == 0) { return; } // Randomize for (int i = 0; i < toGive.Count; ++i) { int rand = Utility.Random(toGive.Count); Mobile hold = toGive[i]; toGive[i] = toGive[rand]; toGive[rand] = hold; } for (int i = 0; i < ChampionSystem.StatScrollAmount; ++i) { Mobile m = toGive[i % toGive.Count]; m.SendLocalizedMessage(1049524); // You have received a scroll of power! m.AddToBackpack(new StatCapScroll(m_StatCap + RandomStatScrollLevel())); if (m is PlayerMobile) { PlayerMobile pm = (PlayerMobile)m; for (int j = 0; j < pm.JusticeProtectors.Count; ++j) { Mobile prot = pm.JusticeProtectors[j]; if (prot.Map != m.Map || prot.Murderer || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot)) { continue; } int chance = 0; switch (VirtueHelper.GetLevel(prot, VirtueName.Justice)) { case VirtueLevel.Seeker: chance = 60; break; case VirtueLevel.Follower: chance = 80; break; case VirtueLevel.Knight: chance = 100; break; } if (chance > Utility.Random(100)) { prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! prot.AddToBackpack(new StatCapScroll(m_StatCap + RandomStatScrollLevel())); } } } } }
public void OnTarget(Mobile from, object obj) { if (this.Deleted || this.m_InUse) { return; } IPoint3D p3D = obj as IPoint3D; if (p3D == null) { return; } Map map = from.Map; if (map == null || map == Map.Internal) { return; } int x = p3D.X, y = p3D.Y, z = map.GetAverageZ(x, y); // OSI just takes the targeted Z if (!from.InRange(p3D, 6)) { from.SendLocalizedMessage(500976); // You need to be closer to the water to fish! } else if (!from.InLOS(obj)) { from.SendLocalizedMessage(500979); // You cannot see that location. } else if (this.RequireDeepWater ? FullValidation(map, x, y) : (ValidateDeepWater(map, x, y) || ValidateUndeepWater(map, obj, ref z))) { Point3D p = new Point3D(x, y, z); if (this.GetType() == typeof(SpecialFishingNet)) { for (int i = 1; i < this.Amount; ++i) // these were stackable before, doh { from.AddToBackpack(new SpecialFishingNet()); } } this.m_InUse = true; this.Movable = false; this.MoveToWorld(p, map); SpellHelper.Turn(from, p); from.Animate(12, 5, 1, true, false, 0); Effects.SendLocationEffect(p, map, 0x352D, 16, 4); Effects.PlaySound(p, map, 0x364); Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 14, new TimerStateCallback(DoEffect), new object[] { p, 0, from }); from.SendLocalizedMessage(this.RequireDeepWater ? 1010487 : 1074492); // You plunge the net into the sea... / You plunge the net into the water... } else { from.SendLocalizedMessage(this.RequireDeepWater ? 1010485 : 1074491); // You can only use this net in deep water! / You can only use this net in water! } }
public override void OnDoubleClick(Mobile from) { if (from.Mounted && !TreeHelper.CanPickMounted) { from.SendMessage("You cannot pick fruit while mounted."); return; } /* To Kill Tree * if ( Utility.RandomDouble() <= .05 ) //.25 is 25% Chance * { * from.SendMessage( "The crop withers away." ); * if ( regrowTimer.Running ) * regrowTimer.Stop(); * * this.Delete(); * } */ if (DateTime.Now > lastpicked.AddSeconds(3)) // 3 seconds between picking { lastpicked = DateTime.Now; int lumberValue = (int)from.Skills[SkillName.Lumberjacking].Value / 20; if (from.Mounted) { ++lumberValue; } if (lumberValue < 0) //Changed lumberValue == 0 to lv < 0 { from.SendMessage("You have no idea how to pick this fruit."); return; } if (from.InRange(this.GetWorldLocation(), 2)) { if (m_yield < 1) { from.SendMessage("There is nothing here to harvest."); } else //check skill { from.Direction = from.GetDirectionTo(this); from.Animate(from.Mounted ? 26:17, 7, 1, true, false, 0); if (lumberValue < m_yield) //Changed lumberValue > to lv < 0 { lumberValue = m_yield + 1; } int pick = Utility.Random(lumberValue); if (pick == 0) { from.SendMessage("You do not manage to gather any fruit."); return; } m_yield -= pick; from.SendMessage("You pick {0} Plum{1}!", pick, (pick == 1 ? "" : "s")); //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield )); Plum crop = new Plum(pick); from.AddToBackpack(crop); if (!regrowTimer.Running) { regrowTimer.Start(); } } } else { from.SendLocalizedMessage(500446); // That is too far away. } } }
public void OnTarget(Mobile from, object obj) { // TODO: Need details on how oil cloths should get consumed here if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (obj is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)obj; if (weapon.RootParent != from) { from.SendLocalizedMessage(1005425); // You may only wipe down items you are holding or carrying. } else if (weapon.Poison == null || weapon.PoisonCharges <= 0) { from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1005422); // Hmmmm... this does not need to be cleaned. } else { if (weapon.PoisonCharges < 2) { weapon.PoisonCharges = 0; } else { weapon.PoisonCharges -= 2; } if (weapon.PoisonCharges > 0) { from.SendLocalizedMessage(1005423); // You have removed some of the caustic substance, but not all. } else { from.SendLocalizedMessage(1010497); // You have cleaned the item. } } } else if (obj == from && obj is PlayerMobile) { PlayerMobile pm = (PlayerMobile)obj; if (pm.BodyMod == 183 || pm.BodyMod == 184) { pm.SavagePaintExpiration = TimeSpan.Zero; pm.BodyMod = 0; pm.HueMod = -1; from.SendLocalizedMessage(1040006); // You wipe away all of your body paint. Consume(); } else { from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1005422); // Hmmmm... this does not need to be cleaned. } } //Added for Firebomb else if (obj is BaseBeverage) { BaseBeverage beverage = (BaseBeverage)obj; if (beverage.Content == BeverageType.Liquor) { Firebomb bomb = new Firebomb(beverage.ItemID); bomb.Name = beverage.Name; Point3D loc = beverage.Location; beverage.Delete(); from.AddToBackpack(bomb); bomb.Location = loc; from.SendLocalizedMessage(1060580); // You prepare a firebomb. Consume(); } } else if (obj is Firebomb) { from.SendLocalizedMessage(1060579); // That is already a firebomb! } //Firebomb end else { from.SendLocalizedMessage(1005426); // The cloth will not work on that. } }
protected override void OnTarget(Mobile from, object targeted) { SilverSerpent serpent = targeted as SilverSerpent; if (serpent == null) { // You may only use this on a silver serpent. from.SendLocalizedMessage(1112221); } else if (!from.InRange(serpent, 1)) { // That is too far away. from.SendLocalizedMessage(500446); } else if (serpent.CharmMaster == null) { // You seem to anger the beast! serpent.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502805, from.Client); } else if (serpent.Venom == SilverSerpent.VenomLeft.None) { // This serpent has already been drained of all its venom. from.SendLocalizedMessage(1112223); } else { if (Utility.RandomBool()) { from.AddToBackpack(new SilverSerpentVenom()); if (serpent.Venom == SilverSerpent.VenomLeft.All) { from.SendLocalizedMessage(1112220); // You manage to extract some resources from the creature. } else { from.SendLocalizedMessage(1112219); // You skillfully extract additional resources from the creature. } if (serpent.Venom == SilverSerpent.VenomLeft.Half || Utility.RandomBool()) { serpent.Venom = SilverSerpent.VenomLeft.None; } else { serpent.Venom = SilverSerpent.VenomLeft.Half; } m_Vial.Consume(); } else { // You handle the creature but fail to harvest any resources from it. from.SendLocalizedMessage(1112218); } if (Utility.RandomBool()) { from.ApplyPoison(serpent, serpent.Poison); } } }
private RecycleResult Recycle(Mobile from, Item item) { if (from == null || item == null || m_CraftSystem == null || m_Tool == null) { return(RecycleResult.Invalid); } if (from.Backpack == null) { return(RecycleResult.Invalid); } CraftContext craftContext = m_CraftSystem.GetContext(from); if (craftContext == null) { return(RecycleResult.Invalid); } bool recycleEntireBackpack = false; if (craftContext.RecycleOption == CraftRecycleOption.RecycleEverything && item == from.Backpack) { recycleEntireBackpack = true; } List <CraftSystem> m_RecycleableCraftSystems = GetRecyclableCraftSystems(); List <Type> m_ItemTypes = new List <Type>(); if (recycleEntireBackpack) { List <Item> m_BackpackItems = from.Backpack.FindItemsByType <Item>(); foreach (Item backpackItem in m_BackpackItems) { if (backpackItem is BaseTool) { continue; } Type itemType = backpackItem.GetType(); if (!m_ItemTypes.Contains(itemType)) { m_ItemTypes.Add(itemType); } } } else { m_ItemTypes.Add(item.GetType()); } List <int> m_RecycleSounds = new List <int>(); int deletedCount = 0; foreach (Type itemType in m_ItemTypes) { foreach (CraftSystem craftSystem in m_RecycleableCraftSystems) { CraftItem craftItem = craftSystem.CraftItems.SearchFor(itemType); if (craftItem == null || craftItem.Resources.Count == 0) { continue; } Dictionary <Type, int> m_ValidRecipeResources = new Dictionary <Type, int>(); CraftResCol craftResourceCollection = craftItem.Resources; for (int a = 0; a < craftResourceCollection.Count; a++) { CraftRes craftResource = craftResourceCollection.GetAt(a); if (!IsRecycleResource(craftResource.ItemType)) { continue; } if (!m_ValidRecipeResources.ContainsKey(craftResource.ItemType)) { m_ValidRecipeResources.Add(craftResource.ItemType, craftResource.Amount); } } if (m_ValidRecipeResources.Count == 0) { continue; } List <Item> m_ItemMatches = new List <Item>(); List <Item> m_ItemsToRecycle = new List <Item>(); Item[] m_MatchingItems = from.Backpack.FindItemsByType(itemType); for (int a = 0; a < m_MatchingItems.Length; a++) { Item targetItem = m_MatchingItems[a]; if (craftContext.RecycleOption == CraftRecycleOption.RecycleSingle && targetItem == item) { m_ItemMatches.Add(targetItem); continue; } if (craftContext.RecycleOption == CraftRecycleOption.RecycleRegularByType && targetItem.Quality == Quality.Regular && !targetItem.IsMagical) { m_ItemMatches.Add(targetItem); continue; } if (craftContext.RecycleOption == CraftRecycleOption.RecycleExceptionalByType && targetItem.Quality == Quality.Exceptional) { m_ItemMatches.Add(targetItem); continue; } if (craftContext.RecycleOption == CraftRecycleOption.RecycleExceptionalByType && targetItem.IsMagical) { m_ItemMatches.Add(targetItem); continue; } if (craftContext.RecycleOption == CraftRecycleOption.RecycleAnyByType) { m_ItemMatches.Add(targetItem); continue; } if (craftContext.RecycleOption == CraftRecycleOption.RecycleEverything) { m_ItemMatches.Add(targetItem); continue; } } foreach (Item recycleItem in m_ItemMatches) { if (!recycleItem.Movable) { continue; } if (recycleItem.LootType != LootType.Regular) { continue; } if (recycleItem.DecorativeEquipment) { continue; } if (recycleItem.TierLevel > 0 && recycleItem.Aspect != AspectEnum.None) { continue; } if (recycleItem is BaseContainer && recycleItem.TotalItems > 0) { continue; } m_ItemsToRecycle.Add(recycleItem); } if (m_ItemsToRecycle.Count == 0) { continue; } Queue m_Queue = new Queue(); foreach (Item recycleItem in m_ItemsToRecycle) { m_Queue.Enqueue(recycleItem); } while (m_Queue.Count > 0) { Item recycleItem = (Item)m_Queue.Dequeue(); bool deleteItem = false; foreach (KeyValuePair <Type, int> pair in m_ValidRecipeResources) { double salvageScalar = .5; if (recycleItem.ItemGroup != ItemGroupType.Crafted) { salvageScalar = .25; } Type resourceType = pair.Key; int totalResourceAmount = (int)(Math.Floor((double)pair.Value * (double)recycleItem.Amount * salvageScalar)); if (totalResourceAmount < 1) { continue; } //Ingot if (resourceType == typeof(IronIngot)) { if (!m_RecycleSounds.Contains(0x2A)) { m_RecycleSounds.Add(0x2A); } if (!m_RecycleSounds.Contains(0x240)) { m_RecycleSounds.Add(0x240); } if (recycleItem.Resource != CraftResource.Iron) { resourceType = CraftResources.GetCraftResourceType(recycleItem.Resource); if (resourceType == null) { resourceType = typeof(IronIngot); } } } //Leather if (resourceType == typeof(Leather)) { if (!m_RecycleSounds.Contains(0x3E3)) { m_RecycleSounds.Add(0x3E3); } if (recycleItem.Resource != CraftResource.RegularLeather) { resourceType = CraftResources.GetCraftResourceType(recycleItem.Resource); if (resourceType == null) { resourceType = typeof(Leather); } } } //Wood if (resourceType == typeof(Board)) { if (!m_RecycleSounds.Contains(0x23D)) { m_RecycleSounds.Add(0x23D); } if (recycleItem.Resource != CraftResource.RegularWood) { resourceType = CraftResources.GetCraftResourceType(recycleItem.Resource); if (resourceType == null) { resourceType = typeof(Board); } } } Item newResource = (Item)Activator.CreateInstance(resourceType); if (newResource == null) { continue; } //Cloth if (resourceType == typeof(Cloth)) { if (!m_RecycleSounds.Contains(0x248)) { m_RecycleSounds.Add(0x248); } newResource.Hue = recycleItem.Hue; } deleteItem = true; deletedCount++; newResource.Amount = totalResourceAmount; from.AddToBackpack(newResource); } int arcaneEssenceValue = recycleItem.GetArcaneEssenceValue(); if (arcaneEssenceValue > 0) { ArcaneEssence arcaneEssenceItem = new ArcaneEssence(arcaneEssenceValue); from.AddToBackpack(arcaneEssenceItem); } if (deleteItem) { recycleItem.Delete(); } } } } if (deletedCount > 0) { foreach (int sound in m_RecycleSounds) { from.PlaySound(sound); } if (deletedCount > 1) { return(RecycleResult.SuccessMultiple); } else { return(RecycleResult.Success); } } else { if (recycleEntireBackpack) { return(RecycleResult.InvalidEntireBackpack); } else { return(RecycleResult.Invalid); } } }
public bool TryTransmutate(Mobile from, Item dropped) { BaseHouse house = BaseHouse.FindHouseAt(from); if (house != null && house.IsOwner(from)) { CraftResource res = CraftResources.GetFromType(dropped.GetType()); if (res == Resource) { if (dropped.Amount < 3) { from.SendLocalizedMessage(1152634); // There is not enough to transmute } else if (Charges <= 0) { from.SendLocalizedMessage(1152635); // The cauldron's magic is exhausted } else { CraftResourceInfo info = CraftResources.GetInfo(Resource + 1); if (info != null && info.ResourceTypes.Length > 0) { int toDrop = Math.Min(Charges * 3, dropped.Amount); CraftResource newRes = (CraftResource)res + 1; while (toDrop % 3 != 0) { toDrop--; } int newAmount = toDrop / 3; if (toDrop < dropped.Amount) { dropped.Amount -= toDrop; } else { dropped.Delete(); } Item item = Loot.Construct(info.ResourceTypes[0]); if (item != null) { item.Amount = newAmount; from.AddToBackpack(item); from.SendLocalizedMessage(1152636); // The cauldron transmutes the material from.PlaySound(Utility.RandomList(0x22, 0x23)); Charges -= newAmount; Components.ForEach(c => c.InvalidateProperties()); return(true); } } else { from.SendLocalizedMessage(1152633); // The cauldron cannot transmute that } } } } else { from.SendLocalizedMessage(1152632); // That is not yours! } return(false); }
protected override void OnTarget(Mobile from, object targ) { if (targ != null && CheckMobile(from)) { if (!(targ is Mobile)) { from.SendLocalizedMessage(1076781); /* There is little chance of getting candy from that! */ return; } if (!(targ is BaseVendor) || (( BaseVendor )targ).Deleted) { from.SendLocalizedMessage(1076765); /* That doesn't look friendly. */ return; } DateTime now = DateTime.Now; BaseVendor m_Begged = targ as BaseVendor; if (CheckMobile(m_Begged)) { if (m_Begged.NextTrickOrTreat > now) { from.SendLocalizedMessage(1076767); /* That doesn't appear to have any more candy. */ return; } m_Begged.NextTrickOrTreat = now + TimeSpan.FromMinutes(Utility.RandomMinMax(5, 10)); if (from.Backpack != null && !from.Backpack.Deleted) { if (Utility.RandomDouble() > .10) { switch (Utility.Random(3)) { case 0: m_Begged.Say(1076768); break; /* Oooooh, aren't you cute! */ case 1: m_Begged.Say(1076779); break; /* All right...This better not spoil your dinner! */ case 2: m_Begged.Say(1076778); break; /* Here you go! Enjoy! */ default: break; } if (Utility.RandomDouble() <= .01 && from.Skills.Begging.Value >= 100) { from.AddToBackpack(HolidaySettings.RandomGMBeggerItem); from.SendLocalizedMessage(1076777); /* You receive a special treat! */ } else { from.AddToBackpack(HolidaySettings.RandomTreat); from.SendLocalizedMessage(1076769); /* You receive some candy. */ } } else { m_Begged.Say(1076770); /* TRICK! */ int m_Action = Utility.Random(4); if (m_Action == 0) { Timer.DelayCall <Mobile>(OneSecond, OneSecond, 10, new TimerStateCallback <Mobile>(Bleeding), from); } else if (m_Action == 1) { Timer.DelayCall <Mobile>(TimeSpan.FromSeconds(2), new TimerStateCallback <Mobile>(SolidHueMobile), from); } else { Timer.DelayCall <Mobile>(TimeSpan.FromSeconds(2), new TimerStateCallback <Mobile>(MakeTwin), from); } } } } } }
public override void OnDoubleClick(Mobile from) { if (m_sower == null || m_sower.Deleted) { m_sower = from; } if (from.Mounted && !CropHelper.CanWorkMounted) { from.SendMessage("You cannot harvest a crop while mounted."); return; } if (DateTime.Now > lastpicked.AddSeconds(3)) // 3 seconds between picking { lastpicked = DateTime.Now; int cookValue = (int)from.Skills[SkillName.Cooking].Value / 20; if (cookValue == 0) { from.SendMessage("You have no idea how to harvest this crop."); return; } if (from.InRange(this.GetWorldLocation(), 1)) { if (m_yield < 1) { from.SendMessage("There is nothing here to harvest."); if (PlayerCanDestroy && !(m_sower.AccessLevel > AccessLevel.Counselor)) { UpRootGump g = new UpRootGump(from, this); from.SendGump(g); } } else //check skill and sower { from.Direction = from.GetDirectionTo(this); from.Animate(from.Mounted ? 29:32, 5, 1, true, false, 0); if (from == m_sower) { cookValue *= 2; m_lastvisit = DateTime.Now; } if (cookValue > m_yield) { cookValue = m_yield + 1; } int pick = Utility.Random(cookValue); if (pick == 0) { from.SendMessage("You do not manage to harvest any crops."); return; } m_yield -= pick; from.SendMessage("You harvest {0} crop{1}!", pick, (pick == 1 ? "" : "s")); //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield )); // use for debuging ((Item)this).ItemID = pickedGraphic; RiceSheath crop = new RiceSheath(pick); from.AddToBackpack(crop); if (SowerPickTime != TimeSpan.Zero && m_lastvisit + SowerPickTime < DateTime.Now && !(m_sower.AccessLevel > AccessLevel.Counselor)) { this.UpRoot(from); return; } if (!regrowTimer.Running) { regrowTimer.Start(); } } } else { from.SendMessage("You are too far away to harvest anything."); } } }
public virtual void OnLoot(Mobile from) { Item m_Loot; string m_Collected = ""; DefragLooters(); if (!FindLooter(from)) { // always one m_Loot = Loot.Construct(m_TrashCommonTypes); from.AddToBackpack(m_Loot); m_Collected = "You have recovered " + GetName(m_Loot); if (Utility.RandomBool())// maybe two { m_Loot = Loot.Construct(m_TrashCommonTypes); from.AddToBackpack(m_Loot); m_Collected = m_Collected + ", " + GetName(m_Loot); } if (m_ItemChance > Utility.RandomDouble())// plus chance for a random item { m_Loot = Loot.Construct(m_TrashItemTypes); from.AddToBackpack(m_Loot); m_Collected = m_Collected + ", " + GetName(m_Loot); } if (m_RareChance > Utility.RandomDouble())// plus chance for a random prize { m_Loot = Loot.Construct(m_TrashRareTypes); from.AddToBackpack(m_Loot); m_Collected = m_Collected + ", and " + GetName(m_Loot) + "!"; } if (m_Sound > 0) { Effects.PlaySound(from.Location, from.Map, m_Sound); } from.SendMessage(m_Collected); Looters.Add(new TrashLooter(from)); m_usesCount++; if (m_MaxUses > 0 && m_usesCount >= m_MaxUses) { from.SendMessage("You have recovered the last useable item!"); this.Delete(); } if (m_MakesCriminal) { from.CriminalAction(false); from.SendLocalizedMessage(1010630); // Taking someone else's treasure is a criminal offense! } } else { from.SendMessage("You find nothing of value at this time."); } }
public bool Drop(Mobile m, RuneCodexCategory cat, bool message) { if (m == null || m.Deleted || cat == null) { return(false); } if (cat.Entries == null || cat.Entries.Count == 0) { if (message) { m.SendMessage("The category \"{0}\" is empty.", cat.Name); } return(false); } var cost = CloneEntryChargeCost * cat.Entries.Count; if (!ConsumeCharges(cost)) { if (message) { m.SendMessage("This action requires {0:#,0} charge{1}.", cost, cost != 1 ? "s" : String.Empty); } return(false); } var entries = new Queue <RuneCodexEntry>(cat.Entries.Not(e => e == null)); var book = new Runebook(); var count = 1; while (entries.Count > 0) { var entry = entries.Dequeue(); if (entry == null) { continue; } book.Entries.Add( new RunebookEntry( entry.Location, entry.Location, entry.Name, BaseHouse.FindHouseAt(entry.Location, entry.Location, 16))); if (book.Entries.Count < 16 && entries.Count > 0) { continue; } m.AddToBackpack(book); if (entries.Count == 0) { continue; } book = new Runebook(); ++count; } if (message) { m.SendMessage( "You created {0:#,0} rune book{1} and consumed {2:#,0} charge{3} from the codex.", count, count != 1 ? "s" : String.Empty, cost, cost != 1 ? "s" : String.Empty); } return(true); }
protected override void OnTarget(Mobile from, object target) { if (Server.Spells.SpellHelper.CheckCombat(from)) { from.SendMessage("You cannot shrink your pet while your in combat."); } else if (target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (Server.Spells.SpellHelper.CheckCombat(bc)) { from.SendMessage("You cannont shrink your pet while its in combat."); } else if (bc.Summoned) { from.SendMessage("You cannont shrink a summoned pet."); } else if (!from.InRange(bc, 5)) { from.SendMessage("You need to be closer to shrink that pet."); } else if (bc.BodyMod != 0) { from.SendMessage("You cannont shrink your pet while its polymorphed."); } else if (bc.IsDeadPet) { from.SendMessage("That pet is dead."); } else if ((bc is PackLlama || bc is PackHorse || bc is Beetle) && (bc.Backpack != null && bc.Backpack.Items.Count > 0)) { from.SendMessage("You must unload your pets pack before you shrink it."); } else if (!bc.Controlled) { from.SendMessage("You have to tame the creature first before you can shrink it."); } else if (bc.Controlled && bc.ControlMaster == from) { #region Creation ShrinkItem si = new ShrinkItem(); si.Creature = bc; si.Owner = from; if (bc.Hue != 0) { si.Hue = bc.Hue; } #endregion #region Effect IEntity p1 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z), from.Map); IEntity p2 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 50), from.Map); Effects.SendMovingParticles(p2, p1, ShrinkTable.Lookup(bc), 1, 0, true, false, 0, 3, 1153, 1, 0, EffectLayer.Head, 0x100); from.PlaySound(492); #endregion #region Internalize bc.Controlled = true; bc.ControlMaster = null; bc.Internalize(); bc.OwnerAbandonTime = DateTime.MinValue; bc.IsStabled = true; #endregion #region Uses m_Shrinker.Uses -= 1; if (m_Shrinker.Uses == 0) { m_Shrinker.Delete(); } #endregion from.AddToBackpack(si); } else { from.SendMessage("Thats not your pet you may not shrink it."); } } else { from.SendMessage("You cannont shrink that."); } }
public override void OnResponse(NetState sender, RelayInfo info) { if (rh_House.Deleted) { return; } if (info.ButtonID >= 2 && info.ButtonID < 50) //blacksmith { if (rh_House.Rest.ContainsKey(((CraftResource)info.ButtonID))) { m_From.AddToBackpack(new RunicHammer(((CraftResource)info.ButtonID), (int)(rh_House.Rest[((CraftResource)info.ButtonID)]))); rh_House.Rest.Remove(((CraftResource)info.ButtonID)); } else { rh_House.BeginCombine(m_From); } m_From.SendGump(new RunicHouseGump(m_From, rh_House)); /*} * else if ( info.ButtonID >= 52 && info.ButtonID < 100 ) //tinker * { * if ( rh_House.Tinker.ContainsKey( ((CraftResource)info.ButtonID - 50) ) ) * { * m_From.AddToBackpack( new RunicTinkerTools(((CraftResource)info.ButtonID - 50), (int)(rh_House.Tinker[((CraftResource)info.ButtonID - 50)])) ); * rh_House.Tinker.Remove( ((CraftResource)info.ButtonID - 50) ); * } * else * rh_House.BeginCombine( m_From ); * m_From.SendGump( new RunicHouseGump( m_From, rh_House ) );*/ } else if (info.ButtonID >= 102 && info.ButtonID < 200) //tailor { if (rh_House.Tailor.ContainsKey(((CraftResource)info.ButtonID))) { m_From.AddToBackpack(new RunicSewingKit(((CraftResource)info.ButtonID), (int)(rh_House.Tailor[((CraftResource)info.ButtonID)]))); rh_House.Tailor.Remove(((CraftResource)info.ButtonID)); } else { rh_House.BeginCombine(m_From); } m_From.SendGump(new RunicHouseGump(m_From, rh_House)); } else if (info.ButtonID > 300) //fletcher { if (rh_House.Rest.ContainsKey(((CraftResource)info.ButtonID))) { m_From.AddToBackpack(new RunicFletcherTools(((CraftResource)info.ButtonID), (int)(rh_House.Rest[((CraftResource)info.ButtonID)]))); rh_House.Rest.Remove(((CraftResource)info.ButtonID)); } else { rh_House.BeginCombine(m_From); } m_From.SendGump(new RunicHouseGump(m_From, rh_House)); } else if (info.ButtonID == 999) //add { rh_House.BeginCombine(m_From); m_From.SendGump(new RunicHouseGump(m_From, rh_House)); } }
protected override void OnTarget(Mobile from, object targeted) { int number; if (!CheckDeed(from)) { return; } bool usingDeed = (m_Deed != null); bool toDelete = false; // TODO: Make an IRepairable if (m_CraftSystem.CanCraft(from, m_Tool, targeted.GetType()) == 1044267) { number = 1044282; // You must be near a forge and and anvil to repair items. * Yes, there are two and's * } else if (m_CraftSystem is DefTinkering && targeted is Golem) { Golem g = (Golem)targeted; int damage = g.HitsMax - g.Hits; if (g.IsDeadBondedPet) { number = 500426; // You can't repair that. } else if (damage <= 0) { number = 500423; // That is already in full repair. } else { double skillValue = (usingDeed) ? m_Deed.SkillLevel : from.Skills[SkillName.Tinkering].Value; if (skillValue < 60.0) { number = 1044153; // You don't have the required skills to attempt this item. //TODO: How does OSI handle this with deeds with golems? } else if (!from.CanBeginAction(typeof(Golem))) { number = 501789; // You must wait before trying again. } else { if (damage > (int)(skillValue * 0.3)) { damage = (int)(skillValue * 0.3); } damage += 30; if (!from.CheckSkill(SkillName.Tinkering, 0.0, 100.0)) { damage /= 2; } Container pack = from.Backpack; if (pack != null) { int v = pack.ConsumeUpTo(typeof(IronIngot), (damage + 4) / 5); if (v > 0) { g.Hits += v * 5; number = 1044279; // You repair the item. toDelete = true; from.BeginAction(typeof(Golem)); Timer.DelayCall(TimeSpan.FromSeconds(12.0), new TimerStateCallback(EndGolemRepair), from); } else { number = 1044037; // You do not have sufficient metal to make that. } } else { number = 1044037; // You do not have sufficient metal to make that. } } } } else if (targeted is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 0; if (Core.AOS) { toWeaken = 1; } else if (skill != SkillName.Tailoring) { double skillLevel = (usingDeed) ? m_Deed.SkillLevel : from.Skills[skill].Base; if (skillLevel >= 90.0) { toWeaken = 1; } else if (skillLevel >= 70.0) { toWeaken = 2; } else { toWeaken = 3; } } if (m_CraftSystem.CraftItems.SearchForSubclass(weapon.GetType()) == null && !IsSpecialWeapon(weapon)) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } else if (!weapon.IsChildOf(from.Backpack) && (!Core.ML || weapon.Parent != from)) { number = 1044275; // The item must be in your backpack to repair it. } else if (!Core.AOS && weapon.PoisonCharges != 0) { number = 1005012; // You cannot repair an item while a caustic substance is on it. } else if (weapon.MaxHitPoints <= 0 || weapon.HitPoints == weapon.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (weapon.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else { if (CheckWeaken(from, skill, weapon.HitPoints, weapon.MaxHitPoints)) { weapon.MaxHitPoints -= toWeaken; weapon.HitPoints = Math.Max(0, weapon.HitPoints - toWeaken); } if (CheckRepairDifficulty(from, skill, weapon.HitPoints, weapon.MaxHitPoints)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); weapon.HitPoints = weapon.MaxHitPoints; } else { number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed] m_CraftSystem.PlayCraftEffect(from); } toDelete = true; } } else if (targeted is BaseArmor) { BaseArmor armor = (BaseArmor)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 0; if (Core.AOS) { toWeaken = 1; } else if (skill != SkillName.Tailoring) { double skillLevel = (usingDeed) ? m_Deed.SkillLevel : from.Skills[skill].Base; if (skillLevel >= 90.0) { toWeaken = 1; } else if (skillLevel >= 70.0) { toWeaken = 2; } else { toWeaken = 3; } } if (m_CraftSystem.CraftItems.SearchForSubclass(armor.GetType()) == null && !IsSpecialArmor(armor)) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } else if (!armor.IsChildOf(from.Backpack) && (!Core.ML || armor.Parent != from)) { number = 1044275; // The item must be in your backpack to repair it. } else if (armor.MaxHitPoints <= 0 || armor.HitPoints == armor.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (armor.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else { if (CheckWeaken(from, skill, armor.HitPoints, armor.MaxHitPoints)) { armor.MaxHitPoints -= toWeaken; armor.HitPoints = Math.Max(0, armor.HitPoints - toWeaken); } if (CheckRepairDifficulty(from, skill, armor.HitPoints, armor.MaxHitPoints)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); armor.HitPoints = armor.MaxHitPoints; } else { number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed] m_CraftSystem.PlayCraftEffect(from); } toDelete = true; } } else if (targeted is BaseClothing) { BaseClothing clothing = (BaseClothing)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 0; if (Core.AOS) { toWeaken = 1; } else if (skill != SkillName.Tailoring) { double skillLevel = (usingDeed) ? m_Deed.SkillLevel : from.Skills[skill].Base; if (skillLevel >= 90.0) { toWeaken = 1; } else if (skillLevel >= 70.0) { toWeaken = 2; } else { toWeaken = 3; } } if (m_CraftSystem.CraftItems.SearchForSubclass(clothing.GetType()) == null && !IsSpecialClothing(clothing) && !((targeted is TribalMask) || (targeted is HornedTribalMask))) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } else if (!clothing.IsChildOf(from.Backpack) && (!Core.ML || clothing.Parent != from)) { number = 1044275; // The item must be in your backpack to repair it. } else if (clothing.MaxHitPoints <= 0 || clothing.HitPoints == clothing.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (clothing.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else { if (CheckWeaken(from, skill, clothing.HitPoints, clothing.MaxHitPoints)) { clothing.MaxHitPoints -= toWeaken; clothing.HitPoints = Math.Max(0, clothing.HitPoints - toWeaken); } if (CheckRepairDifficulty(from, skill, clothing.HitPoints, clothing.MaxHitPoints)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); clothing.HitPoints = clothing.MaxHitPoints; } else { number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed] m_CraftSystem.PlayCraftEffect(from); } toDelete = true; } } else if (!usingDeed && targeted is BlankScroll) { SkillName skill = m_CraftSystem.MainSkill; if (from.Skills[skill].Value >= 50.0) { ((BlankScroll)targeted).Consume(1); RepairDeed deed = new RepairDeed(RepairDeed.GetTypeFor(m_CraftSystem), from.Skills[skill].Value, from); from.AddToBackpack(deed); number = 500442; // You create the item and put it in your backpack. } else { number = 1047005; // You must be at least apprentice level to create a repair service contract. } } else if (targeted is Item) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } else { number = 500426; // You can't repair that. } if (!usingDeed) { CraftContext context = m_CraftSystem.GetContext(from); from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, number)); } else { from.SendLocalizedMessage(number); if (toDelete) { m_Deed.Delete(); } } }
public void GivePowerScrolls() { List <Mobile> toGive = new List <Mobile>(); List <DamageStore> rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax); for (int i = rights.Count - 1; i >= 0; --i) { DamageStore ds = rights[i]; if (ds.m_HasRight) { toGive.Add(ds.m_Mobile); } } if (toGive.Count == 0) { return; } // Randomize for (int i = 0; i < toGive.Count; ++i) { int rand = Utility.Random(toGive.Count); Mobile hold = toGive[i]; toGive[i] = toGive[rand]; toGive[rand] = hold; } for (int i = 0; i < 16; ++i) { int level; double random = Utility.RandomDouble(); if (0.1 >= random) { level = 25; } else if (0.25 >= random) { level = 20; } else if (0.45 >= random) { level = 15; } else if (0.70 >= random) { level = 10; } else { level = 5; } Mobile m = toGive[i % toGive.Count]; m.SendLocalizedMessage(1049524); // You have received a scroll of power! m.AddToBackpack(new StatCapScroll(225 + level)); if (m is PlayerMobile) { PlayerMobile pm = (PlayerMobile)m; for (int j = 0; j < pm.JusticeProtectors.Count; ++j) { Mobile prot = (Mobile)pm.JusticeProtectors[j]; if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot)) { continue; } int chance = 0; switch (VirtueHelper.GetLevel(prot, VirtueName.Justice)) { case VirtueLevel.Seeker: chance = 60; break; case VirtueLevel.Follower: chance = 80; break; case VirtueLevel.Knight: chance = 100; break; } if (chance > Utility.Random(100)) { prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! prot.AddToBackpack(new StatCapScroll(225 + level)); } } } } }
public void DoEffect(Mobile atk, Mobile def) { double chances = GetChances(atk, def); NextUse = DateTime.Now.AddSeconds(CooldownTime); Item weapon = Weapon(def); if (def.Spell != null) { if (def.Spell.IsCasting && (GetBonus(def.Skills[SkillName.ArtMagique].Value, 0.2, 5) + GetBonus(def.Skills[SkillName.Meditation].Value, 0.2, 5)) <= Utility.RandomDouble()) { //def.DisruptiveAction(); } } if (chances >= Utility.RandomDouble()) { new WaitTimer(def, TimeSpan.FromSeconds(2 * WaitTime)).Start(); if (weapon != null) { if (atk is ScriptMobile) { ScriptMobile mob = (ScriptMobile)atk; if (mob.PVPInfo != null) { if (!mob.PVPInfo.CurrentEvent.mode.AllowLoot()) { def.AddToBackpack(weapon); DoAnimation(atk, def, Sounds.SuccessDrop); BaseWeapon.BlockEquip(def, TimeSpan.FromSeconds(chances * BlockEquipDuration)); atk.Stam -= (int)((1 - chances) * 150); def.Damage(15, atk); atk.RevealingAction(); def.RevealingAction(); return; } } } double malus = (weapon.Layer == Layer.OneHanded) ? 0.5 : 0.3; if (malus * chances >= Utility.RandomDouble() && !atk.Mounted) //Steal the weapon { atk.AddToBackpack(weapon); DoAnimation(atk, def, Sounds.SuccessSteal); } else //Drop the weapon { weapon.MoveToWorld(weapon.GetWorldLocation(), weapon.Map); DoAnimation(atk, def, Sounds.SuccessDrop); } BaseWeapon.BlockEquip(def, TimeSpan.FromSeconds(chances * BlockEquipDuration)); } else //Fail { DoAnimation(atk, def, Sounds.Whip); } atk.Stam -= (int)((1 - chances) * 150); def.Damage(15, atk); } else { new WaitTimer(def, TimeSpan.FromSeconds(WaitTime)).Start(); DoAnimation(atk, def, Sounds.Miss); } atk.RevealingAction(); def.RevealingAction(); //atk.DisruptiveAction(); }
protected override void OnTarget(Mobile from, object obj) { if (m_Bola.Deleted) { return; } if (obj is Mobile) { Mobile to = (Mobile)obj; if (!m_Bola.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1040019); // The bola must be in your pack to use it. } else if (!Core.AOS && (from.FindItemOnLayer(Layer.OneHanded) != null || from.FindItemOnLayer(Layer.TwoHanded) != null)) { from.SendLocalizedMessage(1040015); // Your hands must be free to use this } else if (from.Mounted) { from.SendLocalizedMessage(1040016); // You cannot use this while riding a mount } else if (Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(from)) { from.SendLocalizedMessage(1070902); // You can't use this while in an animal form! } else if (!to.Mounted && !Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(to)) { from.SendLocalizedMessage(1049628); // You have no reason to throw a bola at that. } else if (!from.CanBeHarmful(to)) { } else if (from.BeginAction(typeof(Bola))) { EtherealMount.StopMounting(from); if (Core.AOS) { Item one = from.FindItemOnLayer(Layer.OneHanded); Item two = from.FindItemOnLayer(Layer.TwoHanded); if (one != null) { from.AddToBackpack(one); } if (two != null) { from.AddToBackpack(two); } } from.DoHarmful(to); m_Bola.Consume(); from.Direction = from.GetDirectionTo(to); from.Animate(11, 5, 1, true, false, 0); from.MovingEffect(to, 0x26AC, 10, 0, false, false); Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(FinishThrow), new object[] { from, to }); } else { from.SendLocalizedMessage(1049624); // You have to wait a few moments before you can use another bola! } } else { from.SendLocalizedMessage(1049629); // You cannot throw a bola at that. } }
public override void OnDoubleClick(Mobile from) { if (m_sower == null || m_sower.Deleted) { m_sower = from; } if (from != m_sower) { from.SendMessage("You do not own this plant !!!"); return; } if (from.Mounted && !CropHelper.CanWorkMounted) { from.SendMessage("You cannot harvest a crop while mounted."); return; } if (DateTime.UtcNow > lastpicked.AddSeconds(3)) { lastpicked = DateTime.UtcNow; int cookValue = (int)from.Skills[SkillName.Cooking].Value / 20; if (cookValue == 0) { from.SendMessage("You have no idea how to harvest this crop."); return; } if (from.InRange(this.GetWorldLocation(), 1)) { if (m_yield < 1) { from.SendMessage("There is nothing here to harvest."); } else { from.Direction = from.GetDirectionTo(this); from.Animate(from.Mounted ? 29:32, 5, 1, true, false, 0); m_lastvisit = DateTime.UtcNow; if (cookValue > m_yield) { cookValue = m_yield + 1; } int pick = Utility.RandomMinMax(cookValue - 4, cookValue); if (pick < 0) { pick = 0; } if (pick == 0) { from.SendMessage("You do not manage to harvest any crops."); return; } m_yield -= pick; from.SendMessage("You harvest {0} crop{1}!", pick, (pick == 1 ? "" : "s")); if (m_yield < 1) { ((Item)this).ItemID = pickedGraphic; } SweetPotato crop = new SweetPotato(pick); from.AddToBackpack(crop); if (!regrowTimer.Running) { regrowTimer.Start(); } } } else { from.SendMessage("You are too far away to harvest anything."); } } }
public void Pour(Mobile from, Item item) { if (m_PlantStatus >= PlantStatus.DeadTwigs) { return; } if (m_PlantStatus == PlantStatus.DecorativePlant) { LabelTo(from, 1053049); // This is a decorative plant, it does not need watering! return; } if (!RequiresUpkeep) { LabelTo(from, 1150619); // You don't need to water it. return; } if (!IsUsableBy(from)) { LabelTo(from, 1061856); // You must have the item in your backpack or locked down in order to use it. return; } if (item is BaseBeverage) { BaseBeverage beverage = (BaseBeverage)item; if (beverage.IsEmpty || !beverage.Pourable || beverage.Content != BeverageType.Water) { LabelTo(from, 1053069); // You can't use that on a plant! return; } if (!beverage.ValidateUse(from, true)) { return; } beverage.Quantity--; m_PlantSystem.Water++; from.PlaySound(0x4E); LabelTo(from, 1061858); // You soften the dirt with water. m_PlantSystem.NextGrowth = DateTime.UtcNow + PlantSystem.CheckDelay; } else if (item is BasePotion) { BasePotion potion = (BasePotion)item; int message; if (ApplyPotion(potion.PotionEffect, false, out message)) { potion.Consume(); from.PlaySound(0x240); from.AddToBackpack(new Bottle()); m_PlantSystem.NextGrowth = DateTime.UtcNow + PlantSystem.CheckDelay; } LabelTo(from, message); } else if (item is PotionKeg) { PotionKeg keg = (PotionKeg)item; if (keg.Held <= 0) { LabelTo(from, 1053069); // You can't use that on a plant! return; } int message; if (ApplyPotion(keg.Type, false, out message)) { keg.Held--; from.PlaySound(0x240); m_PlantSystem.NextGrowth = DateTime.UtcNow + PlantSystem.CheckDelay; } LabelTo(from, message); } else { LabelTo(from, 1053069); // You can't use that on a plant! } }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); Item stolen = null; object root = null; bool caught = false; if (target is Item) { root = ((Item)target).RootParent; stolen = TryStealItem((Item)target, ref caught); } else if (target is Mobile) { Container pack = ((Mobile)target).Backpack; if (pack != null && pack.Items.Count > 0) { int randomIndex = Utility.Random(pack.Items.Count); root = target; stolen = TryStealItem(pack.Items[randomIndex], ref caught); } } else { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } if (stolen != null) { from.AddToBackpack(stolen); if (!(stolen is Container || stolen.Stackable)) // do not return stolen containers or stackable items { StolenItem.Add(stolen, m_Thief, root as Mobile); } } if (caught) { if (root == null) { m_Thief.CriminalAction(false); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if (!IsInGuild(mobRoot) && IsInnocentTo(m_Thief, mobRoot)) { m_Thief.CriminalAction(false); } string message = String.Format("You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name); foreach (NetState ns in m_Thief.GetClientsInRange(8)) { if (ns.Mobile != m_Thief) { ns.Mobile.SendMessage(message); } } } } else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief)) { m_Thief.CriminalAction(false); } if (root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild((Mobile)root)) { PlayerMobile pm = (PlayerMobile)m_Thief; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } }
protected override void OnTarget(Mobile from, object targeted) { Item iOil = targeted as Item; if (from.Backpack.FindItemByType(typeof(OilCloth)) == null) { from.SendMessage("You need an oil cloth to apply this."); } else if (iOil is BaseWeapon) { BaseWeapon xOil = (BaseWeapon)iOil; if (!iOil.IsChildOf(from.Backpack)) { from.SendMessage("You can only use this oil on items in your pack."); } else if (iOil.IsChildOf(from.Backpack) && Server.Misc.MaterialInfo.IsMetalItem(iOil)) { if (m_Oil.Name == "oil of metal enhancement ( dull copper )") { xOil.Resource = CraftResource.DullCopper; } else if (m_Oil.Name == "oil of metal enhancement ( shadow iron )") { xOil.Resource = CraftResource.ShadowIron; } else if (m_Oil.Name == "oil of metal enhancement ( copper )") { xOil.Resource = CraftResource.Copper; } else if (m_Oil.Name == "oil of metal enhancement ( bronze )") { xOil.Resource = CraftResource.Bronze; } else if (m_Oil.Name == "oil of metal enhancement ( gold )") { xOil.Resource = CraftResource.Gold; } else if (m_Oil.Name == "oil of metal enhancement ( agapite )") { xOil.Resource = CraftResource.Agapite; } else if (m_Oil.Name == "oil of metal enhancement ( verite )") { xOil.Resource = CraftResource.Verite; } else if (m_Oil.Name == "oil of metal enhancement ( valorite )") { xOil.Resource = CraftResource.Valorite; } else if (m_Oil.Name == "oil of metal enhancement ( steel )") { xOil.Resource = CraftResource.Steel; } else if (m_Oil.Name == "oil of metal enhancement ( brass )") { xOil.Resource = CraftResource.Brass; } else if (m_Oil.Name == "oil of metal enhancement ( mithril )") { xOil.Resource = CraftResource.Mithril; } else if (m_Oil.Name == "oil of metal enhancement ( obsidian )") { xOil.Resource = CraftResource.Obsidian; } else if (m_Oil.Name == "oil of metal enhancement ( nepturite )") { xOil.Resource = CraftResource.Nepturite; } from.RevealingAction(); from.PlaySound(0x23E); from.AddToBackpack(new Bottle()); m_Oil.Consume(); from.Backpack.FindItemByType(typeof(OilCloth)).Delete(); } else { from.SendMessage("You cannot rub this oil on that."); } } else if (iOil is BaseArmor) { BaseArmor xOil = (BaseArmor)iOil; if (!iOil.IsChildOf(from.Backpack)) { from.SendMessage("You can only use this oil on items in your pack."); } else if (iOil.IsChildOf(from.Backpack) && Server.Misc.MaterialInfo.IsMetalItem(iOil)) { if (m_Oil.Name == "oil of metal enhancement ( dull copper )") { xOil.Resource = CraftResource.DullCopper; } else if (m_Oil.Name == "oil of metal enhancement ( shadow iron )") { xOil.Resource = CraftResource.ShadowIron; } else if (m_Oil.Name == "oil of metal enhancement ( copper )") { xOil.Resource = CraftResource.Copper; } else if (m_Oil.Name == "oil of metal enhancement ( bronze )") { xOil.Resource = CraftResource.Bronze; } else if (m_Oil.Name == "oil of metal enhancement ( gold )") { xOil.Resource = CraftResource.Gold; } else if (m_Oil.Name == "oil of metal enhancement ( agapite )") { xOil.Resource = CraftResource.Agapite; } else if (m_Oil.Name == "oil of metal enhancement ( verite )") { xOil.Resource = CraftResource.Verite; } else if (m_Oil.Name == "oil of metal enhancement ( valorite )") { xOil.Resource = CraftResource.Valorite; } else if (m_Oil.Name == "oil of metal enhancement ( steel )") { xOil.Resource = CraftResource.Steel; } else if (m_Oil.Name == "oil of metal enhancement ( brass )") { xOil.Resource = CraftResource.Brass; } else if (m_Oil.Name == "oil of metal enhancement ( mithril )") { xOil.Resource = CraftResource.Mithril; } else if (m_Oil.Name == "oil of metal enhancement ( obsidian )") { xOil.Resource = CraftResource.Obsidian; } else if (m_Oil.Name == "oil of metal enhancement ( nepturite )") { xOil.Resource = CraftResource.Nepturite; } from.RevealingAction(); from.PlaySound(0x23E); from.AddToBackpack(new Bottle()); m_Oil.Consume(); from.Backpack.FindItemByType(typeof(OilCloth)).Delete(); } else { from.SendMessage("You cannot rub this oil on that."); } } else { from.SendMessage("You cannot rub this oil on that."); } }
public virtual bool OnSellItems(Mobile seller, ArrayList list) { if (!IsActiveBuyer) { return(false); } if (!seller.CheckAlive()) { return(false); } if (!CheckVendorAccess(seller)) { Say(501522); // I shall not treat with scum like thee! return(false); } seller.PlaySound(0x32); IShopSellInfo[] info = GetSellInfo(); IBuyItemInfo[] buyInfo = this.GetBuyInfo(); int GiveGold = 0; int Sold = 0; Container cont; ArrayList delete = new ArrayList(); ArrayList drop = new ArrayList(); foreach (SellItemResponse resp in list) { if (resp.Item.RootParent != seller || resp.Amount <= 0) { continue; } foreach (IShopSellInfo ssi in info) { if (ssi.IsSellable(resp.Item)) { Sold++; break; } } } if (Sold > MaxSell) { SayTo(seller, true, "You may only sell {0} items at a time!", MaxSell); return(false); } else if (Sold == 0) { return(true); } foreach (SellItemResponse resp in list) { if (resp.Item.RootParent != seller || resp.Amount <= 0) { continue; } foreach (IShopSellInfo ssi in info) { if (ssi.IsSellable(resp.Item)) { int amount = resp.Amount; if (amount > resp.Item.Amount) { amount = resp.Item.Amount; } if (ssi.IsResellable(resp.Item)) { bool found = false; foreach (IBuyItemInfo bii in buyInfo) { if (bii.Restock(resp.Item, amount)) { resp.Item.Consume(amount); found = true; break; } } if (!found) { cont = this.BuyPack; if (amount < resp.Item.Amount) { resp.Item.Amount -= amount; Item item = resp.Item.Dupe(amount); item.SetLastMoved(); cont.DropItem(item); } else { resp.Item.SetLastMoved(); cont.DropItem(resp.Item); } } } else { if (amount < resp.Item.Amount) { resp.Item.Amount -= amount; } else { resp.Item.Delete(); } } GiveGold += ssi.GetSellPriceFor(resp.Item) * amount; break; } } } if (GiveGold > 0) { while (GiveGold > 60000) { seller.AddToBackpack(new Gold(60000)); GiveGold -= 60000; } seller.AddToBackpack(new Gold(GiveGold)); seller.PlaySound(0x0037); //Gold dropping sound if (SupportsBulkOrders(seller)) { Item bulkOrder = CreateBulkOrder(seller, false); if (bulkOrder is LargeBOD) { seller.SendGump(new LargeBODAcceptGump(seller, (LargeBOD)bulkOrder)); } else if (bulkOrder is SmallBOD) { seller.SendGump(new SmallBODAcceptGump(seller, (SmallBOD)bulkOrder)); } } } //no cliloc for this? //SayTo( seller, true, "Thank you! I bought {0} item{1}. Here is your {2}gp.", Sold, (Sold > 1 ? "s" : ""), GiveGold ); return(true); }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (_Item == null || _Item.Deleted) { return; } switch (info.ButtonID) { case 0: { return; } case 1: { from.AddToBackpack(new WeddingCake(0x9EB0)); break; } case 2: { from.AddToBackpack(new WeddingCake(0x9EB1)); break; } case 3: { from.AddToBackpack(new WeddingCake(0x9EB2)); break; } case 4: { from.AddToBackpack(new WeddingCake(0x9EB3)); break; } case 5: { from.AddToBackpack(new WeddingCake(0x9EB4)); break; } case 6: { from.AddToBackpack(new WeddingCake(0x9EB5)); break; } case 7: { from.AddToBackpack(new WeddingCake(0x9EB6)); break; } case 8: { from.AddToBackpack(new WeddingCake(0x9ED4)); break; } } _Item.Delete(); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Kit.Deleted) { return; } if (!(targeted is Corpse) && !(targeted is BigFish)) { from.SendLocalizedMessage(1042600); // That is not a corpse! } else if (targeted is Corpse && ((Corpse)targeted).VisitedByTaxidermist) { from.SendLocalizedMessage(1042596); // That corpse seems to have been visited by a taxidermist already. } else if (!m_Kit.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (from.Skills[SkillName.Carpentry].Base < 90.0) { from.SendLocalizedMessage(1042603); // You would not understand how to use the kit. } else { object obj = targeted; if (obj is Corpse) { obj = ((Corpse)obj).Owner; } for (int i = 0; obj != null && i < m_Table.GetLength(0); ++i) { if (m_Table[i, 0] == obj.GetType()) { Container pack = from.Backpack; if (pack != null && pack.ConsumeTotal(typeof(Board), 10)) { from.SendLocalizedMessage(1042278); // You review the corpse and find it worthy of a trophy. from.SendLocalizedMessage(1042602); // You use your kit up making the trophy. Mobile hunter = null; int weight = 0; if (targeted is BigFish) { hunter = ((BigFish)targeted).Fisher; weight = (int)((BigFish)targeted).Weight; } from.AddToBackpack(new TrophyDeed((int)m_Table[i, 1] + 7, (int)m_Table[i, 1], (int)m_Table[i, 2], (int)m_Table[i, 3], hunter, weight)); if (targeted is Corpse) { ((Corpse)targeted).VisitedByTaxidermist = true; } else if (targeted is BigFish) { ((BigFish)targeted).Consume(); } m_Kit.Delete(); return; } else { from.SendLocalizedMessage(1042598); // You do not have enough boards. return; } } } from.SendLocalizedMessage(1042599); // That does not look like something you want hanging on a wall. } }
private bool Resmelt(Mobile from, Item item, CraftResource resource) { try { if (CraftResources.GetType(resource) != CraftResourceType.Metal) { return(false); } CraftResourceInfo info = CraftResources.GetInfo(resource); if (info == null || info.ResourceTypes.Length == 0) { return(false); } CraftItem craftItem = DefBlacksmithy.CraftSystem.CraftItems.SearchFor(item.GetType()); if (craftItem == null || craftItem.Resources.Count == 0) { return(false); } CraftRes craftResource = craftItem.Resources.GetAt(0); if (craftResource.Amount < 2) { return(false); // Not enough metal to resmelt } double difficulty = 0.0; switch (resource) { case CraftResource.DullCopper: difficulty = 65.0; break; case CraftResource.ShadowIron: difficulty = 70.0; break; case CraftResource.Copper: difficulty = 75.0; break; case CraftResource.Bronze: difficulty = 80.0; break; case CraftResource.Gold: difficulty = 85.0; break; case CraftResource.Agapite: difficulty = 90.0; break; case CraftResource.Verite: difficulty = 95.0; break; case CraftResource.Valorite: difficulty = 99.0; break; } Type resourceType = info.ResourceTypes[0]; Item ingot = (Item)Activator.CreateInstance(resourceType); if (item is DragonBardingDeed || (item is BaseArmor && ((BaseArmor)item).PlayerConstructed) || (item is BaseWeapon && ((BaseWeapon)item).PlayerConstructed) || (item is BaseClothing && ((BaseClothing)item).PlayerConstructed)) { double mining = from.Skills[SkillName.Mining].Value; if (mining > 100.0) { mining = 100.0; } double amount = (((4 + mining) * craftResource.Amount - 4) * 0.0068); if (amount < 2) { ingot.Amount = 2; } else { ingot.Amount = (int)amount; } } else { ingot.Amount = 2; } if (difficulty > from.Skills[SkillName.Mining].Value) { m_Failure = true; ingot.Delete(); } else { item.Delete(); } from.AddToBackpack(ingot); from.PlaySound(0x2A); from.PlaySound(0x240); return(true); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(false); }
public override void OnDoubleClick(Mobile from) { if (from.Mounted && !TreeHelper.CanPickMounted) { from.SendMessage(AgriTxt.CannotWorkMounted); return; } if (DateTime.Now > lastpicked.AddSeconds(3)) // 3 seconds between picking { lastpicked = DateTime.Now; int lumberValue = (int)from.Skills[SkillName.Lumberjacking].Value / 5; if (from.Mounted) { ++lumberValue; } if (lumberValue < 6) { from.SendMessage(AgriTxt.DunnoHowTo); return; } if (from.InRange(this.GetWorldLocation(), 2)) { if (m_yield < 1) { from.SendMessage(AgriTxt.NoCrop); } else //check skill { from.Direction = from.GetDirectionTo(this); from.Animate(from.Mounted ? 26:17, 7, 1, true, false, 0); if (lumberValue > m_yield) { lumberValue = m_yield + 1; } int pick = Utility.Random(lumberValue); if (pick == 0) { from.SendMessage(AgriTxt.ZeroPicked); return; } m_yield -= pick; from.SendMessage(AgriTxt.YouPick + " {0} Katyl{1}!", pick, (pick == 1 ? "" : "s")); //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield )); Katyl crop = new Katyl(pick); // naga fruit from.AddToBackpack(crop); if (!regrowTimer.Running) { regrowTimer.Start(); } } } else { from.SendLocalizedMessage(500446); // That is too far away. } } }
public static TimeSpan OnUse(Mobile m) { m.RevealingAction(); if (m.Target != null) { m.SendLocalizedMessage(501845); // You are busy doing something else and cannot focus. return(TimeSpan.FromSeconds(5.0)); } else if (!Core.AOS && m.Hits < (m.HitsMax / 10)) // Less than 10% health { m.SendLocalizedMessage(501849); // The mind is strong but the body is weak. return(TimeSpan.FromSeconds(5.0)); } else if (m.Mana >= m.ManaMax) { m.SendLocalizedMessage(501846); // You are at peace. return(TimeSpan.FromSeconds(Core.AOS ? 10.0 : 5.0)); } else if (Core.AOS && Server.Misc.RegenRates.GetArmorOffset(m) > 0) { m.SendLocalizedMessage(500135); // Regenative forces cannot penetrate your armor! return(TimeSpan.FromSeconds(10.0)); } else { Item oneHanded = m.FindItemOnLayer(Layer.OneHanded); Item twoHanded = m.FindItemOnLayer(Layer.TwoHanded); if (Core.AOS && m.Player) { if (!CheckOkayHolding(oneHanded)) { m.AddToBackpack(oneHanded); } if (!CheckOkayHolding(twoHanded)) { m.AddToBackpack(twoHanded); } } else if (!CheckOkayHolding(oneHanded) || !CheckOkayHolding(twoHanded)) { m.SendLocalizedMessage(502626); // Your hands must be free to cast spells or meditate. return(TimeSpan.FromSeconds(2.5)); } double skillVal = m.Skills[SkillName.Meditation].Value; double chance = (50.0 + ((skillVal - (m.ManaMax - m.Mana)) * 2)) / 100; if (chance > Utility.RandomDouble()) { m.CheckSkill(SkillName.Meditation, 0.0, 100.0); m.SendLocalizedMessage(501851); // You enter a meditative trance. m.Meditating = true; BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.ActiveMeditation, 1075657)); if (m.Player || m.Body.IsHuman) { m.PlaySound(0xF9); } m.ResetStatTimers(); } else { m.SendLocalizedMessage(501850); // You cannot focus your concentration. } return(TimeSpan.FromSeconds(10.0)); } }
public static void GiveGrapes(Mobile m, int pick, GrapeVariety variety) { switch (variety) { case GrapeVariety.CabernetSauvignon: { CabernetSauvignonGrapes cscrop = new CabernetSauvignonGrapes(pick); m.AddToBackpack(cscrop); break; } case GrapeVariety.Chardonnay: { ChardonnayGrapes ccrop = new ChardonnayGrapes(pick); m.AddToBackpack(ccrop); break; } case GrapeVariety.CheninBlanc: { CheninBlancGrapes cbcrop = new CheninBlancGrapes(pick); m.AddToBackpack(cbcrop); break; } case GrapeVariety.Merlot: { MerlotGrapes mcrop = new MerlotGrapes(pick); m.AddToBackpack(mcrop); break; } case GrapeVariety.PinotNoir: { PinotNoirGrapes pncrop = new PinotNoirGrapes(pick); m.AddToBackpack(pncrop); break; } case GrapeVariety.Riesling: { RieslingGrapes rcrop = new RieslingGrapes(pick); m.AddToBackpack(rcrop); break; } case GrapeVariety.Sangiovese: { SangioveseGrapes scrop = new SangioveseGrapes(pick); m.AddToBackpack(scrop); break; } case GrapeVariety.SauvignonBlanc: { SauvignonBlancGrapes sbcrop = new SauvignonBlancGrapes(pick); m.AddToBackpack(sbcrop); break; } case GrapeVariety.Shiraz: { ShirazGrapes shcrop = new ShirazGrapes(pick); m.AddToBackpack(shcrop); break; } case GrapeVariety.Viognier: { ViognierGrapes vcrop = new ViognierGrapes(pick); m.AddToBackpack(vcrop); break; } case GrapeVariety.Zinfandel: { ZinfandelGrapes zcrop = new ZinfandelGrapes(pick); m.AddToBackpack(zcrop); break; } default: { Grapes crop = new Grapes(pick); m.AddToBackpack(crop); break; } } }