Beispiel #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;

                    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)
                    {
                        this.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.
                }
            }
Beispiel #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;

                    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.
                }
            }
Beispiel #3
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.
                }
            }
Beispiel #5
0
        public void OnChop(BaseAddon addon, Mobile from)
        {
            if (addon == null || from == null || !Contains(addon) || !Contains(from))
                return;

            Effects.PlaySound(addon.GetWorldLocation(), addon.Map, 0x3B3);
            from.SendLocalizedMessage(500461); // You destroy the item.

            int hue = 0;

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

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

            addon.Delete();
            RemoveAddon(addon);
            BaseAddonDeed deed = addon.Deed;

            if (deed != null)
            {
                #region Mondains Legacy
                deed.Resource = addon.Resource;
                #endregion

                if (addon.RetainDeedHue)
                    deed.Hue = hue;

                from.AddToBackpack(deed);
            }

        }
            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.
                }
            }
Beispiel #7
0
 public void Convert2Static(BaseAddon design)
 {
     if (design.Components.Count > 0)
     {
         for (int i = 0; i < design.Components.Count; ++i)
         {
             AddonComponent component = (AddonComponent)((design.Components)[i]);
             Static equivalent = new Static(component.HuedItemID);  //( component.ItemID );
             equivalent.Location = component.Location;  //component.Location;
             equivalent.Map = component.Map; //component.Map;
             equivalent.Hue = component.Hue; //component.Map;							
         }
     }
     design.Delete();
 }
Beispiel #8
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.
                }
            }