예제 #1
0
        protected void OnTarget(Mobile m, Item item)
        {
            if (!this.CheckDoubleClick(m, true, false, 2, true) || item == null || item.Deleted || _Target == null ||
                _Target.User != m)
            {
                return;
            }

            if (!_LayerableTypes.Any(t => item.TypeEquals(t)))
            {
                m.SendMessage(34, "You can not layer that item.");
                return;
            }

            if (item.Layer == TargetLayer)
            {
                m.SendMessage(34, "That sash is already layered.");
                return;
            }

            if (item.RootParent != m)
            {
                m.SendMessage(34, "That sash must be equipped or in your pack to layer it.");
                return;
            }

            if (item.IsEquipped())
            {
                var otherItem = m.FindItemOnLayer(TargetLayer);

                if (otherItem != null)
                {
                    m.SendMessage(
                        34,
                        "You must unequip the {0} in your {1} slot before you can layer that sash.",
                        otherItem.ResolveName(m),
                        TargetLayer.ToString().ToLower());
                    return;
                }
            }

            item.Layer = TargetLayer;

            if (String.IsNullOrWhiteSpace(item.Name))
            {
                item.Name = "a body sash [Layered]";
            }
            else if (!item.Name.EndsWith(" [Layered]"))
            {
                item.Name += " [Layered]";
            }

            m.SendMessage(85, "You successfully layer the sash!");

            Delete();
        }