Пример #1
0
            protected override void OnTarget(Mobile from, object targ)
            {
                AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att));

                BaseAddon addon = addoneditor.SelectedAddon;

                AddonComponent component = (AddonComponent)targ;

                if (component.Addon == addon)
                {
                    from.SendMessage("You cannot add an Addon to itself");
                    from.Target = new Add_Target(from);
                }

                else if (targ is Item)
                {
                    Item item = (Item)targ;

                    addon.AddComponent(new AddonComponent(item.ItemID), item.X - addon.X, item.Y - addon.Y, addon.Z);

                    item.Delete();
                }
                else
                {
                    from.SendMessage("That is not an Item.");
                    from.Target = new Add_Target(from);
                }
            }
Пример #2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att));

            if (info.ButtonID == (int)Buttons.Select)
            {
                from.Target = new Select_Target(from);
                Resend(from);
            }
            if (addoneditor.SelectedAddon != null)
            {
                if (info.ButtonID == (int)Buttons.AddItem)
                {
                    from.Target = new Add_Target(from);
                }
                else if (info.ButtonID == (int)Buttons.RemoveItem)
                {
                    from.Target = new Remove_Target(from, false);
                }
                else if (info.ButtonID == (int)Buttons.DeleteItem)
                {
                    from.Target = new Remove_Target(from, true);
                }
                else if (info.ButtonID == (int)Buttons.InspectItem)
                {
                }
                Resend(from);
            }
            else
            {
                from.SendMessage("You must select an Addon first!");
            }
        }
Пример #3
0
 private void CheckDeleted(Mobile from, AddOnEditor_Att addoneditor)
 {
     if (addoneditor.SelectedAddon == null || addoneditor.SelectedAddon.Deleted)
     {
         from.SendMessage("You must select a new Addon first");
         Target.Cancel(from);
         return;
     }
 }
Пример #4
0
        public void Resend(Mobile from)
        {
            AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att));

            if (from.HasGump(typeof(AddOnEditor)))
            {
                from.CloseGump(typeof(AddOnEditor));
            }
            from.SendGump(new AddOnEditor(from, addoneditor));
        }
Пример #5
0
        public AddOnEditor(Mobile from, AddOnEditor_Att att) : base(100, 100)
        {
            _AddOnAtt = att;

            Closable = true; Disposable = true; Dragable = true; Resizable = false;
            AddPage(0);

            // Buttons hidden behind the background, but are still functional
            AddButton(27, 80, 1042, 248, (int)Buttons.Select, GumpButtonType.Reply, 0);
            AddButton(27, 117, 1042, 248, (int)Buttons.AddItem, GumpButtonType.Reply, 0);
            AddButton(27, 154, 1042, 248, (int)Buttons.RemoveItem, GumpButtonType.Reply, 0);
            AddButton(27, 191, 1042, 248, (int)Buttons.DeleteItem, GumpButtonType.Reply, 0);
            AddButton(27, 228, 1042, 248, (int)Buttons.InspectItem, GumpButtonType.Reply, 0);

            AddBackground(0, 0, 241, 287, 9270);
            AddBackground(15, 15, 211, 257, 9200);
            AddHtml(21, 18, 196, 18, @"<BASEFONT COLOR=#FFFFFF><center><big>Addon Editor", (bool)false, (bool)false);

            string TypeName;

            if (att.SelectedAddon != null)
            {
                TypeName = att.SelectedAddon.GetType().ToString();
            }
            else
            {
                TypeName = "An Addon has not been selected";
            }

            AddHtml(17, 32, 207, 41, String.Format(@"Link: {0}", TypeName), (bool)false, (bool)false);

            // Backgrounds used to represent the buttons
            AddBackground(30, 80, 175, 27, 9500);
            AddHtml(34, 86, 165, 17, @"<BASEFONT COLOR=#FFFFFF><center>Select AddOn", (bool)false, (bool)false);

            AddBackground(30, 117, 175, 27, 9500);
            AddHtml(34, 123, 165, 17, @"<BASEFONT COLOR=#FFFFFF><center>Add Item", (bool)false, (bool)false);

            AddBackground(30, 154, 175, 27, 9500);
            AddHtml(34, 160, 165, 17, @"<BASEFONT COLOR=#FFFFFF><center>Remove Item", (bool)false, (bool)false);

            AddBackground(30, 191, 175, 27, 9500);
            AddHtml(34, 197, 165, 17, @"<BASEFONT COLOR=#FFFFFF><center>Delete Item", (bool)false, (bool)false);

            /*
             * // Removed from planned implementation, can't think of any real use for this
             * AddBackground(30, 228, 175, 27, 9500);
             * AddHtml( 34, 234, 165, 17, @"<BASEFONT COLOR=#FFFFFF><center>Inspect Item", (bool)false, (bool)false);
             */
        }
Пример #6
0
            protected override void OnTarget(Mobile from, object targ)
            {
                AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att));

                if (targ is AddonComponent)
                {
                    AddonComponent component = (AddonComponent)targ;
                    addoneditor.SelectedAddon = component.Addon;
                    addoneditor.Resend(from);
                }
                else
                {
                    from.SendMessage("That is not an Addon.");
                    from.Target = new Select_Target(from);
                }
            }
Пример #7
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.AccessLevel == AccessLevel.Player)
            {
                from.SendMessage("That is for Staff use only!");
                return;
            }

            AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att));

            if (addoneditor == null)
            {
                XmlAttach.AttachTo(from, new AddOnEditor_Att());
            }

            addoneditor.CallCommand(from);

            base.OnDoubleClick(from);
        }
Пример #8
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att));

            switch (info.ButtonID)
            {
            default:
            case (int)Buttons.Close:
                from.CloseGump(typeof(AddOnEditor));
                break;

            case (int)Buttons.Select:
                from.Target = new Select_Target(from);
                Resend(from);
                break;

            case (int)Buttons.AddItem:
                CheckDeleted(from, addoneditor);
                from.Target = new Add_Target(from);
                Resend(from);
                break;

            case (int)Buttons.RemoveItem:
                CheckDeleted(from, addoneditor);
                from.Target = new Remove_Target(from, false);
                Resend(from);
                break;

            case (int)Buttons.DeleteItem:
                CheckDeleted(from, addoneditor);
                from.Target = new Remove_Target(from, true);
                Resend(from);
                break;

            case (int)Buttons.CreateAddon:
                CheckDeleted(from, addoneditor);
                from.Target = new Create_Target(from);
                Resend(from);
                break;
            }
        }
Пример #9
0
            protected override void OnTarget(Mobile from, object targ)
            {
                AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att));

                BaseAddon      addon     = addoneditor.SelectedAddon;
                AddonComponent component = (AddonComponent)targ;

                if (targ is AddonComponent)
                {
                    addon.Components.Remove(component);
                    component.Addon = null;

                    if (_delete == true)
                    {
                        component.Delete();
                    }
                }
                else
                {
                    from.SendMessage("That is not an Addon.");
                    from.Target = new Remove_Target(from, _delete);
                }
            }