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 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 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. }
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; } }
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; }
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 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; } }
public override void OnDoubleClick(Mobile from) { if (from.Talisman != this) { from.SendLocalizedMessage(502641); // You must equip this item to use it. } else if (this.m_ChargeTime > 0) { from.SendLocalizedMessage(1074882, this.m_ChargeTime.ToString()); // You must wait ~1_val~ seconds for this to recharge. } else if (this.m_Charges == 0 && this.m_MaxCharges > 0) { from.SendLocalizedMessage(1042544); // This item is out of charges. } else { Type type = this.GetSummoner(); if (this.m_Summoner != null && !this.m_Summoner.IsEmpty) { type = this.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 (this.m_Summoner != null && this.m_Summoner.Amount > 1) { if (item.Stackable) { item.Amount = this.m_Summoner.Amount; } else { count = this.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 (this.m_Summoner != null && this.m_Summoner.Name != null) { from.SendLocalizedMessage(1074853, this.m_Summoner.Name.ToString()); // You have been given ~1_name~ } } else if (obj is BaseCreature) { BaseCreature mob = (BaseCreature)obj; if ((this.m_Creature != null && !this.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; this.m_Creature = mob; } this.OnAfterUse(from); } if (this.m_Removal != TalismanRemoval.None) { from.Target = new TalismanTarget(this); } } }
protected override void OnTarget(Mobile from, object targeted) { if (m_PlantBowl.Deleted) { return; } if (!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); 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)) { 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! } }
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. }
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(); } } } } }
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); } }
public override void ProcessKill(Mobile victim, Mobile damager) { BaseCreature bc = victim as BaseCreature; if (bc == null) { return; } if (TOSDSpawner.Instance != null) { TOSDSpawner.Instance.OnCreatureDeath(bc); } if (!Enabled || bc.Controlled || bc.Summoned || !damager.Alive) { return; } Region r = bc.Region; if (damager is PlayerMobile && r.IsPartOf("Sorcerer's Dungeon")) { if (!DungeonPoints.ContainsKey(damager)) { DungeonPoints[damager] = 0; } int fame = bc.Fame / 4; int luck = Math.Max(0, ((PlayerMobile)damager).RealLuck); DungeonPoints[damager] += (int)(fame * (1 + Math.Sqrt(luck) / 100)); int x = DungeonPoints[damager]; const double A = 0.000863316841; const double B = 0.00000425531915; double chance = A * Math.Pow(10, B * x); if (chance > Utility.RandomDouble()) { Item i = Loot.RandomArmorOrShieldOrWeaponOrJewelry(LootPackEntry.IsInTokuno(bc), LootPackEntry.IsMondain(bc), LootPackEntry.IsStygian(bc)); if (i != null) { RunicReforging.GenerateRandomItem(i, damager, Math.Max(100, RunicReforging.GetDifficultyFor(bc)), RunicReforging.GetLuckForKiller(bc), ReforgedPrefix.None, ReforgedSuffix.EnchantedOrigin); damager.PlaySound(0x5B4); damager.SendLocalizedMessage(1157613); // You notice some of your fallen foes' equipment to be of enchanted origin and decide it may be of some value... if (!damager.PlaceInBackpack(i)) { if (damager.BankBox != null && damager.BankBox.TryDropItem(damager, i, false)) { damager.SendLocalizedMessage(1079730); // The item has been placed into your bank box. } else { damager.SendLocalizedMessage(1072523); // You find an artifact, but your backpack and bank are too full to hold it. i.MoveToWorld(damager.Location, damager.Map); } } DungeonPoints.Remove(damager); } } } }
public override bool Give(Mobile m, Item item, bool placeAtFeet) { if (m.Skills.Mining.Value >= 100) { double chance = 0.006; if (Utility.RandomDouble() < chance) { Item sitem = null; int message = 0; switch (Utility.Random(6)) { case 0: sitem = new PerfectEmerald(); message = 1072566; // You have found a perfect emerald! break; case 1: sitem = new DarkSapphire(); message = 1072567; // You have found a dark sapphire! break; case 2: sitem = new Turquoise(); message = 1072568; // You have found a turquoise! break; case 3: sitem = new EcruCitrine(); message = 1072570; // You have found an Ecru Citrine! break; case 4: sitem = new FireRuby(); message = 1072564; // You have found a fire ruby! break; case 5: sitem = new BlueDiamond(); message = 1072562; // You have found a flawless diamond! break; } if (!m.PlaceInBackpack(sitem)) { if (placeAtFeet) { 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, sitem, false)) { m.SendLocalizedMessage(message); return(base.Give(m, item, placeAtFeet)); } } sitem.MoveToWorld(m.Location, m.Map); m.SendLocalizedMessage(message); } else { sitem.Delete(); } } else { m.SendLocalizedMessage(message); } } } return(base.Give(m, item, placeAtFeet)); }
public void EndAdd(Mobile from, object o) { if (o is Item && ((Item)o).IsChildOf(from.Backpack)) { if (o is Beeswax) { //error checking if (UsesRemaining < 1) { from.PrivateOverheadMessage(0, 1154, false, "The pot is too damaged to melt any more wax.", from.NetState); return; } else if (m_Beeswax >= MaxWax) { from.PrivateOverheadMessage(0, 1154, false, "The pot cannot hold any more wax.", from.NetState); return; } else if (!BeehiveHelper.HasHeatSource(from)) { from.PrivateOverheadMessage(0, 1154, false, "You must be near a heat source to melt beeswax.", from.NetState); return; } Beeswax wax = (Beeswax)o; if ((wax.Amount + MeltedBeeswax) > MaxWax) { wax.Amount -= (MaxWax - MeltedBeeswax); MeltedBeeswax = MaxWax; } else { MeltedBeeswax += wax.Amount; wax.Delete(); } from.PrivateOverheadMessage(0, 1154, false, "You slowly melt the beeswax and mix it in the pot.", from.NetState); this.ItemID = 5162; //change the graphic from.PlaySound(43); //bellow sound //from.PlaySound( 0x21 ); //bubbling sound UsesRemaining--; if (MeltedBeeswax < MaxWax) { BeginAdd(from); } } else if (o == this) { //empty the pot if (MeltedBeeswax < 1) { from.PrivateOverheadMessage(0, 1154, false, "There is no wax in the pot.", from.NetState); } else { Item wax = new Beeswax(MeltedBeeswax); if (!from.PlaceInBackpack(wax)) { wax.Delete(); from.PrivateOverheadMessage(0, 1154, false, "There is not enough room in your backpack for the wax!", from.NetState); return; } MeltedBeeswax = 0; ItemID = 2541; //empty pot from.PrivateOverheadMessage(0, 1154, false, "You empty the pot and place the beeswax in your pack.", from.NetState); } } else { from.PrivateOverheadMessage(0, 1154, false, "You can only melt pure beeswax in the pot.", from.NetState); } } else { from.PrivateOverheadMessage(0, 1154, false, "The wax must be in your pack to target it.", from.NetState); } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Item.Deleted) { return; } if (targeted is ICarvable) { if (targeted is Item) { Item item = targeted as Item; if (item.IsLockedDown || (item.RootParent is Container && (!item.Movable || !((Container)item.RootParent).LiftOverride))) { from.SendLocalizedMessage(500494); // You can't use a bladed item on that! return; } } if (((ICarvable)targeted).Carve(from, m_Item) && Siege.SiegeShard) { Siege.CheckUsesRemaining(from, 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; if (Siege.SiegeShard && m_Item is IUsesRemaining) { Siege.CheckUsesRemaining(from, m_Item); } } } else { if (targeted is Mobile) { ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500450, from.NetState); // You can only skin dead creatures. return; } 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(); if (Siege.SiegeShard && m_Item is IUsesRemaining) { Siege.CheckUsesRemaining(from, m_Item); } return; } } } } } 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.SendMessage("Voce nao pode cortar nada ali"); // You can't use a bladed item on that! } else if (!def.Validate(tileID)) { from.SendMessage("Voce nao pode cortar nada ali"); // 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.SendMessage("Nao tem madeira suficiente aqui"); // There's not enough wood here to harvest. } else { bank.Consume(5, from); Item item = new Kindling(); if (from.PlaceInBackpack(item)) { from.SendMessage("Voce colocou alguns galhos secos em sua mochila"); // You put some kindling into your backpack. } else { from.SendMessage("Nao cabe mais em sua mochila"); // You can't place any kindling into your backpack! item.Delete(); } if (Siege.SiegeShard && m_Item is IUsesRemaining) { Siege.CheckUsesRemaining(from, m_Item); } } } } }
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 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; }
public override void OnComponentUsed(AddonComponent c, Mobile from) { BaseHouse house = BaseHouse.FindHouseAt(this); 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)) { if (m_Logs > 0) { Item logs = null; switch (Utility.Random(14)) { case 0: logs = new Log(); break; case 1: logs = new AshLog(); break; case 2: logs = new CherryLog(); break; case 3: logs = new EbonyLog(); break; case 4: logs = new GoldenOakLog(); break; case 5: logs = new HickoryLog(); break; case 6: logs = new MahoganyLog(); break; case 7: logs = new OakLog(); break; case 8: logs = new PineLog(); break; case 9: logs = new RosewoodLog(); break; case 10: logs = new WalnutLog(); break; case 11: logs = new GhostLog(); break; case 12: logs = new PetrifiedLog(); break; case 13: logs = new ElvenLog(); break; } int amount = Math.Min(10, 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 { m_Logs -= amount; 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 OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (!m_Vendor.CanInteractWith(from, false)) { return; } if (m_Vendor.IsOwner(from)) { m_Vendor.SayTo(from, 503212); // You own this shop, just take what you want. return; } if (info.ButtonID == 1) { if (!m_VI.Valid) { m_Vendor.SayTo(from, 503216); // You can't buy that. return; } int totalGold = 0; if (from.Backpack != null) { totalGold += from.Backpack.GetAmount(typeof(Gold)); } if (from.BankBox != null) { totalGold += from.BankBox.GetAmount(typeof(Gold)); } if (totalGold < m_VI.Price) { m_Vendor.SayTo(from, 503205); // You cannot afford this item. } else if (!from.PlaceInBackpack(m_VI.Item)) { m_Vendor.SayTo(from, 503204); // You do not have room in your backpack for this. } else { int leftPrice = m_VI.Price; if (from.Backpack != null) { leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice); } if (leftPrice > 0 && from.BankBox != null) { from.BankBox.ConsumeUpTo(typeof(Gold), leftPrice); } if (m_Vendor is CityPlayerVendor) { CityPlayerVendor vend = (CityPlayerVendor)m_Vendor; double rate = Convert.ToDouble(vend.TaxRate) / 100.0; double tax = Convert.ToDouble(m_VI.Price) * rate; int taxx = Convert.ToInt32(tax); vend.IncomeTax += taxx; vend.HoldGold += (m_VI.Price - taxx); } else { m_Vendor.HoldGold += m_VI.Price; } from.SendLocalizedMessage(503201); // You take the item. } } else { from.SendLocalizedMessage(503207); // Cancelled purchase. } }
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 void OnComponentUsed( AddonComponent c, Mobile from ) { BaseHouse house = BaseHouse.FindHouseAt( this ); 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 ShadowIronIngot(); 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 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); } } }
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(); } } } } }
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); }
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 Container) { Container body = (Container)targeted; if (body.ItemID >= 0x4B5A && body.ItemID <= 0x4BAB) { body.ItemID = Utility.RandomList(0xECA, 0xECB, 0xECC, 0xECD, 0xECE, 0xECF, 0xED0, 0xED1, 0xED2); body.Hue = 0; from.CriminalAction(true); Misc.Titles.AwardKarma(from, -50, true); body.DropItem(new BodyPart(0x1D9F)); body.DropItem(new BodyPart(0x1DA4)); body.DropItem(new BodyPart(0x1DA2)); body.DropItem(new BodyPart(0x1DA3)); body.DropItem(new BodyPart(0x1DA1)); body.DropItem(new BodyPart(0x1DA0)); from.SendMessage("You hack up the body into bloody pieces."); } } 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 { 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.SendMessage("There is not enough here to harvest."); //from.SendLocalizedMessage( 500493 ); // There's not enough wood here to harvest. } else { bank.Consume(5, from); if (tileID == 0x4D96 || tileID == 0x4D9A) // apples { Item item = new Apple(); if (from.PlaceInBackpack(item)) { from.SendMessage("You put an apple into your backpack."); } else { from.SendMessage("You can't place any apples into your backpack!"); item.Delete(); } } else if (tileID == 0x4DA6 || tileID == 0x4DAA) // pears { Item item = new Pear(); if (from.PlaceInBackpack(item)) { from.SendMessage("You put a pear into your backpack."); } else { from.SendMessage("You can't place any pears into your backpack!"); item.Delete(); } } else if (tileID == 0x4D9E || tileID == 0x4DA2) // peaches { Item item = new Peach(); if (from.PlaceInBackpack(item)) { from.SendMessage("You put a peach into your backpack."); } else { from.SendMessage("You can't place any peaches into your backpack!"); item.Delete(); } } else if (tileID == 0x4CDA || tileID == 0x4CDB || tileID == 0x4CDC || tileID == 0x4CDD || tileID == 0x4CDE || tileID == 0x4CDF) // acorns { Item item = new Acorn(); if (from.PlaceInBackpack(item)) { from.SendMessage("You put an acorn into your backpack."); } else { from.SendMessage("You can't place any acorns into your backpack!"); item.Delete(); } } else if (tileID == 0x4CA8 || tileID == 0x4CAA || tileID == 0x4CAB) // bananas { Item item = new Banana(); if (from.PlaceInBackpack(item)) { from.SendMessage("You put a banana into your backpack."); } else { from.SendMessage("You can't place any bananas into your backpack!"); item.Delete(); } } else if (tileID == 0x4C95) // coconut { Item item = new Coconut(); if (from.PlaceInBackpack(item)) { from.SendMessage("You put a coconut into your backpack."); } else { from.SendMessage("You can't place any coconuts into your backpack!"); item.Delete(); } } else if (tileID == 0x4C96) // dates { Item item = new Dates(); if (from.PlaceInBackpack(item)) { from.SendMessage("You put some dates into your backpack."); } else { from.SendMessage("You can't place any dates into your backpack!"); item.Delete(); } } else { 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 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(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. } else if (house != null && house.HasSecureAccess(from, SecureLevel.Friends)) { if (m_ResourceCount > 0) { Item res = null; switch (Utility.Random(5)) { case 0: res = new Wool(); break; case 1: res = new Leather(); break; case 2: res = new SpinedLeather(); break; case 3: res = new HornedLeather(); break; case 4: res = new BarbedLeather(); break; } int amount = Math.Min(10, m_ResourceCount); if (res != null) { res.Amount = amount; if (!from.PlaceInBackpack(res)) { res.Delete(); from.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again. } else { ResourceCount -= amount; PublicOverheadMessage(MessageType.Regular, 0, 1151834, m_ResourceCount.ToString()); // Resources: ~1_COUNT~ } } } else { from.SendLocalizedMessage(1094725); // There are no more ResourceCounts available at this time. } } else { from.SendLocalizedMessage(1061637); // You are not allowed to access } }
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 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)) { if (m_Logs > 0) { Item logs = null; switch (Utility.Random(14)) { case 0: logs = new Log(); break; case 1: logs = new AshLog(); break; case 2: logs = new CherryLog(); break; case 3: logs = new EbonyLog(); break; case 4: logs = new GoldenOakLog(); break; case 5: logs = new HickoryLog(); break; case 6: logs = new MahoganyLog(); break; case 7: logs = new OakLog(); break; case 8: logs = new PineLog(); break; case 9: logs = new RosewoodLog(); break; case 10: logs = new WalnutLog(); break; case 11: logs = new GhostLog(); break; case 12: logs = new PetrifiedLog(); break; case 13: logs = new ElvenLog(); break; } int amount = Math.Min(10, 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 { m_Logs -= amount; 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 OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (info.ButtonID == 0 || m_Plant.Deleted || m_Plant.PlantStatus >= PlantStatus.DecorativePlant) { return; } if (info.ButtonID == 3 && !from.InRange(m_Plant.GetWorldLocation(), 3)) { from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 500446); // That is too far away. return; } if (!m_Plant.IsUsableBy(from)) { m_Plant.LabelTo(from, 1061856); // You must have the item in your backpack or locked down in order to use it. return; } switch (info.ButtonID) { case 1: // Cancel { from.SendGump(new MainPlantGump(m_Plant)); break; } case 2: // Help { from.Send(new DisplayHelpTopic(71, true)); // EMPTYING THE BOWL from.SendGump(new EmptyTheBowlGump(m_Plant)); break; } case 3: // Ok { PlantBowl bowl = new PlantBowl(); if (!from.PlaceInBackpack(bowl)) { bowl.Delete(); m_Plant.LabelTo(from, 1053047); // You cannot empty a bowl with a full pack! from.SendGump(new MainPlantGump(m_Plant)); break; } if (m_Plant.PlantStatus != PlantStatus.BowlOfDirt && m_Plant.PlantStatus < PlantStatus.Plant) { Seed seed = new Seed(m_Plant.PlantType, m_Plant.PlantHue, m_Plant.ShowType); if (!from.PlaceInBackpack(seed)) { bowl.Delete(); seed.Delete(); m_Plant.LabelTo(from, 1053047); // You cannot empty a bowl with a full pack! from.SendGump(new MainPlantGump(m_Plant)); break; } } m_Plant.Delete(); break; } } }
private void Finish_Callback() { List <DDTeamInfo> teams = new List <DDTeamInfo>(); for (int i = 0; i < m_Context.Participants.Count; ++i) { DDTeamInfo teamInfo = m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length]; if (teamInfo != null) { teams.Add(teamInfo); } } teams.Sort(delegate(DDTeamInfo a, DDTeamInfo b) { return(b.Score - a.Score); }); Tournament tourny = m_Context.m_Tournament; StringBuilder sb = new StringBuilder(); if (tourny != null && tourny.TournyType == TournyType.FreeForAll) { sb.Append(m_Context.Participants.Count * tourny.PlayersPerParticipant); sb.Append("-man FFA"); } else if (tourny != null && tourny.TournyType == TournyType.RandomTeam) { sb.Append(tourny.ParticipantsPerMatch); sb.Append("-team"); } else if (tourny != null && tourny.TournyType == TournyType.RedVsBlue) { sb.Append("Red v Blue"); } else if (tourny != null && tourny.TournyType == TournyType.Faction) { sb.Append(tourny.ParticipantsPerMatch); sb.Append("-team Faction"); } else if (tourny != null) { for (int i = 0; i < tourny.ParticipantsPerMatch; ++i) { if (sb.Length > 0) { sb.Append('v'); } sb.Append(tourny.PlayersPerParticipant); } } if (m_Controller != null) { sb.Append(' ').Append(m_Controller.Title); } string title = sb.ToString(); DDTeamInfo winner = (DDTeamInfo)(teams.Count > 0 ? teams[0] : null); for (int i = 0; i < teams.Count; ++i) { TrophyRank rank = TrophyRank.Bronze; if (i == 0) { rank = TrophyRank.Gold; } else if (i == 1) { rank = TrophyRank.Silver; } DDPlayerInfo leader = ((DDTeamInfo)teams[i]).Leader; foreach (DDPlayerInfo pl in ((DDTeamInfo)teams[i]).Players.Values) { Mobile mob = pl.Player; if (mob == null) { continue; } //"Red v Blue DD Champion" sb = new StringBuilder(); sb.Append(title); if (pl == leader) { sb.Append(" Leader"); } if (pl.Score > 0) { sb.Append(": "); sb.Append(pl.Score.ToString("N0")); sb.Append(pl.Score == 1 ? " point" : " points"); if (pl.Kills > 0) { sb.Append(", "); sb.Append(pl.Kills.ToString("N0")); sb.Append(pl.Kills == 1 ? " kill" : " kills"); } if (pl.Captures > 0) { sb.Append(", "); sb.Append(pl.Captures.ToString("N0")); sb.Append(pl.Captures == 1 ? " capture" : " captures"); } } Item item = new Trophy(sb.ToString(), rank); if (pl == leader) { item.ItemID = 4810; } item.Name = String.Format("{0}, {1} team", item.Name, ((DDTeamInfo)teams[i]).Name.ToLower()); if (!mob.PlaceInBackpack(item)) { mob.BankBox.DropItem(item); } int cash = pl.Score * 250; if (cash > 0) { item = new BankCheck(cash); if (!mob.PlaceInBackpack(item)) { mob.BankBox.DropItem(item); } mob.SendMessage("You have been awarded a {0} trophy and {1:N0}gp for your participation in this tournament.", rank.ToString().ToLower(), cash); } else { mob.SendMessage("You have been awarded a {0} trophy for your participation in this tournament.", rank.ToString().ToLower()); } } } for (int i = 0; i < m_Context.Participants.Count; ++i) { Participant p = m_Context.Participants[i] as Participant; for (int j = 0; j < p.Players.Length; ++j) { DuelPlayer dp = p.Players[j]; if (dp != null && dp.Mobile != null) { dp.Mobile.CloseGump(typeof(DDBoardGump)); dp.Mobile.SendGump(new DDBoardGump(dp.Mobile, this)); } } if (i == winner.TeamID) { continue; } for (int j = 0; j < p.Players.Length; ++j) { if (p.Players[j] != null) { p.Players[j].Eliminated = true; } } } m_Context.Finish(m_Context.Participants[winner.TeamID] as Participant); }
public virtual bool RemoveItem(Mobile from, int at) { if (at < 0 || at >= Items.Count) { return(false); } Item item = 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) { 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. } } InvalidateProperties(); return(true); }
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 ); } } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (!m_Vendor.CanInteractWith(from, false)) { return; } if (m_Vendor.IsOwner(from)) { m_Vendor.SayTo(from, 503212); // You own this shop, just take what you want. return; } if (info.ButtonID == 1) { m_Vendor.Say(from.Name); if (!m_VI.Valid || !m_VI.Item.IsChildOf(m_Vendor.Backpack)) { m_Vendor.SayTo(from, 503216); // You can't buy that. return; } int totalGold = 0; if (from.Backpack != null) { totalGold += from.Backpack.GetAmount(typeof(Gold)); } totalGold += Banker.GetBalance(from); if (totalGold < m_VI.Price) { m_Vendor.SayTo(from, 503205); // You cannot afford this item. } else if (!from.PlaceInBackpack(m_VI.Item)) { m_Vendor.SayTo(from, 503204); // You do not have room in your backpack for this. } else { int leftPrice = m_VI.Price; if (from.Backpack != null) { leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice); } if (leftPrice > 0) { Banker.Withdraw(from, leftPrice); } m_Vendor.HoldGold += m_VI.Price; from.SendLocalizedMessage(503201); // You take the item. } } else { from.SendLocalizedMessage(503207); // Cancelled purchase. } }
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 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 Head) { Head targ = (Head)targeted; if (from.Karma > -1500) { from.SendMessage("Vous n'avez pas le profil d'un dépeceur de crâne..."); return; } if (from.Dex <= Utility.Random(110)) { from.SendMessage("Vous avez été trop maladroit et avez raté le dépeçage"); targ.Delete(); return; } from.SendMessage("Vous achevez d'enlever la chair du crâne."); from.AddToBackpack(new Skull()); targ.Consume(); } else if (targeted is Pumpkin) { Pumpkin targ = (Pumpkin)targeted; if (from.Dex <= Utility.Random(100)) { from.SendMessage("Vous avez été trop maladroit et avez raté votre tracé"); targ.Consume(); return; } int karma = 0; if (from.Karma > 100) { karma++; } else if (from.Karma < -100) { karma--; } int chance = Utility.Random(4) + karma; if (chance >= 2) { from.AddToBackpack(new SmileyPumpkin()); } else { from.AddToBackpack(new EvilPumpkin()); } from.SendMessage("Vous taillez la citrouille selon votre humeur"); targ.Consume(); } 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, 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); if (map.Season == (int)ServerSeasons.Season.Spring && Utility.RandomDouble() < 0.33) { from.PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, false, "De la sève se met à couler du tronc, souhaitez-vous la recueillir?", from.NetState); from.BeginTarget(2, false, TargetFlags.None, new TargetCallback(OnSelectTarget)); return; } 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 override void ProcessKill(Mobile victim, Mobile damager) { BaseCreature bc = victim as BaseCreature; if (!Enabled || bc == null || bc.Controlled || bc.Summoned || !damager.Alive) { return; } Region r = bc.Region; if (damager is PlayerMobile && r.IsPartOf("KotlCity")) { if (!DungeonPoints.ContainsKey(damager)) { DungeonPoints[damager] = 0; } int fame = bc.Fame / 2; int luck = Math.Max(0, ((PlayerMobile)damager).RealLuck); if (bc.Spawner is KotlBattleSimulator) { fame *= 4; } DungeonPoints[damager] += (int)(fame * (1 + Math.Sqrt(luck) / 100)); int x = DungeonPoints[damager]; const double A = 0.000863316841; const double B = 0.00000425531915; double chance = A * Math.Pow(10, B * x); if (chance > Utility.RandomDouble()) { Item i = Loot.RandomArmorOrShieldOrWeaponOrJewelry(LootPackEntry.IsInTokuno(bc), LootPackEntry.IsMondain(bc), LootPackEntry.IsStygian(bc)); if (i != null) { RunicReforging.GenerateRandomItem(i, damager, Math.Max(100, RunicReforging.GetDifficultyFor(bc)), RunicReforging.GetLuckForKiller(bc), ReforgedPrefix.None, ReforgedSuffix.Kotl); damager.PlaySound(0x5B4); damager.SendLocalizedMessage(1062317); // For your valor in combating the fallen beast, a special artifact has been bestowed on you. if (!damager.PlaceInBackpack(i)) { if (damager.BankBox != null && damager.BankBox.TryDropItem(damager, i, false)) { damager.SendLocalizedMessage(1079730); // The item has been placed into your bank box. } else { damager.SendLocalizedMessage(1072523); // You find an artifact, but your backpack and bank are too full to hold it. i.MoveToWorld(damager.Location, damager.Map); } } DungeonPoints.Remove(damager); } } } }
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 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 if (targeted is DragonMarais && ((DragonMarais)targeted).HasBarding) { DragonMarais pet = (DragonMarais)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 { 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(from, map, loc.X, loc.Y, m_Item, tileID); if (bank == null) { return; } if (bank.Current < 5) { from.SendLocalizedMessage(500493); // There's not enough wood here to harvest. } else { bank.Consume(def, 2, loc); Item item = new Kindling(2); 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(); } } } } }
private void Flag_OnTarget(Mobile from, object obj) { if (m_TeamInfo == null) { return; } if (!IsChildOf(from.Backpack)) { return; } CTFTeamInfo ourTeam = m_TeamInfo; CTFTeamInfo useTeam = m_TeamInfo.Game.GetTeamInfo(from); if (obj is CTFFlag) { if (obj == useTeam.Flag) { from.LocalOverheadMessage(MessageType.Regular, 0x59, false, "You captured the cookies!"); m_TeamInfo.Game.Alert("{0} captured the {1} cookies!", from.Name, ourTeam.Name); SendHome(); CTFPlayerInfo playerInfo = useTeam[from]; if (playerInfo != null) { playerInfo.Captures += 1; playerInfo.Score += 50; // capture ConCTFFlag teamFlag = useTeam.Flag; if (teamFlag.m_Fragger != null && DateTime.UtcNow < (teamFlag.m_FragTime + TimeSpan.FromSeconds(5.0)) && m_TeamInfo.Game.GetTeamInfo(teamFlag.m_Fragger) == useTeam) { CTFPlayerInfo assistInfo = useTeam[teamFlag.m_Fragger]; if (assistInfo != null) { assistInfo.Score += 6; // frag assist } } if (teamFlag.m_Returner != null && DateTime.UtcNow < (teamFlag.m_ReturnTime + TimeSpan.FromSeconds(5.0))) { CTFPlayerInfo assistInfo = useTeam[teamFlag.m_Returner]; if (assistInfo != null) { assistInfo.Score += 4; // return assist } } } } else { from.LocalOverheadMessage(MessageType.Regular, 0x26, false, "Those are not my cookies."); } } else if (obj is Mobile) { Mobile passTo = obj as Mobile; CTFTeamInfo passTeam = m_TeamInfo.Game.GetTeamInfo(passTo); if (passTo == from) { from.LocalOverheadMessage(MessageType.Regular, 0x26, false, "I can't pass to them."); } else if (passTeam == useTeam && passTo.PlaceInBackpack(this)) { passTo.LocalOverheadMessage(MessageType.Regular, 0x59, false, String.Format("{0} has passed you the cookies!", from.Name)); } else { from.LocalOverheadMessage(MessageType.Regular, 0x26, false, "I can't pass to them."); } } }
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! } }
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; } }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (info.ButtonID == 0 || m_hive.Deleted || !from.InRange(m_hive.GetWorldLocation(), 3)) { return; } if (!m_hive.IsAccessibleTo(from)) { m_hive.LabelTo(from, "You cannot use that."); return; } switch (info.ButtonID) { case (int)Buttons.butExit: //Exit back to main gump { from.SendGump(new apiBeeHiveMainGump(from, m_hive)); break; } case (int)Buttons.butHoney: //Honey { //ToDo: get hurt or poisoned when harvesting Item hivetool = GetHiveTool(from); if (NeedHiveTool) { if (hivetool == null || !(hivetool is HiveTool)) { m_hive.LabelTo(from, "You need a hive tool to extract the excess honey!"); from.SendGump(new apiBeeHiveProductionGump(from, m_hive)); return; } } if (m_hive.Honey < 3) { m_hive.LabelTo(from, "There isn't enough honey in the hive to fill a bottle!"); from.SendGump(new apiBeeHiveProductionGump(from, m_hive)); break; } Container pack = from.Backpack; if (pack != null && pack.ConsumeTotal(typeof(Bottle), 1)) { JarHoney honey = new JarHoney(); if (!from.PlaceInBackpack(honey)) { honey.Delete(); from.PlaceInBackpack(new Bottle()); //add the consumed bottle m_hive.LabelTo(from, "There is not enough room in your backpack for the honey!"); from.SendGump(new apiBeeHiveProductionGump(from, m_hive)); break; } if (NeedHiveTool) { ((HiveTool)hivetool).UsesRemaining--; if (((HiveTool)hivetool).UsesRemaining < 1) { from.SendMessage("You wear out the hive tool."); hivetool.Delete(); } } m_hive.Honey -= 3; m_hive.LabelTo(from, "You fill a bottle with golden honey and place it in your pack."); from.SendGump(new apiBeeHiveProductionGump(from, m_hive)); break; } else { m_hive.LabelTo(from, "You need a bottle to fill with honey!"); from.SendGump(new apiBeeHiveProductionGump(from, m_hive)); break; } } case (int)Buttons.butWax: //Wax { //ToDo: get hurt or poisoned when harvesting Item hivetool = GetHiveTool(from); if (NeedHiveTool) { if (hivetool == null || !(hivetool is HiveTool)) { m_hive.LabelTo(from, "You need a hive tool to scrape the excess beeswax!"); from.SendGump(new apiBeeHiveProductionGump(from, m_hive)); return; } } if (m_hive.Wax < 1) { m_hive.LabelTo(from, "There isn't enough excess wax in the hive to harvest!"); return; } Item wax; if (PureWax) { wax = new Beeswax(m_hive.Wax); } else { wax = new RawBeeswax(m_hive.Wax); } if (!from.PlaceInBackpack(wax)) { wax.Delete(); m_hive.LabelTo(from, "There is not enough room in your backpack for the wax!"); from.SendGump(new apiBeeHiveProductionGump(from, m_hive)); break; } if (NeedHiveTool) { ((HiveTool)hivetool).UsesRemaining--; if (((HiveTool)hivetool).UsesRemaining < 1) { from.SendMessage("You wear out the hive tool."); hivetool.Delete(); } } m_hive.Wax = 0; m_hive.LabelTo(from, "You collect the excess beeswax and place it in your pack."); from.SendGump(new apiBeeHiveProductionGump(from, m_hive)); break; } } }
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 void UndressItem( Mobile m, Layer layer ) { Item item = m.FindItemOnLayer( layer ); if ( item != null && item.Movable ) m.PlaceInBackpack( item ); }
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 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 override void OnComponentUsed(AddonComponent c, Mobile from) { var house = HousingHelper.FindHouseAt(this); 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 ShadowIronIngot(); 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(9)) { 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; } 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 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(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. } else if (house?.HasSecureAccess(from, SecureLevel.Friends) == true) { switch (CartType) { case MiningCartType.OreSouth: case MiningCartType.OreEast: if (Ore > 0) { var ingots = Utility.Random(9) switch { 0 => (Item) new IronIngot(), 1 => new DullCopperIngot(), 2 => new ShadowIronIngot(), 3 => new CopperIngot(), 4 => new BronzeIngot(), 5 => new GoldIngot(), 6 => new AgapiteIngot(), 7 => new VeriteIngot(), 8 => new ValoriteIngot(), _ => null }; int amount = Math.Min(10, 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~ Ore -= amount; } } else { from.SendLocalizedMessage(1094725); // There are no more resources available at this time. } break; case MiningCartType.GemSouth: case MiningCartType.GemEast: if (Gems > 0) { var gems = Utility.Random(15) switch { 0 => (Item) new Amber(), 1 => new Amethyst(), 2 => new Citrine(), 3 => new Diamond(), 4 => new Emerald(), 5 => new Ruby(), 6 => new Sapphire(), 7 => new StarSapphire(), 8 => new Tourmaline(), // Mondain's Legacy gems 9 => new PerfectEmerald(), 10 => new DarkSapphire(), 11 => new Turquoise(), 12 => new EcruCitrine(), 13 => new FireRuby(), 14 => new BlueDiamond(), _ => null }; int amount = Math.Min(5, 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~ 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 void OnResponse(NetState sender, RelayInfo info) { if (m_Item.Deleted) { return; } Mobile from = sender.Mobile; int id = info.ButtonID; GameBoard board = m_Item.Board; switch (id) { case 5: // move up { if (m_SelectedRow == -1) { return; } board.GamePanel.MoveUp(m_SelectedRow); board.CurrentMovements++; from.PlaySound(0xFA); from.SendGump(new PuzzleBoardGump(m_Item, m_SelectedRow)); break; } case 6: // move down { if (m_SelectedRow == -1) { return; } board.GamePanel.MoveDown(m_SelectedRow); board.CurrentMovements++; from.PlaySound(0xFA); from.SendGump(new PuzzleBoardGump(m_Item, m_SelectedRow)); break; } case 7: // apply { if (board.IsCorrect()) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "Correct Code Entered. Crystal Lock Disengaged."); from.PlaySound(0xF7); m_Item.Delete(); Item reward; switch (Utility.Random(10)) { default: case 0: reward = new VoidEssence(30); break; case 1: reward = new SilverSerpentVenom(30); break; case 2: reward = new ScouringToxin(30); break; case 3: reward = new ToxicVenomSac(30); break; case 4: reward = new KneadingBowl(); break; case 5: reward = new TotemPole(); break; case 6: reward = new DustyPillow(); break; case 7: reward = new Plinth(); break; case 8: reward = new FlouredBreadBoard(); break; case 9: reward = new LuckyCoin(); break; } from.PlaceInBackpack(reward); PlayerMobile pm = from as PlayerMobile; if (pm != null && !Misc.TestCenter.Enabled) { pm.NextPuzzleAttempt = DateTime.UtcNow + TimeSpan.FromDays(1.0); } } else { m_Item.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Incorrect Code Sequence. Access Denied"); from.PlaySound(0xFD); } break; } case 8: // cancel { board.Reset(); from.PlaySound(0xFB); from.SendGump(new PuzzleBoardGump(m_Item, -1)); break; } default: { if (id >= 1 && id <= 4) { from.SendGump(new PuzzleBoardGump(m_Item, id - 1)); } break; } } }
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 ); } }
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 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, 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(def, 5); 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 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 OnResponse(NetState sender, RelayInfo info) { if (info.ButtonID == 0) { return; } Mobile from = sender.Mobile; HouseSign sign = m_House.Sign; if (m_House.Deleted || sign == null || sign.Deleted || !from.CheckAlive()) { return; } if (from.Map != sign.Map || !from.InRange(sign, 5)) { from.SendLocalizedMessage(1062429); // You must be within five paces of the house sign to use this option. return; } int index = info.ButtonID - 1; if (index < 0 || index >= m_Inventories.Count) { return; } VendorInventory inventory = (VendorInventory)m_Inventories[index]; if (inventory.Owner != from || !m_House.VendorInventories.Contains(inventory)) { return; } int totalItems = 0; int givenToBackpack = 0; int givenToBankBox = 0; for (int i = inventory.Items.Count - 1; i >= 0; i--) { Item item = inventory.Items[i]; if (item.Deleted) { inventory.Items.RemoveAt(i); continue; } totalItems += 1 + item.TotalItems; if (from.PlaceInBackpack(item)) { inventory.Items.RemoveAt(i); givenToBackpack += 1 + item.TotalItems; } else if (from.BankBox.TryDropItem(from, item, false)) { inventory.Items.RemoveAt(i); givenToBankBox += 1 + item.TotalItems; } } from.SendLocalizedMessage(1062436, totalItems + "\t" + inventory.Gold); // The vendor you selected had ~1_COUNT~ items in its inventory, and ~2_AMOUNT~ gold in its account. int givenGold = Banker.DepositUpTo(from, inventory.Gold); inventory.Gold -= givenGold; from.SendLocalizedMessage(1060397, givenGold.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box. from.SendLocalizedMessage(1062437, givenToBackpack + "\t" + givenToBankBox); // ~1_COUNT~ items have been removed from the shop inventory and placed in your backpack. ~2_BANKCOUNT~ items were removed from the shop inventory and placed in your bank box. if (inventory.Gold > 0 || inventory.Items.Count > 0) { from.SendLocalizedMessage(1062440); // Some of the shop inventory would not fit in your backpack or bank box. Please free up some room and try again. } else { inventory.Delete(); from.SendLocalizedMessage(1062438); // The shop is now empty of inventory and funds, so it has been deleted. } }
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); }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (info.ButtonID == 0 || this.m_Plant.Deleted || this.m_Plant.PlantStatus >= PlantStatus.DecorativePlant || this.m_Plant.PlantStatus == PlantStatus.BowlOfDirt) { return; } if ((info.ButtonID >= 6 && info.ButtonID <= 8) && !from.InRange(this.m_Plant.GetWorldLocation(), 3)) { from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 500446); // That is too far away. return; } if (!this.m_Plant.IsUsableBy(from)) { this.m_Plant.LabelTo(from, 1061856); // You must have the item in your backpack or locked down in order to use it. return; } switch (info.ButtonID) { case 1: // Main menu { from.SendGump(new MainPlantGump(this.m_Plant)); break; } case 2: // Set to decorative { if (this.m_Plant.PlantStatus == PlantStatus.Stage9) { from.SendGump(new SetToDecorativeGump(this.m_Plant)); } break; } case 3: // Pollination { from.Send(new DisplayHelpTopic(67, true)); // POLLINATION STATE from.SendGump(new ReproductionGump(this.m_Plant)); break; } case 4: // Resources { from.Send(new DisplayHelpTopic(69, true)); // RESOURCE PRODUCTION from.SendGump(new ReproductionGump(this.m_Plant)); break; } case 5: // Seeds { from.Send(new DisplayHelpTopic(68, true)); // SEED PRODUCTION from.SendGump(new ReproductionGump(this.m_Plant)); break; } case 6: // Gather pollen { if (!this.m_Plant.IsCrossable) { this.m_Plant.LabelTo(from, 1053050); // You cannot gather pollen from a mutated plant! } else if (!this.m_Plant.PlantSystem.PollenProducing) { this.m_Plant.LabelTo(from, 1053051); // You cannot gather pollen from a plant in this stage of development! } else if (this.m_Plant.PlantSystem.Health < PlantHealth.Healthy) { this.m_Plant.LabelTo(from, 1053052); // You cannot gather pollen from an unhealthy plant! } else { from.Target = new PollinateTarget(this.m_Plant); from.SendLocalizedMessage(1053054); // Target the plant you wish to cross-pollinate to. break; } from.SendGump(new ReproductionGump(this.m_Plant)); break; } case 7: // Gather resources { PlantResourceInfo resInfo = PlantResourceInfo.GetInfo(this.m_Plant.PlantType, this.m_Plant.PlantHue); PlantSystem system = this.m_Plant.PlantSystem; if (resInfo == null) { if (this.m_Plant.IsCrossable) { this.m_Plant.LabelTo(from, 1053056); // This plant has no resources to gather! } else { this.m_Plant.LabelTo(from, 1053055); // Mutated plants do not produce resources! } } else if (system.AvailableResources == 0) { this.m_Plant.LabelTo(from, 1053056); // This plant has no resources to gather! } else { Item resource = resInfo.CreateResource(); if (from.PlaceInBackpack(resource)) { system.AvailableResources--; this.m_Plant.LabelTo(from, 1053059); // You gather resources from the plant. } else { resource.Delete(); this.m_Plant.LabelTo(from, 1053058); // You attempt to gather as many resources as you can hold, but your backpack is full. } } from.SendGump(new ReproductionGump(this.m_Plant)); break; } case 8: // Gather seeds { PlantSystem system = this.m_Plant.PlantSystem; if (!this.m_Plant.IsCrossable) { this.m_Plant.LabelTo(from, 1053060); // Mutated plants do not produce seeds! } else if (system.AvailableSeeds == 0) { this.m_Plant.LabelTo(from, 1053061); // This plant has no seeds to gather! } else { Seed seed = new Seed(system.SeedType, system.SeedHue, true); if (from.PlaceInBackpack(seed)) { system.AvailableSeeds--; this.m_Plant.LabelTo(from, 1053063); // You gather seeds from the plant. } else { seed.Delete(); this.m_Plant.LabelTo(from, 1053062); // You attempt to gather as many seeds as you can hold, but your backpack is full. } } from.SendGump(new ReproductionGump(this.m_Plant)); break; } } }