Example #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.
                }
            }
Example #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.
                }
            }
Example #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.
                }
            }
Example #4
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!
                }
                //else if ( res == AddonFitResult.DoorsNotClosed )
                //	from.SendMessage( "You must close all house doors before placing this." );
                else if (res == AddonFitResult.Valid)
                {
                    m_Deed.Delete();

                    if (house != null)
                    {
                        house.Addons.Add(addon);
                    }
                }
                else
                {
                    addon.Delete();
                }
            }
        }
Example #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);

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