Exemple #1
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;

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

                    ArrayList houses = null;

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

                    if (res == AddonFitResult.Valid)
                    {
                        addon.MoveToWorld(new Point3D(p), 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.SendAsciiMessage("You must close all house doors before placing this.");
                    }
                    else if (res == AddonFitResult.DoorTooClose)
                    {
                        from.SendLocalizedMessage(500271);                           // You cannot build near the door.
                    }
                    if (res == AddonFitResult.Valid)
                    {
                        m_Deed.Delete();

                        /*if ( houses != null )
                         * {
                         *      foreach ( Server.Multis.BaseHouse h in houses )
                         *              h.Addons.Add( addon );
                         * }*/
                    }
                    else
                    {
                        addon.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042001);                       // That must be in your pack for you to use it.
                }
            }
Exemple #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;

                    if (!addon.CanBePlacedInRegion(new Point3D(p), map))
                    {
                        from.SendMessage("Vous ne pouvez déposer cet objet qu'à Hurlevent.");
                        return;
                    }

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

                    BaseHouse house = null;

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

                    if (res == AddonFitResult.Valid)
                    {
                        addon.MoveToWorld(new Point3D(p), 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.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)
                    {
                        m_Deed.Delete();
                        //house.Addons.Add( addon );
                    }
                    else
                    {
                        addon.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042001);                       // That must be in your pack for you to use it.
                }
            }
Exemple #3
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;

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

                    BaseHouse house = null;

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

                    if (res == AddonFitResult.Valid)
                    {
                        addon.MoveToWorld(new Point3D(p), map);
                    }
                    else if (res == AddonFitResult.Blocked)
                    {
                        from.SendLocalizedMessage("You cannot build that there.");   // You cannot build that there.
                    }
                    else if (res == AddonFitResult.NotInHouse)
                    {
                        from.SendLocalizedMessage("You can only place this in a house that you own!");   // You can only place this in a house that you own!
                    }
                    else if (res == AddonFitResult.DoorTooClose)
                    {
                        from.SendLocalizedMessage("You cannot build near the door.");   // You cannot build near the door.
                    }
                    else if (res == AddonFitResult.NoWall)
                    {
                        from.SendLocalizedMessage("This object needs to be mounted on something.");   // This object needs to be mounted on something.
                    }
                    if (res == AddonFitResult.Valid)
                    {
                        m_Deed.Delete();
                        house.Addons.Add(addon);
                    }
                    else
                    {
                        addon.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage("That must be in your pack for you to use it.");   // That must be in your pack for you to use it.
                }
            }
            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;

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

                    if (res == AddonFitResult.Valid)
                        addon.MoveToWorld(new Point3D(p), 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.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)
                    {
                        if (addon != null)
                        {
                            addon.Resource = this.m_Deed.Resource;

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

                        this.m_Deed.DeleteDeed();

                        house.Addons.Add(addon);
                    }
                    else
                    {
                        addon.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                }
            }
Exemple #5
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;

                    Server.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.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.
                }
            }
            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;

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

                    BaseHouse house = null;

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

                    if (res == AddonFitResult.Valid)
                    {
                        addon.MoveToWorld(new Point3D(p), 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.");
                    }
                    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)
                    {
                        #region GeNova: Mondain's Legacy
                        if (addon != null && addon.RetainDeedHue)
                        {
                            addon.Hue = m_Deed.Hue;
                        }

                        m_Deed.DeleteDeed();
                        #endregion

                        house.Addons.Add(addon);
                    }
                    else
                    {
                        addon.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042001);                       // That must be in your pack for you to use it.
                }
            }
Exemple #7
0
        public void Place(IPoint3D p, Map map, Mobile from)
        {
            if (p == null || map == null || this.Deleted)
            {
                return;
            }

            if (IsChildOf(from.Backpack))
            {
                BaseAddon addon = Addon;                 // this creates an instance, don't use Addon (capital A) more than once!

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

                ArrayList houses = null;

                AddonFitResult res = addon.CouldFit(addon.BlocksDoors, p, map, from, ref houses);

                if (res == AddonFitResult.Valid)
                {
                    addon.MoveToWorld(new Point3D(p), 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.");
                }
                else if (res == AddonFitResult.DoorTooClose)
                {
                    from.SendLocalizedMessage(500271);                     // You cannot build near the door.
                }
                if (res == AddonFitResult.Valid)
                {
                    Delete();

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

                        from.SendGump(new ConfirmAddonPlacementGump(from, addon));
                    }
                }
                else
                {
                    addon.Delete();
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001);                 // That must be in your pack for you to use it.
            }
        }
            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;

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

                    List <BaseHouse> houses = new List <BaseHouse>();

                    PlayerMobile pm      = (PlayerMobile)from;                //NEW Added for player city
                    bool         ismayor = false;
                    if (pm.City != null && pm.City.Mayor == pm && PlayerGovernmentSystem.IsAtCity(from))
                    {
                        ismayor = true;
                    }

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


                    if (res == AddonFitResult.Valid)
                    {
                        addon.MoveToWorld(new Point3D(p), map);
                    }
                    else if (ismayor)
                    {
                        CityManagementStone stone = pm.City;
                        addon.MoveToWorld(new Point3D(p), map);
                        stone.AddOns.Add(addon);
                    }
                    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.");
                    }
                    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)
                    {
                        m_Deed.Delete();

                        foreach (BaseHouse h in houses)
                        {
                            h.Addons.Add(addon);
                        }
                    }

                    else if (ismayor)
                    {
                        m_Deed.Delete();
                    }

                    else
                    {
                        addon.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042001);                       // That must be in your pack for you to use it.
                }
            }
            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;

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

                    ArrayList houses = null;

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

                    if (res == AddonFitResult.Valid)
                    {
                        addon.MoveToWorld(new Point3D(p), map);
                        if (from is TeiravonMobile)
                        {
                            TeiravonMobile player = (TeiravonMobile)from;

                            if (addon is BallistaEastAddon)
                            {
                                BallistaEastAddon m_ballista = (BallistaEastAddon)addon;
                                if (player.Backpack != null)
                                {
                                    DwarvenBallista wep = new DwarvenBallista();
                                    wep.Ballista = addon;
                                    player.AddToBackpack(wep);
                                    m_ballista.Controller = wep;
                                }
                            }

                            if (addon is OrcCombatBridgeAddon)
                            {
                                OrcCombatBridgeAddon bridge = (OrcCombatBridgeAddon)addon;
                                bridge.Z = player.Z;
                            }
                        }
                    }
                    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.");
                    }
                    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)
                    {
                        m_Deed.Delete();

                        if (houses != null)
                        {
                            foreach (Server.Multis.BaseHouse h in houses)
                            {
                                h.Addons.Add(addon);
                            }
                        }
                    }
                    else
                    {
                        addon.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042001);                       // That must be in your pack for you to use it.
                }
            }
Exemple #10
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!
                    }
                    else if (res == AddonFitResult.InternalStairs)
                    {
                        from.SendLocalizedMessage(1152735); // The targeted location has at least one impassable tile adjacent to the structure.
                        from.SendLocalizedMessage(500277);  // Construction aborted. Please try again.
                    }

                    if (res != AddonFitResult.Valid)
                    {
                        addon.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                }
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted == m_Decorator)
                {
                    m_Decorator.Command = DecorateCommand.None;
                    from.SendGump(new InternalGump(m_Decorator));
                }
                else if (targeted is BaseCrop)
                {
                    from.SendMessage("you can not move plants using this");
                }
                else if (targeted is Item && InteriorDecorator.CheckUse(m_Decorator, from))
                {
                    BaseHouse house   = BaseHouse.FindHouseAt(from);
                    Item      item    = (Item)targeted;
                    Map       imap    = item.Map;
                    IPoint3D  p       = targeted as IPoint3D;
                    bool      isaddon = false; if (item is AddonComponent)
                    {
                        isaddon = true;
                    }
                    AddonComponent acomp = null; if (isaddon)
                    {
                        acomp = item as AddonComponent;
                    }
                    BaseAddon mainadd = null; if (isaddon)
                    {
                        mainadd = acomp.Addon;
                    }
                    bool couldfit = false;
                    if (isaddon)
                    {
                        couldfit = (mainadd.CouldFit(p, imap, from, ref house) != AddonFitResult.NotInHouse);
                    }

                    if (house == null || !house.IsCoOwner(from))
                    {
                        from.SendLocalizedMessage(502092);
                    }
                    else if (isaddon && couldfit == false)
                    {
                        from.SendMessage("That would move the item to far out of the house, or off a wall");
                    }
                    else if (item.Parent != null || !house.IsInside(item))
                    {
                        from.SendLocalizedMessage(1042270);
                    }
                    else if (!house.IsLockedDown(item) && !house.IsSecure(item) && (item.Movable))
                    {
                        from.SendLocalizedMessage(1042271);
                    }
                    else if (item is VendorRentalContract)
                    {
                        from.SendLocalizedMessage(1062491);
                    }
                    else if (item is HouseTeleporter)
                    {
                        from.SendMessage("Can not move House Teleporters!!!!");
                    }
                    else
                    {
                        switch (m_Decorator.Command)
                        {
                        case DecorateCommand.Up:                Up(item, from);       break;

                        case DecorateCommand.Down:      Down(item, from);     break;

                        case DecorateCommand.Turn:              Turn(item, from);     break;

                        case DecorateCommand.North:     North(item, from);    break;

                        case DecorateCommand.East:      East(item, from);     break;

                        case DecorateCommand.South:     South(item, from); break;

                        case DecorateCommand.West:      West(item, from);     break;
                        }
                    }
                }
            }