public override Item CreateBulkOrder(Mobile from, bool fromContextMenu) { AnimalBODModule module = from.GetModule(typeof(AnimalBODModule)) as AnimalBODModule ?? new AnimalBODModule(from); if (from != null && module.NextTamingBulkOrder == TimeSpan.Zero && (fromContextMenu || 0.2 > Utility.RandomDouble())) { double theirSkill = from.Skills[SkillName.AnimalTaming].Base; if (theirSkill >= 70.1) { module.NextTamingBulkOrder = TimeSpan.FromMinutes(60.0); } else if (theirSkill >= 50.1) { module.NextTamingBulkOrder = TimeSpan.FromMinutes(30.0); } else { module.NextTamingBulkOrder = TimeSpan.FromMinutes(15.0); } if (theirSkill >= 70.1 && ((theirSkill - 40.0) / 300.0) > Utility.RandomDouble()) { return(new LargeTamingBOD()); } return(SmallTamingBOD.CreateRandomFor(from)); } return(null); }
public override Item CreateBulkOrder(Mobile from, bool fromContextMenu) { PlayerMobile pm = from as PlayerMobile; if (pm != null && pm.NextTamingBulkOrder == TimeSpan.Zero && (fromContextMenu || 0.2 > Utility.RandomDouble())) { double theirSkill = pm.Skills[SkillName.AnimalTaming].Base; if (theirSkill >= 70.1) { pm.NextTamingBulkOrder = TimeSpan.FromMinutes(0.0); } else if (theirSkill >= 50.1) { pm.NextTamingBulkOrder = TimeSpan.FromMinutes(0.0); } else { pm.NextTamingBulkOrder = TimeSpan.FromMinutes(0.0); } if (theirSkill >= 70.1 && ((theirSkill - 40.0) / 300.0) > Utility.RandomDouble()) { return(new LargeTamingBOD()); } return(SmallTamingBOD.CreateRandomFor(from)); } return(null); }
//this generates an item from what is stored in the entry. Note no exception handling public override Item GenerateItem() { //TODO: have this do nothing, and have child constructors do the work? SmallTamingBOD bod = (SmallTamingBOD)Activator.CreateInstance(_Type, new object[] { _AmountCur, _AmountMax, _BODFillType, _AnimalName, _Graphic }); return(bod); }
//master constructor public SmallBODMobileListEntry(Item item) : base(item) { SmallTamingBOD bod = (SmallTamingBOD)item; _AmountCur = bod.AmountCur; _AmountMax = bod.AmountMax; _BODFillType = bod.Type; _Graphic = bod.Graphic; _AnimalName = bod.AnimalName; }
public override void OnDoubleClick(Mobile from) { if (!from.InRange(GetWorldLocation(), 2)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. } else if (m_Deed > 0) { Item Deed = null; switch (Utility.Random(6)) { case 0: Deed = new LargeSmithBOD(); break; case 1: Deed = new SmallSmithBOD(); break; case 2: Deed = new LargeTailorBOD(); break; case 3: Deed = new SmallTailorBOD(); break; case 4: Deed = new SmallTamingBOD(); break; case 5: Deed = new LargeTamingBOD(); break; } int amount = Math.Min(1, m_Deed); Deed.Amount = amount; if (!from.PlaceInBackpack(Deed)) { Deed.Delete(); from.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again. } else { m_Deed -= amount; PublicOverheadMessage(MessageType.Regular, 0x3B2, 503201); // You take the item. } } else { from.SendMessage("There are no more BOD's available."); // There are no more BOD's available. } }
//this checks if the item you're attempting to create with is proper. The child classes define specifics for this public override bool AllGood(Item item) { if (!base.AllGood(item)) { return(false); } if (!(item is SmallTamingBOD)) { return(false); } SmallTamingBOD bod = (SmallTamingBOD)item; if (bod.Type == null) { return(false); } //TODO: test for bod stuff here? return(true); }