//this generates an item from what is stored in the entry. Note no exception handling public override Item GenerateItem() { LargeTamingBOD bod = (LargeTamingBOD)Activator.CreateInstance(_Type, new object[] { _AmountMax, _Entries }); //attach the large bod to the entries for (int i = 0; i < bod.Entries.Length; i++) { bod.Entries[i].Owner = bod; } return(bod); }
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 LargeTamingBOD)) { return(false); } LargeTamingBOD bod = (LargeTamingBOD)item; //TODO: test for bod stuff here? return(true); }
//master constructor public LargeBODMobileListEntry(Item item) : base(item) { LargeTamingBOD bod = (LargeTamingBOD)item; _AmountMax = bod.AmountMax; //proper cloning is required _Entries = new LargeMobileBulkEntry[bod.Entries.Length]; for (int i = 0; i < bod.Entries.Length; i++) { _Entries[i] = new LargeMobileBulkEntry(null, bod.Entries[i].Details); _Entries[i].Amount = bod.Entries[i].Amount; } //this produces the name for the bod based on the bod name definitions GenerateContentsName(); }