public override void AddContents(BaseContainer cont, Mobile creature, out int contentValue) { base.AddContents(cont, creature, out contentValue); if (m_RuneChance > Utility.RandomDouble()) { cont.DropItem(new RecallRune()); } int scrollcount = Utility.RandomMinMax(MinAmount / 25, MaxAmount / 8); for (int i = 0; i < scrollcount; i++) { if ((m_RuneChance / 3.0) > Utility.RandomDouble()) { Item item = null; switch (Utility.Random(5)) { default: case 0: case 1: case 2: item = new RecallScroll(); break; case 3: item = new MarkScroll(); break; case 4: item = new GateTravelScroll(); break; } cont.DropItem(item); } } }
protected override void OnTarget(Mobile from, object targeted) { if (from == null || Item == null || Item.Deleted) { return; } if (targeted is Item) { Item item = targeted as Item; if (!item.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1054107); // This item must be in your backpack. return; } if (item is GateTravelScroll) { GateTravelScroll scroll = item as GateTravelScroll; if (Item.Charges >= MaxCharges) { from.SendLocalizedMessage(1115126); // The House Teleporter cannot be charged any further. } else { int left = MaxCharges - Item.Charges; int scrollsNeeded = Math.Max(1, left / 5); if (scroll.Amount <= scrollsNeeded) { Item.Charges = Math.Min(MaxCharges, Item.Charges + (scroll.Amount * 5)); scroll.Delete(); } else { scroll.Amount -= scrollsNeeded; Item.Charges = MaxCharges; } from.SendLocalizedMessage(1115127); // The Gate Travel scroll crumbles to dust as it strengthens the House Teleporter. } } else { from.SendLocalizedMessage(1158898); // Target gate scroll to recharge the teleporter. } } }