public override void GetContextMenuEntries(Mobile from, List <ContextMenuEntry> list) { base.GetContextMenuEntries(from, list); if (from.Alive && this.IsChildOf(from)) { BraceletOfBinding bound = this.Bound; list.Add(new BraceletEntry(new BraceletCallback(Activate), 6170, bound != null)); list.Add(new BraceletEntry(new BraceletCallback(Search), 6171, bound != null)); list.Add(new BraceletEntry(new BraceletCallback(Bind), bound == null ? 6173 : 6174, true)); list.Add(new BraceletEntry(new BraceletCallback(Inscribe), 6175, true)); } }
public void Search(Mobile from) { BraceletOfBinding bound = this.Bound; if (Deleted || bound == null) { return; } if (!this.IsChildOf(from)) { from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it. } else { CheckUse(from, true); } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadEncodedInt(); switch (version) { case 1: { m_Recharges = reader.ReadEncodedInt(); goto case 0; } case 0: { m_Charges = Math.Min(reader.ReadEncodedInt(), MaxCharges); m_Inscription = reader.ReadString(); this.Bound = (BraceletOfBinding)reader.ReadItem(); break; } } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Bracelet.Deleted) { return; } if (!m_Bracelet.IsChildOf(from)) { from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it. } else if (targeted is BraceletOfBinding) { BraceletOfBinding bindBracelet = (BraceletOfBinding)targeted; if (bindBracelet == m_Bracelet) { from.SendLocalizedMessage(1054012); // You cannot bind a bracelet of binding to itself! } else if (!bindBracelet.IsChildOf(from)) { from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it. } else { from.SendLocalizedMessage(1054003); // You bind the bracelet to its counterpart. The bracelets glow with power. from.PlaySound(0x1FA); m_Bracelet.Bound = bindBracelet; } } else { from.SendLocalizedMessage(1054002); // You can only bind this bracelet to another bracelet of binding! } }
public InscribePrompt(BraceletOfBinding bracelet) { m_Bracelet = bracelet; }
public BindTarget(BraceletOfBinding bracelet) : base(-1, false, TargetFlags.None) { m_Bracelet = bracelet; }
private bool CheckUse(Mobile from, bool successMessage) { BraceletOfBinding bound = this.Bound; if (bound == null) { return(false); } Mobile boundRoot = bound.RootParent as Mobile; if (Charges == 0) { from.SendLocalizedMessage(1054005); // The bracelet glows black. It must be charged before it can be used again. return(false); } else if (from.FindItemOnLayer(Layer.Bracelet) != this) { from.SendLocalizedMessage(1054004); // You must equip the bracelet in order to use its power. return(false); } else if (boundRoot == null || boundRoot.NetState == null || boundRoot.FindItemOnLayer(Layer.Bracelet) != bound) { from.SendLocalizedMessage(1054006); // The bracelet emits a red glow. The bracelet's twin is not available for transport. return(false); } else if (!Core.AOS && from.Map != boundRoot.Map) { from.SendLocalizedMessage(1054014); // The bracelet glows black. The bracelet's target is on another facet. return(false); } else if (Factions.Sigil.ExistsOn(from)) { from.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. return(false); } else if (!SpellHelper.CheckTravel(from, TravelCheckType.RecallFrom)) { return(false); } else if (!SpellHelper.CheckTravel(from, boundRoot.Map, boundRoot.Location, TravelCheckType.RecallTo)) { return(false); } else if (boundRoot.Map == Map.Felucca && from is PlayerMobile && ((PlayerMobile)from).Young) { from.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young. return(false); } else if (from.Kills >= 5 && boundRoot.Map != Map.Felucca) { from.SendLocalizedMessage(1019004); // You are not allowed to travel there. return(false); } else if (from.Criminal) { from.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. return(false); } else if (SpellHelper.CheckCombat(from)) { from.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? return(false); } else if (UltimaOnline.Misc.WeightOverloading.IsOverloaded(from)) { from.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move. return(false); } else if (from.Region.IsPartOf(typeof(UltimaOnline.Regions.Jail))) { from.SendLocalizedMessage(1114345, "", 0x35); // You'll need a better jailbreak plan than that! return(false); } else if (boundRoot.Region.IsPartOf(typeof(UltimaOnline.Regions.Jail))) { from.SendLocalizedMessage(1019004); // You are not allowed to travel there. return(false); } else { if (successMessage) { from.SendLocalizedMessage(1054015); // The bracelet's twin is available for transport. } return(true); } }
public TransportTimer(BraceletOfBinding bracelet, Mobile from) : base(TimeSpan.FromSeconds(2.0)) { m_Bracelet = bracelet; m_From = from; }