Ejemplo n.º 1
0
        public override void OnDoubleClick(Mobile from)
        {
            BraceletOfBinding bound = this.Bound;

            if (Bound == null)
            {
                Bind(from);
            }
            else
            {
                Activate(from);
            }
        }
Ejemplo n.º 2
0
        public override void GetContextMenuEntries(Mobile from, List <ContextMenuEntry> list)
        {
            base.GetContextMenuEntries(from, list);

            if (from.Alive && IsChildOf(from))
            {
                BraceletOfBinding bound = 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));
            }
        }
Ejemplo n.º 3
0
        public void Search(Mobile from)
        {
            BraceletOfBinding bound = Bound;

            if (Deleted || bound == null)
            {
                return;
            }

            if (!IsChildOf(from))
            {
                from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it.
            }
            else
            {
                CheckUse(from, true);
            }
        }
Ejemplo n.º 4
0
        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();
                Bound         = (BraceletOfBinding)reader.ReadItem();
            }
            break;
            }
        }
Ejemplo n.º 5
0
            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.GetType() == typeof(BraceletOfBinding))
                {
                    BraceletOfBinding bindBracelet = targeted as BraceletOfBinding;

                    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(0xF9);

                        m_Bracelet.Bound = bindBracelet;
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1054002); // You can only bind this bracelet to another bracelet of binding!
                }
            }
Ejemplo n.º 6
0
 public BindTarget(BraceletOfBinding bracelet)
     : base(-1, false, TargetFlags.None)
 {
     m_Bracelet = bracelet;
 }
Ejemplo n.º 7
0
 public TransportTimer(BraceletOfBinding bracelet, Mobile from)
     : base(TimeSpan.FromSeconds(2.0))
 {
     m_Bracelet = bracelet;
     m_From     = from;
 }
Ejemplo n.º 8
0
        private bool CheckUse(Mobile from, bool successMessage)
        {
            BraceletOfBinding bound = 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 (!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 (SpellHelper.RestrictRedTravel && from.Murderer && 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 (Server.Misc.WeightOverloading.IsOverloaded(from))
            {
                from.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
                return(false);
            }
            else if (from.Region.IsPartOf <Server.Regions.Jail>())
            {
                from.SendLocalizedMessage(1114345, "", 0x35); // You'll need a better jailbreak plan than that!
                return(false);
            }
            else if (boundRoot.Region.IsPartOf <Server.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);
            }
        }
Ejemplo n.º 9
0
		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;
				}
			}
		}
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadEncodedInt();

			m_Charges = reader.ReadEncodedInt();
			m_Inscription = reader.ReadString();
			this.Bound = (BraceletOfBinding) reader.ReadItem();
		}
Ejemplo n.º 11
0
			public BindTarget( BraceletOfBinding bracelet ) : base( -1, false, TargetFlags.None )
			{
				m_Bracelet = bracelet;
			}
Ejemplo n.º 12
0
			public TransportTimer( BraceletOfBinding bracelet, Mobile from ) : base( TimeSpan.FromSeconds( 2.0 ) )
			{
				m_Bracelet = bracelet;
				m_From = from;
			}
Ejemplo n.º 13
0
 public BindEntry(PlayerMobile m, BraceletOfBinding bracelet)
 {
     Mobile   = m;
     Bracelet = bracelet;
 }
Ejemplo n.º 14
0
            public override void OnResponse(RelayInfo info)
            {
                switch (info.ButtonID)
                {
                case 1:
                    if (RemoveFromBracelet)
                    {
                        GreaterBraceletOfBinding bracelet = User.FindItemOnLayer(Layer.Bracelet) as GreaterBraceletOfBinding;

                        if (bracelet != null && bracelet.Friends[Index] != null)
                        {
                            var entry = bracelet.Friends[Index];

                            if (entry.Bracelet is GreaterBraceletOfBinding)
                            {
                                PlayerMobile             pm  = entry.Mobile;
                                GreaterBraceletOfBinding gbr = entry.Bracelet as GreaterBraceletOfBinding;

                                gbr.Remove(User);

                                if (pm != null && pm.NetState != null)
                                {
                                    var gump = pm.FindGump <GreaterBraceletOfBindingGump>();

                                    if (gump != null)
                                    {
                                        gump.Refresh();
                                    }
                                }
                            }

                            bracelet.Remove(entry.Mobile);
                            BaseGump.SendGump(new GreaterBraceletOfBindingGump(User, bracelet));
                        }
                    }
                    else
                    {
                        BraceletOfBinding brac = User.FindItemOnLayer(Layer.Bracelet) as BraceletOfBinding;

                        if (brac != null)
                        {
                            var entry = new BindEntry(User, brac);
                            Bracelet.Add(entry, Index);

                            var g = From.FindGump <GreaterBraceletOfBindingGump>();

                            if (g != null)
                            {
                                g.Refresh();
                            }

                            if (brac is GreaterBraceletOfBinding && !((GreaterBraceletOfBinding)brac).IsBound(From))
                            {
                                entry = new BindEntry(From, Bracelet);
                                ((GreaterBraceletOfBinding)brac).Pending = entry;

                                BaseGump.SendGump(new GreaterBraceletOfBindingGump(User, (GreaterBraceletOfBinding)brac, entry));
                            }
                            else
                            {
                                brac.Bound = Bracelet;
                            }
                        }
                        else
                        {
                            User.SendLocalizedMessage(1151772);     // You must be wearing this item to bind to another character.
                            From.SendLocalizedMessage(1151771);     // The target player must be wearing a Bracelet of Binding or Greater Bracelet of Binding for the device to work.
                        }
                    }
                    break;

                case 2:
                    if (!RemoveFromBracelet)
                    {
                        From.SendLocalizedMessage(1151778, User.Name);     // ~1_val~ has declined your request to bind bracelets.
                    }
                    break;
                }
            }
Ejemplo n.º 15
0
            public override void OnResponse(RelayInfo info)
            {
                if (info.ButtonID == 0)
                {
                    return;
                }

                int id = info.ButtonID - 10;

                if (id >= 0 && id < Bracelet.Friends.Length)
                {
                    if (Bracelet.Friends[id] == null)
                    {
                        if (Choose)
                        {
                            Bracelet.Add(Entry, id);
                            Choose = false;

                            Refresh();
                        }
                        else if (!Bracelet.IsFull)
                        {
                            User.BeginTarget(10, false, TargetFlags.None, (from, targeted) =>
                            {
                                if (targeted is PlayerMobile)
                                {
                                    PlayerMobile pm          = targeted as PlayerMobile;
                                    BraceletOfBinding pmBrac = pm.FindItemOnLayer(Layer.Bracelet) as BraceletOfBinding;

                                    if (pm == User)
                                    {
                                        User.SendLocalizedMessage(1151779);     // The bracelet cannot bind with itself.
                                    }
                                    else if (Bracelet.IsBound(pm))
                                    {
                                        User.SendLocalizedMessage(1151770);     // This bracelet is already bound to this character.
                                    }
                                    else if (!User.Items.Contains(Bracelet))
                                    {
                                        User.SendLocalizedMessage(1151772);     // You must be wearing this item to bind to another character.
                                    }
                                    else if (pmBrac == null)
                                    {
                                        User.SendLocalizedMessage(1151771);     // The target player must be wearing a Bracelet of Binding or Greater Bracelet of Binding for the device to work.
                                    }
                                    else if (pm.HasGump(typeof(ConfirmBindGump)) || (pmBrac is GreaterBraceletOfBinding && ((GreaterBraceletOfBinding)pmBrac).Pending != null))
                                    {
                                        User.SendLocalizedMessage(1151833);     // You may not get confirmation from this player at this time.
                                    }
                                    else if ((pmBrac is GreaterBraceletOfBinding && ((GreaterBraceletOfBinding)pmBrac).IsFull) || (!(pmBrac is GreaterBraceletOfBinding) && pmBrac.Bound != null))
                                    {
                                        User.SendLocalizedMessage(1151781);     // The target player's greater bracelet of binding is full.
                                    }
                                    else
                                    {
                                        User.SendLocalizedMessage(1151777, pm.Name);     // Waiting for ~1_val~ to respond.
                                        Refresh();

                                        BaseGump.SendGump(new ConfirmBindGump(pm, User, id, Bracelet, false));
                                    }
                                }
                                else
                                {
                                    User.SendLocalizedMessage(1151775);     // You may not bind your bracelet to that.
                                }
                            });
                        }
                    }
                    else
                    {
                        Bracelet.Bound = Bracelet.Friends[id].Bracelet;
                        Bracelet.Activate(User);
                    }
                }
                else
                {
                    id = info.ButtonID - 100;

                    if (id >= 0 && id < Bracelet.Friends.Length && Bracelet.Friends[id] != null)
                    {
                        BaseGump.SendGump(new ConfirmBindGump(User, Bracelet.Friends[id].Mobile, id, Bracelet.Friends[id].Bracelet as GreaterBraceletOfBinding, true));
                    }
                }
            }
Ejemplo n.º 16
0
        private bool CheckUse(Mobile from, bool successMessage)
        {
            BraceletOfBinding bound = 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 (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 (from.Region is CustomRegion && !((CustomRegion)from.Region).Controller.CanUseStuckMenu)
            {
                from.SendAsciiMessage("You can't use the bracelet in this region");
                return(false);
            }
            else if (boundRoot.Region is CustomRegion && !((CustomRegion)boundRoot.Region).Controller.CanUseStuckMenu)
            {
                from.SendLocalizedMessage(1019004); // You are not allowed to travel there.
                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 ( Misc.NotorietyHandlers.IsGuardCandidate(from) && 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 (WeightOverloading.IsOverloaded(from))
            {
                from.SendLocalizedMessage(502359, "", 0x22);                   // Thou art too encumbered to move.
                return(false);
            }
            else if (from.Region.IsPartOf(typeof(Jail)))
            {
                from.SendLocalizedMessage(1114345, "", 0x35); // You'll need a better jailbreak plan than that!
                return(false);
            }
            else if (boundRoot.Region.IsPartOf(typeof(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);
            }
        }
Ejemplo n.º 17
0
 public InscribePrompt(BraceletOfBinding bracelet)
 {
     m_Bracelet = bracelet;
 }
Ejemplo n.º 18
0
			public InscribePrompt( BraceletOfBinding bracelet )
			{
				m_Bracelet = bracelet;
			}