protected override void FinishEffect( Point3D p, Map map, Mobile from ) { if ( from.Skills.Fishing.Value < 10 ) { from.SendLocalizedMessage( 1074487 ); // The creatures are too quick for you! } else { BaseFish fish = GiveFish( from ); FishBowl bowl = Aquarium.GetEmptyBowl( from ); if ( bowl != null ) { fish.StopTimer(); bowl.AddItem( fish ); from.SendLocalizedMessage( 1074489 ); // A live creature jumps into the fish bowl in your pack! Delete(); return; } else { if ( from.PlaceInBackpack( fish ) ) { from.PlaySound( 0x5A2 ); from.SendLocalizedMessage( 1074490 ); // A live creature flops around in your pack before running out of air. fish.Kill(); Delete(); return; } else { fish.Delete(); from.SendLocalizedMessage( 1074488 ); // You could not hold the creature. } } } InUse = false; Movable = true; if ( !from.PlaceInBackpack( this ) ) { if ( from.Map == null || from.Map == Map.Internal ) Delete(); else MoveToWorld( from.Location, from.Map ); } }
public override void OnComponentUsed(AddonComponent c, Mobile from) { if (from.InRange(c.Location, 2)) { if (this.m_Fruits > 0) { Item fruit = this.Fruit; if (fruit == null) return; if (!from.PlaceInBackpack(fruit)) { fruit.Delete(); from.SendLocalizedMessage(501015); // There is no room in your backpack for the fruit. } else { if (--this.m_Fruits == 0) Timer.DelayCall(TimeSpan.FromMinutes(30), new TimerCallback(Respawn)); from.SendLocalizedMessage(501016); // You pick some fruit and put it in your backpack. } } else from.SendLocalizedMessage(501017); // There is no more fruit on this tree } else from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. }
private void Gather( Mobile from ) { int amount = 0; Item reg; bool canHold = true; for ( int i = 0; i < m_ResourceAmounts.Length && i < m_ResourceTypes.Length; ++i ) { if ( m_ResourceAmounts[i] > 0 && canHold ) { reg = Activator.CreateInstance( m_ResourceTypes[i], new object[]{ m_ResourceAmounts[i] } ) as Item; if ( !from.PlaceInBackpack( reg ) ) { canHold = false; reg.Delete(); } else amount += m_ResourceAmounts[i]; } m_ResourceAmounts[i] = 0; } if ( amount == 1 ) from.SendMessage( "You take a reagent from the statue and clean it." ); else if ( amount > 1 ) from.SendMessage( "You gather {0} reagents from the statue and clean it.", amount ); else from.SendMessage( "You remove the reagents from the statue." ); NextFill = DateTime.Now + TimeSpan.FromDays( 1 ); if ( ItemID == 0x1949 ) ItemID = 0x1947; else ItemID = 0x1948; }
public override void OnDoubleClick(Mobile from) { if (!this.VerifyMove(from)) return; if (!from.InRange(this.GetWorldLocation(), 2)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. return; } Point3D fireLocation = this.GetFireLocation(from); if (fireLocation == Point3D.Zero) { from.SendLocalizedMessage(501695); // There is not a spot nearby to place your campfire. } else if (!from.CheckSkill(SkillName.Camping, 0.0, 100.0)) { from.SendLocalizedMessage(501696); // You fail to ignite the campfire. } else { this.Consume(); if (!this.Deleted && this.Parent == null) from.PlaceInBackpack(this); new Campfire().MoveToWorld(fireLocation, from.Map); } }
public bool GiveReward(Mobile to) { Bag bag = new Bag(); bag.DropItem(new Gold(Utility.RandomMinMax(500, 1000))); if (Utility.RandomBool()) { BaseWeapon weapon = Loot.RandomWeapon(); if (Core.AOS) { BaseRunicTool.ApplyAttributesTo(weapon, 2, 20, 30); } else { weapon.DamageLevel = (WeaponDamageLevel)BaseCreature.RandomMinMaxScaled(2, 3); weapon.AccuracyLevel = (WeaponAccuracyLevel)BaseCreature.RandomMinMaxScaled(2, 3); weapon.DurabilityLevel = (WeaponDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 3); } bag.DropItem(weapon); } else { Item item; if (Core.AOS) { item = Loot.RandomArmorOrShieldOrJewelry(); if (item is BaseArmor) BaseRunicTool.ApplyAttributesTo((BaseArmor)item, 2, 20, 30); else if (item is BaseJewel) BaseRunicTool.ApplyAttributesTo((BaseJewel)item, 2, 20, 30); } else { BaseArmor armor = Loot.RandomArmorOrShield(); item = armor; armor.ProtectionLevel = (ArmorProtectionLevel)BaseCreature.RandomMinMaxScaled(2, 3); armor.Durability = (ArmorDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 3); } bag.DropItem(item); } bag.DropItem(new Obsidian()); if (to.PlaceInBackpack(bag)) { return true; } else { bag.Delete(); return false; } }
protected override void OnTarget( Mobile from, object targeted ) { if ( m_Item.Deleted ) return; if ( targeted is ICarvable ) { ((ICarvable)targeted).Carve( from, m_Item ); } else { HarvestSystem system = Lumberjacking.System; HarvestDefinition def = Lumberjacking.System.Definition; int tileID; Map map; Point3D loc; if ( !system.GetHarvestDetails( from, m_Item, targeted, out tileID, out map, out loc ) ) { from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that! } else if ( !def.Validate( tileID ) ) { from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that! } else { HarvestBank bank = def.GetBank( map, loc.X, loc.Y ); if ( bank == null ) return; if ( bank.Current < 5 ) { from.SendLocalizedMessage( 500493 ); // There's not enough wood here to harvest. } else { bank.Consume( 5, from ); Item item = new Kindling(); if ( from.PlaceInBackpack( item ) ) { from.SendLocalizedMessage( 500491 ); // You put some kindling into your backpack. from.SendLocalizedMessage( 500492 ); // An axe would probably get you more wood. } else { from.SendLocalizedMessage( 500490 ); // You can't place any kindling into your backpack! item.Delete(); } } } } }
public virtual GiftResult GiveGift( Mobile mob, Item item ) { if ( mob.PlaceInBackpack( item ) ) { if ( !WeightOverloading.IsOverloaded( mob ) ) return GiftResult.Backpack; } mob.BankBox.DropItem( item ); return GiftResult.BankBox; }
public override void OnDoubleClick( Mobile from ) { if (from.BeginAction(typeof(IAction))) { bool releaseLock = true; if (from.InRange(GetWorldLocation(), 2) && from.InLOS(this)) { if ( !VerifyMove( from ) ) return; Point3D fireLocation = GetFireLocation( from ); if ( fireLocation == Point3D.Zero ) { from.SendLocalizedMessage( 501695 ); // There is not a spot nearby to place your campfire. return; } else { new InternalTimer(from).Start(); releaseLock = false; if (!from.CheckSkill(SkillName.Camping, 0.0, 100.0)) { from.SendLocalizedMessage(501696); // You fail to ignite the campfire. } else { Consume(); if (!Deleted && Parent == null) from.PlaceInBackpack(this); new Campfire().MoveToWorld(fireLocation, from.Map); } } } else from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. if (releaseLock && from is PlayerMobile) { ((PlayerMobile)from).EndPlayerAction(); } } else from.SendAsciiMessage("You must wait to perform another action."); }
} // prismatic crystal public override void OnDoubleClick(Mobile from) { if (from.Backpack == null) return; if (from.InRange(Location, 2)) { if (from.Backpack.FindItemByType(typeof (PrismaticAmber), true) == null) { if (from.PlaceInBackpack(new PrismaticAmber())) Delete(); else from.SendLocalizedMessage(1077971); // Make room in your backpack first! } else from.SendLocalizedMessage(1075464); // You already have as many of those as you need. } else from.SendLocalizedMessage(1076766); // That is too far away. }
public override void OnDoubleClick(Mobile from) { if (!this.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. return; } Item replacement = this.CreateReplacement(); if (!from.PlaceInBackpack(replacement)) { replacement.Delete(); from.SendLocalizedMessage(500720); // You don't have enough room in your backpack! } else { this.Delete(); from.Use(replacement); } }
public virtual void GiveReward(Mobile to) { if (!this.m_RewardAvailable) return; int max = (int)(((double)this.m_LiveCreatures / 30) * m_Decorations.Length); int random = (max <= 0) ? 0 : Utility.Random(max); if (random >= m_Decorations.Length) random = m_Decorations.Length - 1; Item item; try { item = Activator.CreateInstance(m_Decorations[random]) as Item; } catch { return; } if (item == null) return; if (!to.PlaceInBackpack(item)) { item.Delete(); to.SendLocalizedMessage(1074361); // The reward could not be given. Make sure you have room in your pack. return; } to.SendLocalizedMessage(1074360, String.Format("#{0}", item.LabelNumber)); // You receive a reward: ~1_REWARD~ to.PlaySound(0x5A3); this.m_RewardAvailable = false; this.InvalidateProperties(); }
public override void OnComponentUsed(AddonComponent c, Mobile from) { BaseHouse house = BaseHouse.FindHouseAt(this); /* * Unique problems have unique solutions. OSI does not have a problem with 1000s of mining carts * due to the fact that they have only a miniscule fraction of the number of 10 year vets that a * typical RunUO shard will have (RunUO's scaled down account aging system makes this a unique problem), * and the "freeness" of free accounts. We also dont have mitigating factors like inactive (unpaid) * accounts not gaining veteran time. * * The lack of high end vets and vet rewards on OSI has made testing the *exact* ranging/stacking * behavior of these things all but impossible, so either way its just an estimation. * * If youd like your shard's carts/stumps to work the way they did before, simply replace the check * below with this line of code: * * if (!from.InRange(GetWorldLocation(), 2) * * However, I am sure these checks are more accurate to OSI than the former version was. * */ if (!from.InRange(this.GetWorldLocation(), 2) || !from.InLOS(this) || !((from.Z - this.Z) > -3 && (from.Z - this.Z) < 3)) { from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that. } else if (house != null && house.HasSecureAccess(from, SecureLevel.Friends)) { if (this.m_Logs > 0) { Item logs = null; switch ( Utility.Random(7) ) { case 0: logs = new Log(); break; case 1: logs = new AshLog(); break; case 2: logs = new OakLog(); break; case 3: logs = new YewLog(); break; case 4: logs = new HeartwoodLog(); break; case 5: logs = new BloodwoodLog(); break; case 6: logs = new FrostwoodLog(); break; } int amount = Math.Min(10, this.m_Logs); logs.Amount = amount; if (!from.PlaceInBackpack(logs)) { logs.Delete(); from.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again. } else { this.m_Logs -= amount; this.PublicOverheadMessage(MessageType.Regular, 0, 1094719, m_Logs.ToString()); // Logs: ~1_COUNT~ } } else from.SendLocalizedMessage(1094720); // There are no more logs available. } else from.SendLocalizedMessage(1061637); // You are not allowed to access this. }
/*public override void OnSingleClick( Mobile from ) { int number = (Amount == 1) ? 1049124 : 1049123; from.Send( new MessageLocalized( Serial, ItemID, MessageType.Regular, 0x3B2, 3, number, "", Amount.ToString() ) ); }*/ public bool Scissor( Mobile from, Scissors scissors ) { if ( Deleted || !from.CanSee( this ) ) return false; Consume(); Item bandage = new Bandage(); bandage.Hue = Hue; if (!from.PlaceInBackpack(bandage)) bandage.MoveToWorld(from.Location, from.Map); //base.ScissorHelper( from, new Bandage(), 1 ); return true; }
public void CompleteCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft) { int badCraft = craftSystem.CanCraft(from, tool, m_Type); if (badCraft > 0) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, badCraft)); } else { from.SendLocalizedMessage(badCraft); } AutoCraftTimer.EndTimer(from); return; } int checkResHue = 0, checkMaxAmount = 0; object checkMessage = null; // Not enough resource to craft it if (!ConsumeRes(from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage)); } else if (checkMessage is int && (int)checkMessage > 0) { from.SendLocalizedMessage((int)checkMessage); } else if (checkMessage is string) { from.SendMessage((string)checkMessage); } AutoCraftTimer.EndTimer(from); return; } else if (!ConsumeAttributes(from, ref checkMessage, false)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage)); } else if (checkMessage is int && (int)checkMessage > 0) { from.SendLocalizedMessage((int)checkMessage); } else if (checkMessage is string) { from.SendMessage((string)checkMessage); } AutoCraftTimer.EndTimer(from); return; } bool toolBroken = false; int ignored = 1; int endquality = 1; bool allRequiredSkills = true; if (CheckSkills(from, typeRes, craftSystem, ref ignored, ref allRequiredSkills)) { // Resource int resHue = 0; int maxAmount = 0; object message = null; // Not enough resource to craft it if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, message)); } else if (message is int && (int)message > 0) { from.SendLocalizedMessage((int)message); } else if (message is string) { from.SendMessage((string)message); } AutoCraftTimer.EndTimer(from); return; } else if (!ConsumeAttributes(from, ref message, true)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, message)); } else if (message is int && (int)message > 0) { from.SendLocalizedMessage((int)message); } else if (message is string) { from.SendMessage((string)message); } AutoCraftTimer.EndTimer(from); return; } tool.UsesRemaining--; if (craftSystem is DefBlacksmithy) { AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer; if (hammer != null && hammer != tool) { #region Mondain's Legacy if (hammer is HammerOfHephaestus) { if (hammer.UsesRemaining > 0) { hammer.UsesRemaining--; } if (hammer.UsesRemaining < 1) { from.PlaceInBackpack(hammer); } } else { hammer.UsesRemaining--; if (hammer.UsesRemaining < 1) { hammer.Delete(); } } #endregion } } #region Mondain's Legacy if (tool is HammerOfHephaestus) { if (tool.UsesRemaining < 1) { tool.UsesRemaining = 0; } } else { if (tool.UsesRemaining < 1) { toolBroken = true; } if (toolBroken) { tool.Delete(); } } #endregion int num = 0; Item item; if (customCraft != null) { item = customCraft.CompleteCraft(out num); } else if (typeof(MapItem).IsAssignableFrom(ItemType) && from.Map != Map.Trammel && from.Map != Map.Felucca) { item = new IndecipherableMap(); from.SendLocalizedMessage(1070800); // The map you create becomes mysteriously indecipherable. } else { item = Activator.CreateInstance(ItemType) as Item; } if (item != null) { #region Mondain's Legacy if (item is Board) { Type resourceType = typeRes; if (resourceType == null) { resourceType = Resources.GetAt(0).ItemType; } CraftResource thisResource = CraftResources.GetFromType(resourceType); switch (thisResource) { case CraftResource.OakWood: item = new OakBoard(); break; case CraftResource.AshWood: item = new AshBoard(); break; case CraftResource.YewWood: item = new YewBoard(); break; case CraftResource.Heartwood: item = new HeartwoodBoard(); break; case CraftResource.Bloodwood: item = new BloodwoodBoard(); break; case CraftResource.Frostwood: item = new FrostwoodBoard(); break; default: item = new Board(); break; } } #endregion if (item is ICraftable) { endquality = ((ICraftable)item).OnCraft(quality, makersMark, from, craftSystem, typeRes, tool, this, resHue); } else if (item is Food) { ((Food)item).PlayerConstructed = true; } else if (item.Hue == 0) { item.Hue = resHue; } if (maxAmount > 0) { if (!item.Stackable && item is IUsesRemaining) { ((IUsesRemaining)item).UsesRemaining *= maxAmount; } else { item.Amount = maxAmount; } } #region Plant Pigments if (item is PlantPigment && (craftSystem is DefAlchemy || craftSystem is DefCooking)) { ((PlantPigment)item).PigmentHue = PlantPigmentHueInfo.HueFromPlantHue(m_PlantHue); } if (item is NaturalDye && (craftSystem is DefAlchemy || craftSystem is DefCooking)) { ((NaturalDye)item).PigmentHue = PlantPigmentHueInfo.GetInfo(m_PlantPigmentHue).PlantPigmentHue; } if (item is SoftenedReeds && (craftSystem is DefAlchemy || craftSystem is DefCooking)) { ((SoftenedReeds)item).PlantHue = PlantHueInfo.GetInfo(m_PlantHue).PlantHue; } if (item is BaseContainer && (craftSystem is DefBasketweaving)) { (item).Hue = PlantHueInfo.GetInfo(m_PlantHue).Hue; } CraftContext context = craftSystem.GetContext(from); if (context.QuestOption == CraftQuestOption.QuestItem) { PlayerMobile px = from as PlayerMobile; if (!QuestHelper.CheckItem(px, item)) from.SendLocalizedMessage(1072355, null, 0x23); // That item does not match any of your quest criteria } #endregion from.AddToBackpack(item); if (from.IsStaff()) { CommandLogging.WriteLine( from, "Crafting {0} with craft system {1}", CommandLogging.Format(item), craftSystem.GetType().Name); } AutoCraftTimer.OnSuccessfulCraft(from); //from.PlaySound( 0x57 ); } if (num == 0) { num = craftSystem.PlayEndingEffect(from, false, true, toolBroken, endquality, makersMark, this); } bool queryFactionImbue = false; int availableSilver = 0; FactionItemDefinition def = null; Faction faction = null; if (item is IFactionItem) { def = FactionItemDefinition.Identify(item); if (def != null) { faction = Faction.Find(from); if (faction != null) { Town town = Town.FromRegion(from.Region); if (town != null && town.Owner == faction) { Container pack = from.Backpack; if (pack != null) { availableSilver = pack.GetAmount(typeof(Silver)); if (availableSilver >= def.SilverCost) { queryFactionImbue = Faction.IsNearType(from, def.VendorType, 12); } } } } } } // TODO: Scroll imbuing if (queryFactionImbue) { from.SendGump(new FactionImbueGump(quality, item, from, craftSystem, tool, num, availableSilver, faction, def)); } else if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, num)); } else if (num > 0) { from.SendLocalizedMessage(num); } } else if (!allRequiredSkills) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, 1044153)); } else { from.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item. } AutoCraftTimer.EndTimer(from); } else { ConsumeType consumeType = (UseAllRes ? ConsumeType.Half : ConsumeType.All); int resHue = 0; int maxAmount = 0; object message = null; // Not enough resource to craft it if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, true)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, message)); } else if (message is int && (int)message > 0) { from.SendLocalizedMessage((int)message); } else if (message is string) { from.SendMessage((string)message); } AutoCraftTimer.EndTimer(from); return; } tool.UsesRemaining--; if (tool.UsesRemaining < 1) { toolBroken = true; } if (toolBroken) { tool.Delete(); } // SkillCheck failed. int num = craftSystem.PlayEndingEffect(from, true, true, toolBroken, endquality, false, this); if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, num)); } else if (num > 0) { from.SendLocalizedMessage(num); } } }
public void UndressItem( Mobile m, Layer layer ) { Item item = m.FindItemOnLayer( layer ); if ( item != null && item.Movable ) m.PlaceInBackpack( item ); }
protected override void OnTarget(Mobile from, object targeted) { if (this.m_Item.Deleted) return; if (targeted is ICarvable) { ((ICarvable)targeted).Carve(from, this.m_Item); } else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding) { SwampDragon pet = (SwampDragon)targeted; if (!pet.Controlled || pet.ControlMaster != from) from.SendLocalizedMessage(1053022); // You cannot remove barding from a swamp dragon you do not own. else pet.HasBarding = false; } else { if (targeted is StaticTarget) { int itemID = ((StaticTarget)targeted).ItemID; if (itemID == 0xD15 || itemID == 0xD16) // red mushroom { PlayerMobile player = from as PlayerMobile; if (player != null) { QuestSystem qs = player.Quest; if (qs is WitchApprenticeQuest) { FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective; if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.RedMushrooms) { player.SendLocalizedMessage(1055036); // You slice a red cap mushroom from its stem. obj.Complete(); return; } } } } } HarvestSystem system = Lumberjacking.System; HarvestDefinition def = Lumberjacking.System.Definition; int tileID; Map map; Point3D loc; if (!system.GetHarvestDetails(from, this.m_Item, targeted, out tileID, out map, out loc)) { from.SendLocalizedMessage(500494); // You can't use a bladed item on that! } else if (!def.Validate(tileID)) { from.SendLocalizedMessage(500494); // You can't use a bladed item on that! } else { HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) return; if (bank.Current < 5) { from.SendLocalizedMessage(500493); // There's not enough wood here to harvest. } else { bank.Consume(5, from); Item item = new Kindling(); if (from.PlaceInBackpack(item)) { from.SendLocalizedMessage(500491); // You put some kindling into your backpack. from.SendLocalizedMessage(500492); // An axe would probably get you more wood. } else { from.SendLocalizedMessage(500490); // You can't place any kindling into your backpack! item.Delete(); } } } } }
public bool Demolish( Mobile by ) { CharacterStatueDeed deed = new CharacterStatueDeed( null ); if ( by.PlaceInBackpack( deed ) ) { Delete(); deed.Statue = this; deed.StatueType = m_Type; deed.IsRewardItem = m_IsRewardItem; if ( m_Plinth != null ) m_Plinth.Delete(); return true; } else { by.SendLocalizedMessage( 500720 ); // You don't have enough room in your backpack! deed.Delete(); return false; } }
private static void ApplyUOSmartSettings(Mobile m) { BankBox bank = m.BankBox; Container cont; m.StatCap = 250; // Begin bag of treasure maps cont = new Bag(); cont.Name = "Bag Of Treasure Maps"; PlaceItemIn(cont, 30, 35, new TreasureMap(1, Map.Trammel)); PlaceItemIn(cont, 45, 35, new TreasureMap(2, Map.Trammel)); PlaceItemIn(cont, 60, 35, new TreasureMap(3, Map.Trammel)); PlaceItemIn(cont, 75, 35, new TreasureMap(4, Map.Trammel)); PlaceItemIn(cont, 90, 35, new TreasureMap(5, Map.Trammel)); PlaceItemIn(cont, 90, 35, new TreasureMap(6, Map.Trammel)); PlaceItemIn(cont, 30, 50, new TreasureMap(1, Map.Trammel)); PlaceItemIn(cont, 45, 50, new TreasureMap(2, Map.Trammel)); PlaceItemIn(cont, 60, 50, new TreasureMap(3, Map.Trammel)); PlaceItemIn(cont, 75, 50, new TreasureMap(4, Map.Trammel)); PlaceItemIn(cont, 90, 50, new TreasureMap(5, Map.Trammel)); PlaceItemIn(cont, 90, 50, new TreasureMap(6, Map.Trammel)); PlaceItemIn(cont, 55, 100, new Lockpick(30)); PlaceItemIn(cont, 60, 100, new Pickaxe()); PlaceItemIn(bank, 98, 124, cont); // End bag of treasure maps if (m.Race != Race.Gargoyle) { PlaceItemIn(bank, 98, 124, new StarterBagWarrior()); PlaceItemIn(bank, 70, 124, new StarterBagMage()); } else { PlaceItemIn(bank, 98, 124, new StarterBagWarriorGargoyle()); PlaceItemIn(bank, 70, 124, new StarterBagMageGargoyle()); } cont = new Daat99MasterLooterSystem.MasterLooterBackpack(); cont.Movable = false; PlaceItemIn(m.Backpack, 0, 0, cont); m.PlaceInBackpack(cont); var jar = new HealingFairyJar(); jar.Movable = false; PlaceItemIn(m.Backpack, 20, 0, jar); }
public override void OnDoubleClick( Mobile from ) { if ( m_TeamInfo != null && m_TeamInfo.Game != null ) { CTFTeamInfo ourTeam = m_TeamInfo; CTFTeamInfo useTeam = m_TeamInfo.Game.GetTeamInfo( from ); if ( ourTeam == null || useTeam == null ) return; if ( IsChildOf( from.Backpack ) ) { from.BeginTarget( 1, false, TargetFlags.None, new TargetCallback( Flag_OnTarget ) ); } else if ( !from.InRange( this, 1 ) || !from.InLOS( this ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x26, 1019045 ); // I can't reach that } else if ( ourTeam == useTeam ) { if ( this.Location == m_TeamInfo.Origin && this.Map == m_TeamInfo.Game.Facet ) { from.Send( new UnicodeMessage( this.Serial, this.ItemID, MessageType.Regular, 0x3B2, 3, "ENU", this.Name, "Touch me not for I am chaste." ) ); } else { CTFPlayerInfo playerInfo = useTeam[from]; if ( playerInfo != null ) playerInfo.Score += 4; // return m_Returner = from; m_ReturnTime = DateTime.UtcNow; SendHome(); from.LocalOverheadMessage( MessageType.Regular, 0x59, false, "You returned the cookies!" ); m_TeamInfo.Game.Alert( "The {1} cookies have been returned by {0}.", from.Name, ourTeam.Name ); } } else if ( !from.PlaceInBackpack( this ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x26, false, "I can't hold that." ); } else { from.RevealingAction(); from.LocalOverheadMessage( MessageType.Regular, 0x59, false, "You stole the cookies!" ); m_TeamInfo.Game.Alert( "The {1} cookies have been stolen by {0} ({2}).", from.Name, ourTeam.Name, useTeam.Name ); BeginCountdown( 120 ); } } }
private bool TakeBomb( Mobile m, BRTeamInfo team, string verb ) { if ( !m.Player || !m.Alive || m.NetState == null ) return false; if ( m.PlaceInBackpack( this ) ) { m.RevealingAction(); m.LocalOverheadMessage( MessageType.Regular, 0x59, false, "You got the bomb!" ); m_Game.Alert( "{1} ({2}) {0} the bomb!", verb, m.Name, team.Name ); m.Target = new BombTarget( this, m ); if ( m_Helpers.Contains( m ) ) m_Helpers.Remove( m ); if ( m_Helpers.Count > 0 ) { Mobile last = (Mobile)m_Helpers[0]; if ( m_Game.GetTeamInfo( last ) != team ) m_Helpers.Clear(); } m_Helpers.Add( m ); return true; } else { return false; } }
private void GiveArcaneFocus(Mobile to, TimeSpan duration, int strengthBonus) { if (to == null) //Sanity return; ArcaneFocus focus = FindArcaneFocus(to); if (focus == null) { ArcaneFocus f = new ArcaneFocus(duration, strengthBonus); if (to.PlaceInBackpack(f)) { to.AddStatMod(new StatMod(StatType.Str, "[ArcaneFocus]", strengthBonus, duration)); f.SendTimeRemainingMessage(to); to.SendLocalizedMessage(1072740); // An arcane focus appears in your backpack. } else { f.Delete(); } } else //OSI renewal rules: the new one will override the old one, always. { to.SendLocalizedMessage(1072828); // Your arcane focus is renewed. focus.LifeSpan = duration; focus.CreationTime = DateTime.Now; focus.StrengthBonus = strengthBonus; focus.InvalidateProperties(); focus.SendTimeRemainingMessage(to); } }
private static void DisRobe(Mobile m_from, Layer layer) { if (m_from.FindItemOnLayer(layer) != null) { Item item = m_from.FindItemOnLayer(layer); m_from.PlaceInBackpack(item); // Place in a bag first? } }
public virtual bool Give(Mobile m, Item item, bool placeAtFeet) { if (m.PlaceInBackpack(item)) return true; if (!placeAtFeet) return false; Map map = m.Map; if (map == null) return false; List<Item> atFeet = new List<Item>(); foreach (Item obj in m.GetItemsInRange(0)) atFeet.Add(obj); for (int i = 0; i < atFeet.Count; ++i) { Item check = atFeet[i]; if (check.StackWith(m, item, false)) return true; } item.MoveToWorld(m.Location, map); return true; }
protected override void OnTarget( Mobile from, object targeted ) { if( m_Item.Deleted ) return; if( targeted is ICarvable ) { ((ICarvable)targeted).Carve( from, m_Item ); } else if( targeted is ForestWyrm && ((ForestWyrm)targeted).HasBarding ) { ForestWyrm pet = (ForestWyrm)targeted; if( !pet.Controlled || pet.ControlMaster != from ) from.SendLocalizedMessage( 1053022 ); // You cannot remove barding from a swamp dragon you do not own. else pet.HasBarding = false; } #region CropSystem else if( targeted is Weeds ) { ((Weeds)targeted).Delete(); from.SendMessage( "You slice the roots of the weed and toss them away." ); } else if( targeted is Food && ((Food)targeted).SeedType != null ) { try { Food food = targeted as Food; int amount = (food.Amount * Utility.RandomMinMax( 2, 6 )); Item seed = Activator.CreateInstance( food.SeedType, amount ) as Item; if( seed != null ) { from.AddToBackpack( seed ); from.SendMessage( String.Format( "You slice open the plant{0} and remove {1} seeds.", (food.Amount > 1 ? "s" : ""), (food.Amount > 1 ? "their" : "its") ) ); } food.Delete(); } catch { } } else if( targeted is Flax ) { int amount = (((Flax)targeted).Amount * Utility.RandomMinMax( 2, 6 )); from.AddToBackpack( new FlaxSeed( amount ) ); from.SendMessage( "You cut off the stalk of the flax and throw it away, keeping the seeds for later use." ); ((Flax)targeted).Delete(); } else if( targeted is WheatSheaf ) { int amount = (((WheatSheaf)targeted).Amount * Utility.RandomMinMax( 3, 8 )); from.AddToBackpack( new WheatSeed( amount ) ); from.SendMessage( "You split open the wheat and take all the seeds you can find." ); ((WheatSheaf)targeted).Delete(); } else if( targeted is Rose ) { from.AddToBackpack( new RoseBud( Utility.RandomMinMax( 3, 6 ) ) ); from.SendMessage( "You break away the petals of the flowers and gently remove the buds." ); ((Rose)targeted).Delete(); } #endregion else { HarvestSystem system = Lumberjacking.System; HarvestDefinition def = Lumberjacking.System.Definition; int tileID; Map map; Point3D loc; if( !system.GetHarvestDetails( from, m_Item, targeted, out tileID, out map, out loc ) ) { from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that! } else if( !def.Validate( tileID ) ) { from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that! } else { HarvestBank bank = def.GetBank( map, loc.X, loc.Y ); if( bank == null ) return; if( bank.Current < 5 ) { from.SendLocalizedMessage( 500493 ); // There's not enough wood here to harvest. } else { bank.Consume( 5, from ); Item item = new Kindling(); if( from.PlaceInBackpack( item ) ) { from.SendLocalizedMessage( 500491 ); // You put some kindling into your backpack. from.SendLocalizedMessage( 500492 ); // An axe would probably get you more wood. } else { from.SendLocalizedMessage( 500490 ); // You can't place any kindling into your backpack! item.Delete(); } } } } }
public virtual void OnCarve( Mobile from, Corpse corpse, Item with ) { int feathers = Feathers; int wool = Wool; int meat = Meat; int hides = Hides; int scales = Scales; if ( (feathers == 0 && wool == 0 && meat == 0 && hides == 0 && scales == 0) || Summoned || IsBonded || corpse.Animated ) { if ( corpse.Animated ) corpse.SendLocalizedMessageTo( from, 500464 ); // Use this on corpses to carve away meat and hide else from.SendLocalizedMessage( 500485 ); // You see nothing useful to carve from the corpse. } else { if( Core.ML && from.Race == Race.Human ) { hides = (int)Math.Ceiling( hides * 1.1 ); //10% Bonus Only applies to Hides, Ore & Logs } if ( corpse.Map == Map.Felucca ) { feathers *= 2; wool *= 2; hides *= 2; if (Core.ML) { meat *= 2; scales *= 2; } } new Blood( 0x122D ).MoveToWorld( corpse.Location, corpse.Map ); if ( feathers != 0 ) { corpse.AddCarvedItem( new Feather( feathers ), from ); from.SendLocalizedMessage( 500479 ); // You pluck the bird. The feathers are now on the corpse. } if ( wool != 0 ) { corpse.AddCarvedItem( new TaintedWool( wool ), from ); from.SendLocalizedMessage( 500483 ); // You shear it, and the wool is now on the corpse. } if ( meat != 0 ) { if ( MeatType == MeatType.Ribs ) corpse.AddCarvedItem( new RawRibs( meat ), from ); else if ( MeatType == MeatType.Bird ) corpse.AddCarvedItem( new RawBird( meat ), from ); else if ( MeatType == MeatType.LambLeg ) corpse.AddCarvedItem( new RawLambLeg( meat ), from ); from.SendLocalizedMessage( 500467 ); // You carve some meat, which remains on the corpse. } if ( hides != 0 ) { Item holding = from.Weapon as Item; if ( Core.AOS && ( holding is SkinningKnife /* TODO: || holding is ButcherWarCleaver || with is ButcherWarCleaver */ ) ) { Item leather = null; switch ( HideType ) { case HideType.Regular: leather = new Leather( hides ); break; case HideType.Spined: leather = new SpinedLeather( hides ); break; case HideType.Horned: leather = new HornedLeather( hides ); break; case HideType.Barbed: leather = new BarbedLeather( hides ); break; } if ( leather != null ) { if ( !from.PlaceInBackpack( leather ) ) { corpse.DropItem( leather ); from.SendLocalizedMessage( 500471 ); // You skin it, and the hides are now in the corpse. } else from.SendLocalizedMessage( 1073555 ); // You skin it and place the cut-up hides in your backpack. } } else { if ( HideType == HideType.Regular ) corpse.DropItem( new Hides( hides ) ); else if ( HideType == HideType.Spined ) corpse.DropItem( new SpinedHides( hides ) ); else if ( HideType == HideType.Horned ) corpse.DropItem( new HornedHides( hides ) ); else if ( HideType == HideType.Barbed ) corpse.DropItem( new BarbedHides( hides ) ); from.SendLocalizedMessage( 500471 ); // You skin it, and the hides are now in the corpse. } } if ( scales != 0 ) { ScaleType sc = this.ScaleType; switch ( sc ) { case ScaleType.Red: corpse.AddCarvedItem( new RedScales( scales ), from ); break; case ScaleType.Yellow: corpse.AddCarvedItem( new YellowScales( scales ), from ); break; case ScaleType.Black: corpse.AddCarvedItem( new BlackScales( scales ), from ); break; case ScaleType.Green: corpse.AddCarvedItem( new GreenScales( scales ), from ); break; case ScaleType.White: corpse.AddCarvedItem( new WhiteScales( scales ), from ); break; case ScaleType.Blue: corpse.AddCarvedItem( new BlueScales( scales ), from ); break; case ScaleType.All: { corpse.AddCarvedItem( new RedScales( scales ), from ); corpse.AddCarvedItem( new YellowScales( scales ), from ); corpse.AddCarvedItem( new BlackScales( scales ), from ); corpse.AddCarvedItem( new GreenScales( scales ), from ); corpse.AddCarvedItem( new WhiteScales( scales ), from ); corpse.AddCarvedItem( new BlueScales( scales ), from ); break; } } from.SendMessage( "You cut away some scales, but they remain on the corpse." ); } corpse.Carved = true; if ( corpse.IsCriminalAction( from ) ) from.CriminalAction( true ); } }
public override void OnDoubleClick(Mobile from) { if (from.Talisman != this) from.SendLocalizedMessage(502641); // You must equip this item to use it. else if (m_ChargeTime > 0) from.SendLocalizedMessage(1074882, m_ChargeTime.ToString()); // You must wait ~1_val~ seconds for this to recharge. else if (m_Charges == 0 && m_MaxCharges > 0) from.SendLocalizedMessage(1042544); // This item is out of charges. else { Type type = GetSummoner(); if (m_Summoner != null && !m_Summoner.IsEmpty) type = m_Summoner.Type; if (type != null) { object obj; try { obj = Activator.CreateInstance(type); } catch { obj = null; } if (obj is Item) { Item item = (Item)obj; int count = 1; if (m_Summoner != null && m_Summoner.Amount > 1) { if (item.Stackable) item.Amount = m_Summoner.Amount; else count = m_Summoner.Amount; } if (from.Backpack == null || count * item.Weight > from.Backpack.MaxWeight || from.Backpack.Items.Count + count > from.Backpack.MaxItems) { from.SendLocalizedMessage(500720); // You don't have enough room in your backpack! item.Delete(); item = null; return; } for (int i = 0; i < count; i++) { from.PlaceInBackpack(item); if (i + 1 < count) item = Activator.CreateInstance(type) as Item; } if (item is Board) from.SendLocalizedMessage(1075000); // You have been given some wooden boards. else if (item is IronIngot) from.SendLocalizedMessage(1075001); // You have been given some ingots. else if (item is Bandage) from.SendLocalizedMessage(1075002); // You have been given some clean bandages. else if (m_Summoner != null && m_Summoner.Name != null) from.SendLocalizedMessage(1074853, m_Summoner.Name.ToString()); // You have been given ~1_name~ } else if (obj is BaseCreature) { BaseCreature mob = (BaseCreature)obj; if ((m_Creature != null && !m_Creature.Deleted) || from.Followers + mob.ControlSlots > from.FollowersMax) { from.SendLocalizedMessage(1074270); // You have too many followers to summon another one. mob.Delete(); return; } BaseCreature.Summon(mob, from, from.Location, mob.BaseSoundID, TimeSpan.FromMinutes(10)); Effects.SendLocationParticles(EffectItem.Create(mob.Location, mob.Map, EffectItem.DefaultDuration), 0x3728, 1, 10, 0x26B6); mob.Summoned = false; mob.ControlOrder = OrderType.Friend; m_Creature = mob; } OnAfterUse(from); } if (m_Removal != TalismanRemoval.None) { from.Target = new TalismanTarget(this); } } }
public virtual bool RemoveItem(Mobile from, int at) { if (at < 0 && at >= this.Items.Count) return false; Item item = this.Items[at]; if (item.IsLockedDown) // for legacy aquariums { from.SendLocalizedMessage(1010449); // You may not use this object while it is locked down. return false; } if (item is BaseFish) { BaseFish fish = (BaseFish)item; FishBowl bowl; if ((bowl = GetEmptyBowl(from)) != null) { bowl.AddItem(fish); from.SendLocalizedMessage(1074511); // You put the creature into a fish bowl. } else { if (!from.PlaceInBackpack(fish)) { from.SendLocalizedMessage(1074514); // You have no place to put it. return false; } else { from.SendLocalizedMessage(1074512); // You put the gasping creature into your pack. } } if (!fish.Dead) this.m_LiveCreatures -= 1; } else { if (!from.PlaceInBackpack(item)) { from.SendLocalizedMessage(1074514); // You have no place to put it. return false; } else { from.SendLocalizedMessage(1074513); // You put the item into your pack. } } this.InvalidateProperties(); return true; }
public override void OnComponentUsed( AddonComponent c, Mobile from ) { BaseHouse house = BaseHouse.FindHouseAt( this ); /* * Unique problems have unique solutions. OSI does not have a problem with 1000s of mining carts * due to the fact that they have only a miniscule fraction of the number of 10 year vets that a * typical RunUO shard will have (RunUO's scaled down account aging system makes this a unique problem), * and the "freeness" of free accounts. We also dont have mitigating factors like inactive (unpaid) * accounts not gaining veteran time. * * The lack of high end vets and vet rewards on OSI has made testing the *exact* ranging/stacking * behavior of these things all but impossible, so either way its just an estimation. * * If youd like your shard's carts/stumps to work the way they did before, simply replace the check * below with this line of code: * * if (!from.InRange(GetWorldLocation(), 2) * * However, I am sure these checks are more accurate to OSI than the former version was. * */ if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this) || !((from.Z - Z) > -3 && (from.Z - Z) < 3)) { from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that. } else if ( house != null && house.HasSecureAccess( from, SecureLevel.Friends ) ) { switch ( m_CartType ) { case MiningCartType.OreSouth: case MiningCartType.OreEast: if ( m_Ore > 0 ) { Item ingots = null; switch ( Utility.Random( 9 ) ) { case 0: ingots = new IronIngot(); break; case 1: ingots = new DullcopperIngot(); break; case 2: ingots = new ShadowIngot(); break; case 3: ingots = new CopperIngot(); break; case 4: ingots = new BronzeIngot(); break; case 5: ingots = new GoldIngot(); break; case 6: ingots = new AgapiteIngot(); break; case 7: ingots = new VeriteIngot(); break; case 8: ingots = new ValoriteIngot(); break; } int amount = Math.Min( 10, m_Ore ); ingots.Amount = amount; if ( !from.PlaceInBackpack( ingots ) ) { ingots.Delete(); from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again. } else { PublicOverheadMessage(MessageType.Regular, 0, 1094724, amount.ToString() ); // Ore: ~1_COUNT~ m_Ore -= amount; } } else from.SendLocalizedMessage( 1094725 ); // There are no more resources available at this time. break; case MiningCartType.GemSouth: case MiningCartType.GemEast: if ( m_Gems > 0 ) { Item gems = null; switch ( Utility.Random( 15 ) ) { case 0: gems = new Amber(); break; case 1: gems = new Amethyst(); break; case 2: gems = new Citrine(); break; case 3: gems = new Diamond(); break; case 4: gems = new Emerald(); break; case 5: gems = new Ruby(); break; case 6: gems = new Sapphire(); break; case 7: gems = new StarSapphire(); break; case 8: gems = new Tourmaline(); break; // Mondain's Legacy gems case 9: gems = new PerfectEmerald(); break; case 10: gems = new DarkSapphire(); break; case 11: gems = new Turquoise(); break; case 12: gems = new EcruCitrine(); break; case 13: gems = new FireRuby(); break; case 14: gems = new BlueDiamond(); break; } int amount = Math.Min( 5, m_Gems ); gems.Amount = amount; if ( !from.PlaceInBackpack( gems ) ) { gems.Delete(); from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again. } else { PublicOverheadMessage( MessageType.Regular, 0, 1094723, amount.ToString() ); // Gems: ~1_COUNT~ m_Gems -= amount; } } else from.SendLocalizedMessage( 1094725 ); // There are no more resources available at this time. break; } } else from.SendLocalizedMessage( 1061637 ); // You are not allowed to access this. }
public override bool OnDragDrop(Mobile from, Item dropped) { if (dropped is BlankScroll && UzeraanTurmoilQuest.HasLostScrollOfPower(from)) { this.FocusTo(from); Item scroll = new SchmendrickScrollOfPower(); if (!from.PlaceInBackpack(scroll)) { scroll.Delete(); from.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory. return false; } else { dropped.Consume(); from.SendLocalizedMessage(1049346); // Schmendrick scribbles on the scroll for a few moments and hands you the finished product. return dropped.Deleted; } } return base.OnDragDrop(from, dropped); }
protected override void OnTarget(Mobile from, object targeted) { if (this.m_PlantBowl.Deleted) return; if (!this.m_PlantBowl.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it. return; } if (targeted is FertileDirt) { int _dirtNeeded = Core.ML ? 20 : 40; FertileDirt dirt = (FertileDirt)targeted; if (!dirt.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it. } else if (dirt.Amount < _dirtNeeded) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061896); // You need more dirt to fill a plant bowl! } else { PlantItem fullBowl = new PlantItem(true); if (from.PlaceInBackpack(fullBowl)) { dirt.Consume(_dirtNeeded); this.m_PlantBowl.Delete(); from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061895); // You fill the bowl with fresh dirt. } else { fullBowl.Delete(); from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061894); // There is no room in your backpack for a bowl full of dirt! } } } else if (PlantBowl.IsDirtPatch(targeted)) { PlantItem fullBowl = new PlantItem(false); if (from.PlaceInBackpack(fullBowl)) { this.m_PlantBowl.Delete(); from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061895); // You fill the bowl with fresh dirt. } else { fullBowl.Delete(); from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061894); // There is no room in your backpack for a bowl full of dirt! } } else { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061893); // You'll want to gather fresh dirt in order to raise a healthy plant! } }