public void AddRune(Mobile from, RecallRune dropped) { if (Entries.Count < 16) { RecallRune rune = dropped; if (rune.Marked && rune.TargetMap != null) { Entries.Add(new RunebookEntry(rune.Target, rune.TargetMap, rune.Description, rune.House)); dropped.Delete(); from.Send(new PlaySound(0x42, GetWorldLocation())); string desc = rune.Description; if (desc == null || (desc = desc.Trim()).Length == 0) desc = "(nondescript)"; from.SendMessage(desc); } else { from.SendLocalizedMessage(502409); // This rune does not have a marked location. } } else { from.SendLocalizedMessage(502401); // This runebook is full. } }
public void AddRune(Mobile from, RecallRune dropped) { if (Entries.Count < 16) { RecallRune rune = dropped; if (rune.Marked && rune.TargetMap != null) { Entries.Add(new RunebookEntry(rune.Target, rune.TargetMap, rune.Description, rune.House)); dropped.Delete(); from.Send(new PlaySound(0x42, GetWorldLocation())); string desc = rune.Description; if (desc == null || (desc = desc.Trim()).Length == 0) { desc = "(nondescript)"; } from.SendMessage(desc); } else { from.SendLocalizedMessage(502409); // This rune does not have a marked location. } } else { from.SendLocalizedMessage(502401); // This runebook is full. } }
public bool AddRune(Mobile m, RecallRune rune, bool message) { if (m == null || m.Deleted || rune == null || rune.Deleted) { return false; } if (!rune.Marked || rune.Target == Point3D.Zero || rune.TargetMap == Map.Internal) { if (message) { m.SendMessage("That rune is blank."); } return false; } if (Entries.Count >= Entries.Capacity) { if (message) { m.SendMessage("The category \"{0}\" can't hold more runes.", _Name); } return false; } Entries.ForEach( (e, x, y) => { if (e != null || rune.Deleted) { return; } Entries.SetContent(x, y, new RuneCodexEntry(rune.Name, rune.Description, rune.Target.ToMapPoint(rune.TargetMap))); rune.Delete(); }); if (message) { m.SendMessage("You add the rune to the rune codex category \"{0}\".", _Name); } return true; }
public override bool OnDragDrop(Mobile from, Item dropped) { if (dropped is RecallRune) { RecallRune recallRune = dropped as RecallRune; if (IsLockedDown && !HasChargeAccess(from) && from.AccessLevel == AccessLevel.Player) { from.SendMessage("You do not have the neccessary access rights to do that."); } else if (IsOpen(from)) { from.SendMessage("You cannot alter that runebook while viewing it's contents."); } else if (m_RecallRuneEntries.Count >= RuneTome.MaxEntries) { from.SendMessage("This rune tome is at it's maximum capacity."); } else { if (recallRune.Marked && recallRune.TargetMap != null) { RuneTomeRuneEntry recallRuneEntry = new RuneTomeRuneEntry(false, recallRune.Description, recallRune.Target, recallRune.TargetMap, recallRune.House); if (m_RecallRuneEntries.Count == 0) { recallRuneEntry.m_IsDefaultRune = true; } m_RecallRuneEntries.Add(recallRuneEntry); recallRune.Delete(); from.SendSound(0x42); from.SendMessage("You add the rune to the rune tome."); return(true); } else { from.SendMessage("That recall rune is not marked."); } } } if (dropped is RecallScroll) { if (m_RecallCharges >= MaxRecallCharges) { from.SendMessage("That rune tome is at it's maximum number of stored recall charges."); } else { int availableCharges = MaxRecallCharges - RecallCharges; int scrollChargeValue = dropped.Amount * RecallChargesPerScroll; if (availableCharges >= scrollChargeValue) { RecallCharges += scrollChargeValue; from.SendMessage("You add " + scrollChargeValue.ToString() + " recall charges to the rune tome."); from.SendSound(0x249); dropped.Delete(); } else { int scrollsUsed = (int)(Math.Ceiling((double)availableCharges / (double)RecallChargesPerScroll)); int chargesAdded = (scrollsUsed * RecallChargesPerScroll); m_RecallCharges += chargesAdded; if (RecallCharges > MaxRecallCharges) { RecallCharges = MaxRecallCharges; } from.SendMessage("You add " + chargesAdded.ToString() + " recall charges to the rune tome."); from.SendSound(0x249); dropped.Consume(scrollsUsed); } } } if (dropped is GateTravelScroll) { if (m_GateCharges >= MaxGateCharges) { from.SendMessage("That rune tome is at it's maximum number of stored gate charges."); } else { int availableCharges = MaxGateCharges - GateCharges; int scrollChargeValue = dropped.Amount * GateChargesPerScroll; if (availableCharges >= scrollChargeValue) { GateCharges += scrollChargeValue; from.SendMessage("You add " + scrollChargeValue.ToString() + " gate charges to the rune tome."); from.SendSound(0x249); dropped.Delete(); } else { int scrollsUsed = (int)(Math.Ceiling((double)availableCharges / (double)GateChargesPerScroll)); int chargesAdded = (scrollsUsed * GateChargesPerScroll); GateCharges += chargesAdded; if (GateCharges > MaxGateCharges) { GateCharges = MaxGateCharges; } from.SendMessage("You add " + chargesAdded.ToString() + " gate charges to the rune tome."); from.SendSound(0x249); dropped.Consume(scrollsUsed); } } } return(false); }
public bool TryMarkRune(RecallRune rune, Mobile from) { ShipRune newRune = new ShipRune(this); Container c = rune.Parent as Container; newRune.Location = rune.Location; if (c != null) c.AddItem(newRune); else c.MoveToWorld(from.Location, from.Map); rune.Delete(); return true; }