//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);
        }
Ejemplo n.º 2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID >= 1)
            {
                BaseAddon addon = new VariableCarpetAddon(info.ButtonID - 1, m_Width, m_Height);

                Server.Spells.SpellHelper.GetSurfaceTop(ref m_P3D);

                ArrayList houses = null;

                AddonFitResult res = addon.CouldFit(m_P3D, m_Map, from, ref houses);

                if (res == AddonFitResult.Valid)
                {
                    addon.MoveToWorld(new Point3D(m_P3D), m_Map);
                }
                else if (res == AddonFitResult.Blocked)
                {
                    from.SendLocalizedMessage(500269);                       // You cannot build that there.
                }
                else if (res == AddonFitResult.NotInHouse)
                {
                    from.SendLocalizedMessage(500274);                       // You can only place this in a house that you own!
                }
                else if (res == AddonFitResult.DoorsNotClosed)
                {
                    from.SendMessage("All doors must be closed!");
                }

                if (res == AddonFitResult.Valid)
                {
                    m_Deed.Delete();

                    if (houses != null)
                    {
                        foreach (Server.Multis.BaseHouse h in houses)
                        {
                            h.Addons.Add(addon);
                        }

                        from.SendGump(new VariableCarpetPlacedGump(m_Deed));
                    }
                }
                else
                {
                    addon.Delete();
                }
            }
        }
Ejemplo n.º 3
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID >= 1)
            {
                if (!m_Deed.IsChildOf(from.Backpack))
                {
                    return;
                }

                BaseAddon addon = new CarpetAddon(info.ButtonID - 1, m_Width, m_Height);

                Server.Spells.SpellHelper.GetSurfaceTop(ref m_P3D);

                BaseHouse house = null;

                AddonFitResult res = addon.CouldFit(m_P3D, m_Map, from, ref house);

                if (res == AddonFitResult.Valid)
                {
                    addon.MoveToWorld(new Point3D(m_P3D), m_Map);
                }
                else if (res == AddonFitResult.Blocked)
                {
                    from.SendLocalizedMessage(500269);                       // You cannot build that there.
                }
                else if (res == AddonFitResult.NotInHouse)
                {
                    from.SendLocalizedMessage(500274);                       // You can only place this in a house that you own!
                }
                if (res == AddonFitResult.Valid)
                {
                    m_Deed.Delete();

                    if (house != null)
                    {
                        house.Addons.Add(addon);
                    }
                }
                else
                {
                    addon.Delete();
                }
            }
        }
Ejemplo n.º 4
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID >= 1)
            {
                BaseAddon addon = new CarpetAddon(info.ButtonID - 1, m_Width, m_Height);

                Server.Spells.SpellHelper.GetSurfaceTop(ref m_P3D);

                Server.Multis.BaseHouse house = null;
                AddonFitResult          res   = addon.CouldFit(m_P3D, m_Map, from, ref house);

                if (res == AddonFitResult.Valid || from.AccessLevel >= AccessLevel.GameMaster)
                {
                    addon.MoveToWorld(new Point3D(m_P3D), m_Map);
                }
                else if (res == AddonFitResult.Blocked)
                {
                    from.SendLocalizedMessage(500269);                       // You cannot build that there.
                }
                else if (res == AddonFitResult.NotInHouse)
                {
                    from.SendLocalizedMessage(500274);                       // You can only place this in a house that you own!
                }
                else if (res == AddonFitResult.DoorsNotClosed)
                {
                    from.SendMessage("You must close all house doors before placing this.");
                }

                if (res == AddonFitResult.Valid || from.AccessLevel >= AccessLevel.GameMaster)
                {
                    m_Deed.Delete();

                    if (house != null)
                    {
                        house.Addons.Add(addon);
                    }
                }
                else
                {
                    addon.Delete();
                }
            }
        }
Ejemplo n.º 5
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID >= 1)
            {
                BaseAddon addon = new VinyardGroundAddon(info.ButtonID - 1, m_Width, m_Height);

                Server.Spells.SpellHelper.GetSurfaceTop(ref m_P3D);

                BaseHouse house = null;

                AddonFitResult res = addon.CouldFit(m_P3D, m_Map, from, ref house);

                if (res == AddonFitResult.Valid)
                {
                    addon.MoveToWorld(new Point3D(m_P3D), m_Map);
                }
                else if (res == AddonFitResult.Blocked)
                {
                    from.SendLocalizedMessage(500269);
                }
                else if (res == AddonFitResult.NotInHouse)
                {
                    from.SendLocalizedMessage(500274);
                }
                else if (res == AddonFitResult.DoorsNotClosed)
                {
                    from.SendMessage("You must close all house doors before placing this.");
                }

                if (res == AddonFitResult.Valid)
                {
                    m_Deed.Delete();

                    house.Addons.Add(addon);
                }
                else
                {
                    addon.Delete();
                }
            }
        }