//this checks if the item you're attempting to create with is proper.  The child classes define specifics for this
        public override bool AllGood(Item item)
        {
            if (!base.AllGood(item))
            {
                return(false);
            }

            //TODO: move this to base class, since the _Type is specified in ListEntry?
            if (!(item is BaseAddonDeed))
            {
                return(false);
            }

            //test if the deed being added can be constructed with a zero parameter constructor
            try
            {
                BaseAddonDeed deed = (BaseAddonDeed)Activator.CreateInstance(item.GetType());

                //if it constructs fine, then delete it
                deed.Delete();
            }
            catch
            {
                //this catch hits if the deed does not have a zero parameter constructor, and would have otherwise crashed the shard
                return(false);
            }

            return(true);
        }
        public VinyardGroundPlacedGump(BaseAddonDeed deed) : base(30, 30)
        {
            m_Deed = deed;

            AddPage(0);

            AddBackground(0, 0, 450, 250, 9250);

            AddAlphaRegion(12, 12, 426, 22);
            AddHtml(13, 13, 379, 20, "<BASEFONT COLOR=WHITE>Vinyard Ground Addon Placement Successful</BASEFONT>", false, false);

            AddAlphaRegion(12, 39, 426, 199);

            AddHtml(15, 50, 420, 185, "<BODY>" +
                    "<BASEFONT COLOR=YELLOW>Your vinyard ground addon has been successfully placed!<BR>" +
                    "<BASEFONT COLOR=YELLOW>You may now begin placing grapevines in your vinyard using a " +
                    "<BASEFONT COLOR=YELLOW>grapevine placement tool.<BR><BR>" +
                    "<BASEFONT COLOR=YELLOW>You may delete this vinyard ground addon at any time.  " +
                    "<BASEFONT COLOR=YELLOW>To do so... <BR>" +
                    "<BASEFONT COLOR=YELLOW>   1. Delete all grapevines first.<BR>" +
                    "<BASEFONT COLOR=YELLOW>   2. Double click the vinyard addon and accept prompt to delete.<BR>" +
                    "<BASEFONT COLOR=YELLOW>   *Note* You must be within 3 tiles of western corner to delete addon.<BR><BR>" +
                    "</BODY>", false, false);

            AddButton(190, 210, 0xF7, 0xF8, 0, GumpButtonType.Reply, 0);
        }
Esempio n. 3
0
        public CarpetGump(BaseAddonDeed deed, IPoint3D p, Map map, int width, int height)
            : base(30, 30)
        {
            m_Deed   = deed;
            m_P3D    = p;
            m_Map    = map;
            m_Width  = width;
            m_Height = height;

            AddPage(0);

            AddBackground(0, 0, 450, 180, 9200);

            AddAlphaRegion(12, 12, 381, 22);
            AddHtml(13, 13, 379, 20, "<BASEFONT COLOR=WHITE>Choose a carpet type</BASEFONT>", false, false);

            AddAlphaRegion(398, 12, 40, 22);
            AddAlphaRegion(12, 39, 426, 129);

            AddImage(400, 16, 9766);
            AddImage(420, 16, 9762);
            AddPage(1);

            int page = 1;

            for (int i = 0, index = 0; i < CarpetInfo.Infos.Length; ++i, ++index)
            {
                if (index >= EntryCount)
                {
                    if ((EntryCount * page) == EntryCount)
                    {
                        AddImage(400, 16, 0x2626);
                    }

                    AddButton(420, 16, 0x15E1, 0x15E5, 0, GumpButtonType.Page, page + 1);

                    ++page;
                    index = 0;

                    AddPage(page);

                    AddButton(400, 16, 0x15E3, 0x15E7, 0, GumpButtonType.Page, page - 1);

                    if ((CarpetInfo.Infos.Length - (EntryCount * page)) < EntryCount)
                    {
                        AddImage(420, 16, 0x2622);
                    }
                }

                CarpetInfo info = CarpetInfo.GetInfo(i);

                for (int j = 0; j < info.Entries.Length; ++j)
                {
                    AddItem(20 + (index * 140) + info.Entries[j].OffsetX, 46 + info.Entries[j].OffsetY, info.Entries[j].ItemID);
                }

                AddButton(20 + (index * 140), 46, 1209, 1210, i + 1, GumpButtonType.Reply, 0);
            }
        }
        public VinyardGroundGump( BaseAddonDeed deed, IPoint3D p, Map map, int width, int height )
            : base(30, 30)
        {
            m_Deed = deed;
            m_P3D = p;
            m_Map = map;
            m_Width = width;
            m_Height = height;

            AddPage( 0 );

            AddBackground( 0, 0, 450, 160, 9250 );

            AddAlphaRegion( 12, 12, 381, 22 );
            AddHtml( 13, 13, 379, 20, "<BASEFONT COLOR=WHITE>Choose a ground type</BASEFONT>", false, false );

            AddAlphaRegion( 398, 12, 40, 22 );
            AddAlphaRegion( 12, 39, 426, 109 );

            AddImage( 400, 16, 9766 );
            AddImage( 420, 16, 9762 );
            AddPage( 1 );

            int page = 1;

            for ( int i = 0, index = 0; i < VinyardGroundInfo.Infos.Length; ++i, ++index )
            {
                if ( index >= EntryCount )
                {
                    if ( (EntryCount * page) == EntryCount )
                        AddImage( 400, 16, 0x2626 );

                    AddButton( 420, 16, 0x15E1, 0x15E5, 0, GumpButtonType.Page, page + 1 );

                    ++page;
                    index = 0;

                    AddPage( page );

                    AddButton( 400, 16, 0x15E3, 0x15E7, 0, GumpButtonType.Page, page - 1 );

                    if ( (VinyardGroundInfo.Infos.Length - (EntryCount * page)) < EntryCount )
                        AddImage( 420, 16, 0x2622 );
                }

                VinyardGroundInfo info = VinyardGroundInfo.GetInfo( i );

                for ( int j = 0; j < info.Entries.Length; ++j )
                {
                    if (info.Entries[j].OffsetX >= 0 && info.Entries[j].OffsetY >= 0 )
                        AddItem( 20 + (index * 140 ) + info.Entries[j].OffsetX, 46 + info.Entries[j].OffsetY, info.Entries[j].ItemID );
                }

                AddButton( 20 + (index * 140 ), 46, 1209, 1210, i+1, GumpButtonType.Reply, 0);
            }
        }
        //this generates an item from what is stored in the entry.  Note no exception handling
        public override Item GenerateItem()
        {
            //this allows for inherited classes of addon deeds to fit into this entry.
            //WARNING:  what if the addon deed carries more info, or has a constructor that requires parameters?
            BaseAddonDeed deed = (BaseAddonDeed)Activator.CreateInstance(_Type);

            //note: gump hue display is shifted by 1 for some crazy reason
            deed.Hue = _Hue + 1;

            deed.LootType = _LootType;
            deed.Insured  = _Insured;

            return(deed);
        }
Esempio n. 6
0
        public VariableCarpetPlacedGump(BaseAddonDeed deed) : base(30, 30)
        {
            m_Deed = deed;

            AddPage(0);

            AddBackground(0, 0, 450, 250, 9250);

            AddAlphaRegion(12, 12, 426, 22);
            AddHtml(13, 13, 379, 20, "<BASEFONT COLOR=WHITE>Carpet successfully placed</BASEFONT>", false, false);

            AddAlphaRegion(12, 39, 426, 199);

            AddHtml(15, 50, 420, 185, "<BODY>" +
                    "<BASEFONT COLOR=YELLOW>Your carpet has been placed!<BR>" +
                    "<BASEFONT COLOR=YELLOW>You may remove this carpet again easily.  " +
                    "<BASEFONT COLOR=YELLOW>Simply use an axe on the carpet.<BR>" +
                    "<BASEFONT COLOR=YELLOW>*Notice* You have to be within 3 tiles of the west corner of the addon to remove it.<BR><BR>" +
                    "</BODY>", false, false);

            AddButton(190, 210, 0xF7, 0xF8, 0, GumpButtonType.Reply, 0);
        }
Esempio n. 7
0
        private void CancelPlacement(Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(m_Addon);

            if (house != null && house.IsOwner(from) && house.Addons.Contains(m_Addon))
            {
                int hue = 0;

                if (m_Addon.RetainDeedHue)
                {
                    for (int i = 0; hue == 0 && i < m_Addon.Components.Count; ++i)
                    {
                        AddonComponent c = (AddonComponent)m_Addon.Components[i];

                        if (c.Hue != 0)
                        {
                            hue = c.Hue;
                        }
                    }
                }

                m_Addon.Delete();

                house.Addons.Remove(m_Addon);

                BaseAddonDeed deed = m_Addon.Deed;

                if (deed != null)
                {
                    if (m_Addon.RetainDeedHue)
                    {
                        deed.Hue = hue;
                    }

                    from.AddToBackpack(deed);
                }
            }
        }
        public VinyardGroundPlacedGump( BaseAddonDeed deed )
            : base(30, 30)
        {
            m_Deed = deed;

            AddPage( 0 );

            AddBackground( 0, 0, 450, 250, 9250 );

            AddAlphaRegion( 12, 12, 426, 22 );
            AddHtml( 13, 13, 379, 20, "<BASEFONT COLOR=WHITE>Vinyard Ground Addon Placement Successful</BASEFONT>", false, false );

            AddAlphaRegion( 12, 39, 426, 199 );

            AddHtml( 15, 50, 420, 185, "<BODY>" +
            "<BASEFONT COLOR=YELLOW>Your vinyard ground addon has been successfully placed!<BR>" +
            "<BASEFONT COLOR=YELLOW>You may now begin placing grapevines in your vinyard using a " +
            "<BASEFONT COLOR=YELLOW>grapevine placement tool.<BR><BR>" +
            "<BASEFONT COLOR=YELLOW>You may delete this vinyard ground addon at any time.  " +
            "<BASEFONT COLOR=YELLOW>To do so... <BR>" +
            "<BASEFONT COLOR=YELLOW>   1. Delete all grapevines first.<BR>" +
            "<BASEFONT COLOR=YELLOW>   2. Double click the vinyard addon and accept prompt to delete.<BR>" +
            "<BASEFONT COLOR=YELLOW>   *Note* You must be within 3 tiles of western corner to delete addon.<BR><BR>" +
            "</BODY>", false, false );

            AddButton( 190, 210, 0xF7, 0xF8, 0, GumpButtonType.Reply, 0 );
        }