Ejemplo n.º 1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                IPoint3D p   = targeted as IPoint3D;
                Map      map = from.Map;

                if (p == null || map == null || this.m_Deed.Deleted)
                {
                    return;
                }

                if (this.m_Deed.IsChildOf(from.Backpack))
                {
                    BaseAddon addon = this.m_Deed.Addon;

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

                    BaseHouse   house = null;
                    BaseGalleon boat  = null;

                    AddonFitResult res = addon.CouldFit(p, map, from, ref house, ref boat);

                    if (res == AddonFitResult.Valid)
                    {
                        addon.Resource = this.m_Deed.Resource;

                        if (addon.RetainDeedHue)
                        {
                            addon.Hue = this.m_Deed.Hue;
                        }

                        addon.MoveToWorld(new Point3D(p), map);

                        if (house != null)
                        {
                            house.Addons.Add(addon);
                        }
                        else if (boat != null)
                        {
                            boat.AddAddon(addon);
                        }

                        this.m_Deed.DeleteDeed();
                    }
                    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.DoorTooClose)
                    {
                        from.SendLocalizedMessage(500271); // You cannot build near the door.
                    }
                    else if (res == AddonFitResult.NoWall)
                    {
                        from.SendLocalizedMessage(500268); // This object needs to be mounted on something.
                    }
                    if (res != AddonFitResult.Valid)
                    {
                        addon.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                }
            }
Ejemplo n.º 2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                IPoint3D p   = targeted as IPoint3D;
                Map      map = from.Map;

                if (p == null || map == null || m_Deed.Deleted)
                {
                    return;
                }

                if (m_Deed.IsChildOf(from.Backpack))
                {
                    BaseAddon addon = m_Deed.Addon;

                    Spells.SpellHelper.GetSurfaceTop(ref p);

                    BaseHouse   house   = null;
                    BaseGalleon galleon = CheckGalleonPlacement(from, addon, new Point3D(p), map);

                    AddonFitResult res = galleon != null ? AddonFitResult.Valid : addon.CouldFit(p, map, from, ref house);

                    if (res == AddonFitResult.Valid)
                    {
                        addon.Resource = m_Deed.Resource;

                        if (!m_Deed.ExcludeDeedHue)
                        {
                            if (addon.RetainDeedHue || (m_Deed.Hue != 0 && CraftResources.GetHue(m_Deed.Resource) != m_Deed.Hue))
                            {
                                addon.Hue = m_Deed.Hue;
                            }
                        }

                        addon.MoveToWorld(new Point3D(p), map);

                        if (house != null)
                        {
                            house.Addons[addon] = from;
                        }

                        if (galleon != null)
                        {
                            galleon.AddAddon(addon);
                        }

                        m_Deed.DeleteDeed();
                    }
                    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.OwnerNotInHouse)
                    {
                        from.SendLocalizedMessage(1153770); // The deed is not in the same house as you.
                    }
                    else if (res == AddonFitResult.DoorTooClose)
                    {
                        from.SendLocalizedMessage(500271); // You cannot build near the door.
                    }
                    else if (res == AddonFitResult.NoWall)
                    {
                        from.SendLocalizedMessage(500268); // This object needs to be mounted on something.
                    }
                    else if (res == AddonFitResult.FoundationStairs)
                    {
                        from.SendLocalizedMessage(1071262); // You can't place the multi-tile addon at the entrance!
                    }

                    if (res != AddonFitResult.Valid)
                    {
                        addon.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                }
            }