コード例 #1
0
ファイル: HitchingRope.cs プロジェクト: nogu3ira/xrunuo
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Rope.Deleted)
                {
                    return;
                }

                if (!from.InRange(m_Rope.GetWorldLocation(), 2))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                       // I can't reach that.
                }

                else if (targeted is HitchingPostAnniversary)
                {
                    HitchingPostAnniversary postItem = (HitchingPostAnniversary)targeted;
                    if (postItem.UsesRemaining >= 1)
                    {
                        from.SendMessage("Hitching Rope cannot be applied at this time", 0x59);
                    }

                    else
                    {
                        postItem.UsesRemaining += 30;
                        m_Rope.Delete();

                        if (postItem is Item)
                        {
                            from.SendMessage("You apply the Hitching Rope and can now use it once again");
                        }
                    }
                }
                else if (targeted is HitchingPost)
                {
                    HitchingPost postItem = (HitchingPost)targeted;

                    if (postItem.UsesRemaining >= 1)
                    {
                        from.SendMessage("Hitching Rope cannot be applied at this time", 0x59);
                    }
                    else if (postItem.Charges <= 0 && postItem.UsesRemaining <= 0)
                    {
                        from.SendLocalizedMessage(1071157);                           // This hitching post is damaged. You can't use it any longer.
                    }
                    else
                    {
                        postItem.Charges       -= 1;
                        postItem.UsesRemaining += 15;
                        m_Rope.Delete();

                        if (postItem is Item)
                        {
                            from.SendMessage("You apply the Hitching Rope and can now use it once again");
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1062020);                       // That has no effect.
                }
            }
コード例 #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Rope.Deleted)
                {
                    return;
                }

                if (targeted is HitchingPost postItem)
                {
                    var maxuse = postItem.Replica ? 15 : 30;

                    if (postItem.UsesRemaining >= maxuse)
                    {
                        from.SendLocalizedMessage(1038293); // It looks almost new.
                    }
                    else if (postItem.Replica && postItem.Charges <= 0 && postItem.UsesRemaining == 0)
                    {
                        from.SendLocalizedMessage(1071157); // This hitching post is damaged. You can't use it any longer.
                    }
                    else
                    {
                        postItem.Charges      -= 1;
                        postItem.UsesRemaining = maxuse;

                        m_Rope.Delete();

                        from.SendLocalizedMessage(1071158, postItem.Name); // You have successfully resupplied the ~1_POST~ with the hitching rope.
                    }
                }
                else if (targeted is PetCastleAddon pc)
                {
                    if (pc.UsesRemaining >= 30)
                    {
                        from.SendLocalizedMessage(1038293); // It looks almost new.
                    }
                    else
                    {
                        pc.UsesRemaining = 30;

                        m_Rope.Delete();

                        from.SendLocalizedMessage(1071158, pc.Name); // You have successfully resupplied the ~1_POST~ with the hitching rope.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1071117); // You cannot use this item for it.
                }
            }