Exemplo n.º 1
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
            int version = reader.ReadInt();

            SelectedAddon = ( BaseAddon )reader.ReadItem();
        }
 private static void AddComplexComponent(BaseAddon addon, int item, int xoffset, int yoffset, int zoffset, int hue, int lightsource, string name)
 {
     AddonComponent ac;
     ac = new AddonComponent(item);
     if (name != null)
         ac.Name = name;
     if (hue != 0)
         ac.Hue = hue;
     if (lightsource != -1)
         ac.Light = (LightType) lightsource;
     addon.AddComponent(ac, xoffset, yoffset, zoffset);
 }
		public ConfirmAddonPlacementGump( Mobile from, BaseAddon addon ) : base( 50, 50 )
		{
			from.CloseGump( typeof(ConfirmAddonPlacementGump) );
			
			m_Addon = addon;

			AddPage( 0 );

			AddBackground( 10, 10, 190, 140, 0x242C );

			AddHtml( 30, 30, 150, 75, String.Format( "<div align=CENTER>{0}</div>", "Are you sure you want to place this addon here?" ), false, false );

			AddButton( 40, 105, 0x81A, 0x81B, 0x1, GumpButtonType.Reply, 0 ); // Okay
			AddButton( 110, 105, 0x819, 0x818, 0x2, GumpButtonType.Reply, 0 ); // Cancel
		}
Exemplo n.º 4
0
 private static void AddComplexComponent(BaseAddon addon, int item, int xoffset, int yoffset, int zoffset, int hue, int lightsource, string name, int amount)
 {
     AddonComponent ac;
     ac = new AddonComponent(item);
     if (name != null && name.Length > 0)
         ac.Name = name;
     if (hue != 0)
         ac.Hue = hue;
     if (amount > 1)
     {
         ac.Stackable = true;
         ac.Amount = amount;
     }
     if (lightsource != -1)
         ac.Light = (LightType) lightsource;
     addon.AddComponent(ac, xoffset, yoffset, zoffset);
 }
Exemplo n.º 5
0
 public void AddSpinningWheelS(int xoff, int yoff, int zoff)
 {
     m_SpinningWheel2 = new SpinningwheelSouthAddon();
     m_SpinningWheel2.MoveToWorld(new Point3D(xoff + this.X, yoff + this.Y, zoff + this.Z), this.Map);
 }
Exemplo n.º 6
0
 public void AddPickE(int xoff, int yoff, int zoff)
 {
     m_Pick1 = new PickpocketDipEastAddon();
     m_Pick1.MoveToWorld(new Point3D(xoff + this.X, yoff + this.Y, zoff + this.Z), this.Map);
 }
Exemplo n.º 7
0
 public void AddSmallForge(int xoff, int yoff, int zoff)
 {
     m_SmallForge = new SmallForgeAddon();
     m_SmallForge.MoveToWorld(new Point3D(xoff + this.X, yoff + this.Y, zoff + this.Z), this.Map);
 }
Exemplo n.º 8
0
 public void AddLargeForge(int xoff, int yoff, int zoff)
 {
     m_LargeForge = new LargeForgeSouthHouseAddon();
     m_LargeForge.MoveToWorld(new Point3D(xoff + this.X, yoff + this.Y, zoff + this.Z), this.Map);
 }
Exemplo n.º 9
0
 public void AddMill(int xoff, int yoff, int zoff)
 {
     m_Mill = new FlourMillSouthAddon();
     m_Mill.MoveToWorld(new Point3D(xoff + this.X, yoff + this.Y, zoff + this.Z), this.Map);
 }
Exemplo n.º 10
0
 private static void AddComplexComponent(BaseAddon addon, int item, int xoffset, int yoffset, int zoffset, int hue, int lightsource)
 {
     AddComplexComponent(addon, item, xoffset, yoffset, zoffset, hue, lightsource, null, 1);
 }
Exemplo n.º 11
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 1:
                case 0:
                {
                    m_Addon = reader.ReadItem() as BaseAddon;
                    m_Offset = reader.ReadPoint3D();

                    if ( m_Addon != null )
                        m_Addon.OnComponentLoaded( this );

                    ApplyLightTo( this );

                    break;
                }
            }

            if ( version < 1 && Weight == 0 )
                Weight = -1;
        }
Exemplo n.º 12
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (this.m_Head == null || this.m_Head.Deleted)
                {
                    return;
                }

                if (this.m_Head.IsChildOf(from.Backpack))
                {
                    BaseHouse house = BaseHouse.FindHouseAt(from);

                    if (house != null && house.IsOwner(from))
                    {
                        IPoint3D p   = targeted as IPoint3D;
                        Map      map = from.Map;

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

                        Point3D  p3d = new Point3D(p);
                        ItemData id  = TileData.ItemTable[0x10F5];

                        house = BaseHouse.FindHouseAt(p3d, map, id.Height);

                        if (house != null && house.IsOwner(from))
                        {
                            if (map.CanFit(p3d, id.Height))
                            {
                                bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
                                bool west  = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);

                                FlamingHead head = null;

                                if (north && west)
                                {
                                    head = new FlamingHead(StoneFaceTrapType.NorthWestWall);
                                }
                                else if (north)
                                {
                                    head = new FlamingHead(StoneFaceTrapType.NorthWall);
                                }
                                else if (west)
                                {
                                    head = new FlamingHead(StoneFaceTrapType.WestWall);
                                }

                                if (north || west)
                                {
                                    house.Addons[head] = from;

                                    head.IsRewardItem = this.m_Head.IsRewardItem;
                                    head.MoveToWorld(p3d, map);

                                    this.m_Head.Delete();
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1042266); // The head must be placed next to a wall.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1042266); // The head must be placed next to a wall.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1042036); // That location is not in your house.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502115); // You must be in your house to do this.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
                }
            }
Exemplo n.º 13
0
		public AddonFitResult CouldFit( IPoint3D p, Map map, Mobile from, ref BaseHouse house )
		{
			if ( Deleted )
				return AddonFitResult.Blocked;

			foreach ( AddonContainerComponent c in m_Components )
			{
				Point3D p3D = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z );

				if ( !map.CanFit( p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, c.Z == 0 ) )
					return AddonFitResult.Blocked;
				else if ( !BaseAddon.CheckHouse( from, p3D, map, c.ItemData.Height, ref house ) )
					return AddonFitResult.NotInHouse;

				if ( c.NeedsWall )
				{
					Point3D wall = c.WallPosition;

					if ( !BaseAddon.IsWall( p3D.X + wall.X, p3D.Y + wall.Y, p3D.Z + wall.Z, map ) )
						return AddonFitResult.NoWall;
				}
			}

			Point3D p3 = new Point3D( p.X, p.Y, p.Z );

			if ( !map.CanFit( p3.X, p3.Y, p3.Z, ItemData.Height, false, true, Z == 0 ) )
				return AddonFitResult.Blocked;
			else if ( !BaseAddon.CheckHouse( from, p3, map, ItemData.Height, ref house ) )
				return AddonFitResult.NotInHouse;

			if ( NeedsWall )
			{
				Point3D wall = WallPosition;

				if ( !BaseAddon.IsWall( p3.X + wall.X, p3.Y + wall.Y, p3.Z + wall.Z, map ) )
					return AddonFitResult.NoWall;
			}

			if ( house != null )
			{
				ArrayList doors = house.Doors;

				for ( int i = 0; i < doors.Count; ++i )
				{
					BaseDoor door = doors[ i ] as BaseDoor;

					if ( door != null && door.Open )
						return AddonFitResult.DoorsNotClosed;

					Point3D doorLoc = door.GetWorldLocation();
					int doorHeight = door.ItemData.CalcHeight;

					foreach ( AddonContainerComponent c in m_Components )
					{
						Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z );
						int addonHeight = c.ItemData.CalcHeight;

						if ( Utility.InRange( doorLoc, addonLoc, 1 ) && ( addonLoc.Z == doorLoc.Z || addonLoc.Z + addonHeight > doorLoc.Z && doorLoc.Z + doorHeight > addonLoc.Z ) )
							return AddonFitResult.DoorTooClose;
					}

					Point3D addonLo = new Point3D( p.X, p.Y, p.Z );
					int addonHeigh = ItemData.CalcHeight;

					if ( Utility.InRange( doorLoc, addonLo, 1 ) && ( addonLo.Z == doorLoc.Z || addonLo.Z + addonHeigh > doorLoc.Z && doorLoc.Z + doorHeight > addonLo.Z ) )
						return AddonFitResult.DoorTooClose;
				}
			}

			return AddonFitResult.Valid;
		}
Exemplo n.º 14
0
        public override void OnDoubleClick(Mobile from)
        {
            //TODO: Finish the ontaret stuff and clilocs.
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house != null)
                {
                    base.OnDoubleClick(from);
                }
                else
                {
                    from.BeginTarget(10, true, Targeting.TargetFlags.None, (m, targeted) =>
                    {
                        if (targeted is IPoint3D point)
                        {
                            Point3D p = new Point3D(point);
                            int dist  = (int)from.GetDistanceToSqrt(p);

                            if (dist < 2 || dist > 5)
                            {
                                from.SendLocalizedMessage(1152736); // You must stand between 2 and 5 tiles away from the targeted location to attempt to build this.
                            }
                            else if (!from.InLOS(p))
                            {
                                from.SendLocalizedMessage(500237); // Target cannot be seen.
                            }
                            else if (!ValidateLocation(p, from.Map))
                            {
                                from.SendLocalizedMessage(1152735); // The targeted location has at least one impassable tile adjacent to the structure.
                            }
                            else
                            {
                                BaseHouse checkHouse = BaseHouse.FindHouseAt(from);

                                if (checkHouse != null)
                                {
                                    from.SendLocalizedMessage(500269); // You cannot build that there.
                                }
                                else
                                {
                                    Spells.SpellHelper.GetSurfaceTop(ref point);

                                    BaseAddon addon = Addon;
                                    addon.MoveToWorld(new Point3D(point), m.Map);

                                    if (addon is TemporaryForge forge)
                                    {
                                        forge.Owner = from;
                                    }

                                    Delete();
                                }
                            }
                        }
                    });
                }
            }
        }
Exemplo n.º 15
0
        public BaseAddon ConstructTrophy(bool north)
        {
            BaseAddon addon = null;

            switch (m_TrophyID)
            {
            case 0: addon = new FishTrophy(typeof(AutumnDragonfish), TrophyStyle.Dragonfish, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 1: addon = new FishTrophy(typeof(BullFish), TrophyStyle.BoardMahi, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 2: addon = new FishTrophy(typeof(FireFish), TrophyStyle.BoardGrouper, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 3: addon = new FishTrophy(typeof(GiantKoi), TrophyStyle.BoardMahi, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 4: addon = new FishTrophy(typeof(LavaFish), TrophyStyle.Marlin, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 5: addon = new FishTrophy(typeof(SummerDragonfish), TrophyStyle.Dragonfish, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 6: addon = new FishTrophy(typeof(UnicornFish), TrophyStyle.Marlin, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 7: addon = new FishTrophy(typeof(AbyssalDragonfish), TrophyStyle.Dragonfish, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 8: addon = new FishTrophy(typeof(BlackMarlin), TrophyStyle.Marlin, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 9: addon = new FishTrophy(typeof(BlueMarlin), TrophyStyle.Marlin, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 10: addon = new FishTrophy(typeof(GiantSamuraiFish), TrophyStyle.BoardGrouper, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 11: addon = new FishTrophy(typeof(Kingfish), TrophyStyle.BoardGrouper, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 12: addon = new FishTrophy(typeof(LanternFish), TrophyStyle.BoardMahi, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 13: addon = new FishTrophy(typeof(SeekerFish), TrophyStyle.BoardGrouper, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 14: addon = new FishTrophy(typeof(SpringDragonfish), TrophyStyle.Dragonfish, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 15: addon = new FishTrophy(typeof(StoneFish), TrophyStyle.BoardMahi, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 16: addon = new FishTrophy(typeof(WinterDragonfish), TrophyStyle.Dragonfish, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 17: addon = new FishTrophy(typeof(BlueLobster), TrophyStyle.Lobster, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 18: addon = new FishTrophy(typeof(BloodLobster), TrophyStyle.Lobster, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 19: addon = new FishTrophy(typeof(DreadLobster), TrophyStyle.Lobster, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 20: addon = new FishTrophy(typeof(VoidLobster), TrophyStyle.Lobster, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 21: addon = new FishTrophy(typeof(StoneCrab), TrophyStyle.Crab, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 22: addon = new FishTrophy(typeof(SpiderCrab), TrophyStyle.Crab, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 23: addon = new FishTrophy(typeof(TunnelCrab), TrophyStyle.Crab, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 24: addon = new FishTrophy(typeof(VoidCrab), TrophyStyle.Crab, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 25: addon = new FishTrophy(typeof(CrystalFish), TrophyStyle.BoardGrouper, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 26: addon = new FishTrophy(typeof(FairySalmon), TrophyStyle.BoardGrouper, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 27: addon = new FishTrophy(typeof(GreatBarracuda), TrophyStyle.BoardGrouper, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 28: addon = new FishTrophy(typeof(HolyMackerel), TrophyStyle.BoardGrouper, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 29: addon = new FishTrophy(typeof(ReaperFish), TrophyStyle.BoardGrouper, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 30: addon = new FishTrophy(typeof(YellowtailBarracuda), TrophyStyle.BoardGrouper, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 31: addon = new FishTrophy(typeof(DungeonPike), TrophyStyle.BoardGrouper, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 32: addon = new FishTrophy(typeof(GoldenTuna), TrophyStyle.BoardGrouper, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 33: addon = new FishTrophy(typeof(RainbowFish), TrophyStyle.BoardGrouper, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;

            case 34: addon = new FishTrophy(typeof(ZombieFish), TrophyStyle.BoardGrouper, north, m_TrophyName, m_Weight, m_Fisher, m_DateCaught); break;
            }
            return(addon);
        }
Exemplo n.º 16
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[addon] = from;
                        }
                        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.
                }
            }
Exemplo n.º 17
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 = AddonFitResult.Valid;
                    if (from.AccessLevel < AccessLevel.GameMaster)
                    {
                        res = addon.CouldFit(p, map, from, ref house);
                    }
                    else
                    {
                        house = BaseHouse.FindHouseAt(new Point3D(p), map, p.Z);
                        if (house == null)
                        {
                            res = AddonFitResult.NotInHouse;
                        }
                    }

                    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.
                }
            }
Exemplo n.º 18
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house != null && house.IsCoOwner(from))
                {
                    bool northWall = BaseAddon.IsWall(from.X, from.Y - 1, from.Z, from.Map);
                    bool westWall  = BaseAddon.IsWall(from.X - 1, from.Y, from.Z, from.Map);

                    if (northWall && westWall)
                    {
                        switch (from.Direction & Direction.Mask)
                        {
                        case Direction.North:
                        case Direction.South: northWall = true; westWall = false; break;

                        case Direction.East:
                        case Direction.West: northWall = false; westWall = true; break;

                        default: from.SendMessage("Turn to face the wall on which to hang this trophy."); return;
                        }
                    }

                    int itemID = 0;

                    if (northWall)
                    {
                        itemID = SouthID;
                    }
                    else if (westWall)
                    {
                        itemID = EastID;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042626); // The trophy must be placed next to a wall.
                    }
                    if (itemID > 0)
                    {
                        Item trophy;

                        if (Info.Complex)
                        {
                            trophy = new HuntTrophyAddon(m_Owner, Index, m_Measurement, m_DateKilled, m_Location);
                        }
                        else
                        {
                            trophy        = new HuntTrophy(m_Owner, Index, m_Measurement, m_DateKilled, m_Location);
                            trophy.ItemID = itemID;
                        }

                        trophy.MoveToWorld(from.Location, from.Map);

                        house.Addons[trophy] = from;
                        Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502092); // You must be in your house to do this.
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
        }
Exemplo n.º 19
0
 public void AddTrainingS(int xoff, int yoff, int zoff)
 {
     m_Training2 = new TrainingDummySouthAddon();
     m_Training2.MoveToWorld(new Point3D(xoff + this.X, yoff + this.Y, zoff + this.Z), this.Map);
 }
Exemplo n.º 20
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_FirefliesDeed == null || m_FirefliesDeed.Deleted)
                {
                    return;
                }

                if (m_FirefliesDeed.IsChildOf(from.Backpack))
                {
                    BaseHouse house = BaseHouse.FindHouseAt(from);

                    if (house != null && house.IsOwner(from))
                    {
                        IPoint3D p   = targeted as IPoint3D;
                        Map      map = from.Map;

                        if (p == null || map == null || map == Map.Internal)
                        {
                            return;
                        }

                        Point3D  p3d = new Point3D(p);
                        ItemData id  = TileData.ItemTable[m_ItemID & TileData.MaxItemValue];

                        if (map.CanFit(p3d, id.Height))
                        {
                            house = BaseHouse.FindHouseAt(p3d, map, id.Height);

                            if (house != null && house.IsOwner(from))
                            {
                                bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
                                bool west  = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);

                                bool isclear = true;

                                foreach (Item item in Map.Malas.GetItemsInRange(p3d, 0))
                                {
                                    if (item is Fireflies)
                                    {
                                        isclear = false;
                                    }
                                }

                                if (((m_ItemID == 0x2336 && north) || (m_ItemID == 0x2332 && west)) && isclear)
                                {
                                    Fireflies flies = new Fireflies(m_ItemID);

                                    house.Addons.Add(flies);

                                    flies.MoveToWorld(p3d, from.Map);

                                    m_FirefliesDeed.Delete();
                                }

                                else
                                {
                                    from.SendLocalizedMessage(1150065);                                     // Holiday fireflies must be placed next to a wall.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1042036);                                 // That location is not in your house.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(500269);                             // You cannot build that there.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502092);                         // You must be in your house to do this.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042038);                     // You must have the object in your backpack to use it.
                }
            }
Exemplo n.º 21
0
 public void AddAnvil(int xoff, int yoff, int zoff)
 {
     m_Anvil = new AnvilEastAddon();
     m_Anvil.MoveToWorld(new Point3D(xoff + this.X, yoff + this.Y, zoff + this.Z), this.Map);
 }
Exemplo n.º 22
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Banner == null || m_Banner.Deleted)
                {
                    return;
                }

                if (m_Banner.IsChildOf(from.Backpack))
                {
                    BaseHouse house = BaseHouse.FindHouseAt(from);

                    if (house != null && house.IsOwner(from))
                    {
                        IPoint3D p   = targeted as IPoint3D;
                        Map      map = from.Map;

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

                        Point3D  p3d = new Point3D(p);
                        ItemData id  = TileData.ItemTable[m_ItemID & TileData.MaxItemValue];

                        if (map.CanFit(p3d, id.Height))
                        {
                            house = BaseHouse.FindHouseAt(p3d, map, id.Height);

                            if (house != null && house.IsOwner(from))
                            {
                                bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
                                bool west  = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);

                                if (north && west)
                                {
                                    from.CloseGump(typeof(FacingGump));
                                    from.SendGump(new FacingGump(m_Banner, m_ItemID, p3d, house));
                                }
                                else if (north || west)
                                {
                                    Banner banner = null;

                                    if (north)
                                    {
                                        banner = new Banner(m_ItemID);
                                    }
                                    else if (west)
                                    {
                                        banner = new Banner(m_ItemID + 1);
                                    }

                                    house.Addons.Add(banner);

                                    banner.IsRewardItem = m_Banner.IsRewardItem;
                                    banner.MoveToWorld(p3d, map);

                                    m_Banner.Delete();
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1042039);                                       // The banner must be placed next to a wall.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1042036);                                   // That location is not in your house.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(500269);                               // You cannot build that there.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502092);                           // You must be in your house to do this.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042038);                       // You must have the object in your backpack to use it.
                }
            }
Exemplo n.º 23
0
        public override void OnDoubleClick(Mobile m)
        {
            if (IsChildOf(m.Backpack))
            {
                m.BeginTarget(8, false, Targeting.TargetFlags.None, (from, targeted) =>
                {
                    if (targeted is IPoint3D)
                    {
                        IPoint3D p      = targeted as IPoint3D;
                        BaseHouse house = BaseHouse.FindHouseAt(new Point3D(p), m.Map, 16);

                        if (house != null && BaseHouse.FindHouseAt(m) == house && house.IsCoOwner(m))
                        {
                            Point3D pnt = new Point3D(p.X, p.Y, m.Z);

                            bool northWall = BaseAddon.IsWall(pnt.X, pnt.Y - 1, pnt.Z, m.Map);
                            bool westWall  = BaseAddon.IsWall(pnt.X - 1, pnt.Y, pnt.Z, m.Map);

                            if (northWall && westWall)
                            {
                                switch (from.Direction & Direction.Mask)
                                {
                                case Direction.North:
                                case Direction.South: northWall = true; westWall = false; break;

                                case Direction.East:
                                case Direction.West: northWall = false; westWall = true; break;

                                default: from.SendMessage("Turn to face the wall on which to place the safe."); return;
                                }
                            }

                            int itemID = 0;

                            if (northWall)
                            {
                                itemID = 0x8B8F;
                            }
                            else if (westWall)
                            {
                                itemID = 0x8B90;
                            }
                            else
                            {
                                m.SendLocalizedMessage(500268);     // This object needs to be mounted on something.
                            }
                            if (itemID != 0)
                            {
                                Item safe = new WallSafe(m);
                                safe.MoveToWorld(pnt, m.Map);

                                safe.ItemID = itemID;

                                house.Addons[safe] = m;

                                Delete();
                            }
                        }
                        else
                        {
                            m.SendLocalizedMessage(500274);     // You can only place this in a house that you own!
                        }
                    }
                });
            }
            else
            {
                m.SendLocalizedMessage(1080058); // This must be in your backpack to use it.
            }
        }
Exemplo n.º 24
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house != null && house.IsCoOwner(from))
                {
                    bool northWall = BaseAddon.IsWall(from.X, from.Y - 1, from.Z, from.Map);
                    bool westWall  = BaseAddon.IsWall(from.X - 1, from.Y, from.Z, from.Map);

                    if (northWall && westWall)
                    {
                        switch (from.Direction & Direction.Mask)
                        {
                        case Direction.North:
                        case Direction.South: northWall = true; westWall = false; break;

                        case Direction.East:
                        case Direction.West:  northWall = false; westWall = true; break;

                        default: from.SendMessage("Turn to face the wall on which to hang this trophy."); return;
                        }
                    }

                    int itemID = 0;

                    if (northWall)
                    {
                        itemID = m_NorthID;
                    }
                    else if (westWall)
                    {
                        itemID = m_WestID;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042626);                           // The trophy must be placed next to a wall.
                    }
                    if (itemID > 0)
                    {
                        Item trophy = new TrophyAddon(from, itemID, m_WestID, m_NorthID, m_DeedNumber, m_AddonNumber, m_Hunter, m_AnimalWeight, DateCaught);

                        if (m_DeedNumber == 1113567)
                        {
                            trophy.Hue = 1645;
                        }
                        else if (m_DeedNumber == 1113568)
                        {
                            trophy.Hue = 1032;
                        }

                        house.Addons[trophy] = from;
                        Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502092);                       // You must be in your house to do this.
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
        }
Exemplo n.º 25
0
 public void AddFireplace(int xoff, int yoff, int zoff)
 {
     m_Fireplace = new GrayBrickFireplaceSouthAddon();
     m_Fireplace.MoveToWorld(new Point3D(xoff + this.X, yoff + this.Y, zoff + this.Z), this.Map);
 }
Exemplo n.º 26
0
        public virtual void Pour_OnTarget(Mobile from, object targ)
        {
            if (IsEmpty || !Pourable || !ValidateUse(from, false))
            {
                return;
            }

            if (targ is BaseBeverage)
            {
                BaseBeverage bev = (BaseBeverage)targ;

                if (!bev.ValidateUse(from, true))
                {
                    return;
                }

                if (bev.IsFull && bev.Content == this.Content)
                {
                    from.SendLocalizedMessage(500848);                       // Couldn't pour it there.  It was already full.
                }
                else if (!bev.IsEmpty)
                {
                    from.SendLocalizedMessage(500846);                       // Can't pour it there.
                }
                else
                {
                    bev.Content  = this.Content;
                    bev.Poison   = this.Poison;
                    bev.Poisoner = this.Poisoner;

                    if (this.Quantity > bev.MaxQuantity)
                    {
                        bev.Quantity   = bev.MaxQuantity;
                        this.Quantity -= bev.MaxQuantity;
                    }
                    else
                    {
                        bev.Quantity += this.Quantity;
                        this.Quantity = 0;
                    }

                    from.PlaySound(0x4E);
                }
            }
            else if (from == targ)
            {
                if (from.Thirst < 20)
                {
                    from.Thirst += 1;
                }

                if (ContainsAlchohol)
                {
                    int bac = 0;

                    switch (this.Content)
                    {
                    case BeverageType.Ale: bac = 1; break;

                    case BeverageType.Wine: bac = 2; break;

                    case BeverageType.Cider: bac = 3; break;

                    case BeverageType.Liquor: bac = 4; break;
                    }

                    from.BAC += bac;

                    if (from.BAC > 60)
                    {
                        from.BAC = 60;
                    }

                    CheckHeaveTimer(from);
                }

                from.PlaySound(Utility.RandomList(0x30, 0x2D6));

                if (m_Poison != null)
                {
                    from.ApplyPoison(m_Poisoner, m_Poison);
                }

                --Quantity;
            }
            else if (targ is PlantItem)
            {
                ((PlantItem)targ).Pour(from, this);
            }
            else if (targ is AddonComponent &&
                     (((AddonComponent)targ).Addon is WaterVatEast || ((AddonComponent)targ).Addon is WaterVatSouth) &&
                     this.Content == BeverageType.Water)
            {
                PlayerMobile player = from as PlayerMobile;

                if (player != null)
                {
                    SolenMatriarchQuest qs = player.Quest as SolenMatriarchQuest;

                    if (qs != null)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(GatherWaterObjective));

                        if (obj != null && !obj.Completed)
                        {
                            BaseAddon vat = ((AddonComponent)targ).Addon;

                            if (vat.X > 5784 && vat.X < 5814 && vat.Y > 1903 && vat.Y < 1934 &&
                                ((qs.RedSolen && vat.Map == Map.Trammel) || (!qs.RedSolen && vat.Map == Map.Felucca)))
                            {
                                if (obj.CurProgress + Quantity > obj.MaxProgress)
                                {
                                    int delta = obj.MaxProgress - obj.CurProgress;

                                    Quantity       -= delta;
                                    obj.CurProgress = obj.MaxProgress;
                                }
                                else
                                {
                                    obj.CurProgress += Quantity;
                                    Quantity         = 0;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(500846);                   // Can't pour it there.
            }
        }
Exemplo n.º 27
0
 public void AddLoom(int xoff, int yoff, int zoff)
 {
     m_Loom = new LoomSouthAddon();
     m_Loom.MoveToWorld(new Point3D(xoff + this.X, yoff + this.Y, zoff + this.Z), this.Map);
 }
Exemplo n.º 28
0
 private static void AddComplexComponent(BaseAddon addon, int item, int xoffset, int yoffset, int zoffset, int hue, int lightsource)
 {
     AddComplexComponent(addon, item, xoffset, yoffset, zoffset, hue, lightsource, null, 1);
 }
Exemplo n.º 29
0
 public void AddOven(int xoff, int yoff, int zoff)
 {
     m_Oven = new StoneOvenSouthAddon();
     m_Oven.MoveToWorld(new Point3D(xoff + this.X, yoff + this.Y, zoff + this.Z), this.Map);
 }
Exemplo n.º 30
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

             	int version = reader.ReadInt();

             	m_Elevator = (BaseAddon)reader.ReadItem();
             	m_InUse = reader.ReadBool();
             	m_Height = reader.ReadInt();
             	m_Ticks = reader.ReadInt();
             	m_Peaked = reader.ReadBool();
             	m_OutOfUseID = reader.ReadInt();
             	m_InUseID = reader.ReadInt();
             	m_NorthWestEdge = reader.ReadPoint3D();
             	m_SizeNorthSouth = reader.ReadInt();
             	m_SizeEastWest = reader.ReadInt();

            if( reader.ReadBool() )
                BeginMove( reader.ReadDeltaTime() - DateTime.Now );
        }
Exemplo n.º 31
0
 public void AddPickS(int xoff, int yoff, int zoff)
 {
     m_Pick2 = new PickpocketDipSouthAddon();
     m_Pick2.MoveToWorld(new Point3D(xoff + this.X, yoff + this.Y, zoff + this.Z), this.Map);
 }
Exemplo n.º 32
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();
 }
Exemplo n.º 33
0
 public void AddSpinningWheelE(int xoff, int yoff, int zoff)
 {
     m_SpinningWheel1 = new SpinningwheelEastAddon();
     m_SpinningWheel1.MoveToWorld(new Point3D(xoff + this.X, yoff + this.Y, zoff + this.Z), this.Map);
 }
Exemplo n.º 34
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);
            }

        }
Exemplo n.º 35
0
 public void AddTrainingE(int xoff, int yoff, int zoff)
 {
     m_Training1 = new TrainingDummyEastAddon();
     m_Training1.MoveToWorld(new Point3D(xoff + this.X, yoff + this.Y, zoff + this.Z), this.Map);
 }
Exemplo n.º 36
0
        }                                                              // Where would you like to place this decoration?

        public void Placement_OnTarget(Mobile from, object targeted, object state)
        {
            if (!IsChildOf(from.Backpack))
            {
                return;
            }

            IPoint3D p = targeted as IPoint3D;

            if (p == null)
            {
                return;
            }

            Point3D loc = new Point3D(p);

            if (!from.Map.CanFit(loc.X, loc.Y, loc.Z, 1))               // TODO: Height
            {
                return;
            }

            BaseHouse house = BaseHouse.FindHouseAt(loc, from.Map, 16);

            if (house != null && house.IsOwner(from))
            {
                int itemID = (int)state;
                if (BaseAddon.IsWall(loc.X - 1, loc.Y - 1, loc.Z, from.Map) && ((itemID & 0x1) == 0x0 ? BaseAddon.IsWall(loc.X, loc.Y - 1, loc.Z, from.Map) : BaseAddon.IsWall(p.X - 1, p.Y, p.Z, from.Map)))
                {
                    HangingShield shield = new HangingShield(itemID);
                    shield.IsRewardItem = IsRewardItem;
                    shield.MoveToWorld(loc, from.Map);
                    house.Addons.Add(shield);
                    Delete();
                }
                else
                {
                    from.SendLocalizedMessage(1062840);                       // The decoration must be placed next to a wall.
                }
            }
            else
            {
                from.SendLocalizedMessage(1042036);                   // That location is not in your house.
            }
        }
Exemplo n.º 37
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();
            int count;

            switch ( version )
            {
                case 14:
                {
                    m_RelativeBanLocation = reader.ReadPoint3D();
                    goto case 13;
                }
                case 13: // removed ban location serialization
                case 12:
                {
                    m_VendorRentalContracts = reader.ReadItemList();
                    m_InternalizedVendors = reader.ReadMobileList();

                    int relocatedCount = reader.ReadEncodedInt();
                    for ( int i = 0; i < relocatedCount; i++ )
                    {
                        Point3D relLocation = reader.ReadPoint3D();
                        IEntity entity = World.FindEntity( reader.ReadInt() );

                        if ( entity != null )
                            m_RelocatedEntities.Add( new RelocatedEntity( entity, relLocation ) );
                    }

                    int inventoryCount = reader.ReadEncodedInt();
                    for ( int i = 0; i < inventoryCount; i++ )
                    {
                        VendorInventory inventory = new VendorInventory( this, reader );
                        m_VendorInventories.Add( inventory );
                    }

                    goto case 11;
                }
                case 11:
                {
                    m_LastRefreshed = reader.ReadDateTime();
                    m_RestrictDecay = reader.ReadBool();
                    goto case 10;
                }
                case 10: // just a signal for updates
                case 9:
                {
                    m_Visits = reader.ReadInt();
                    goto case 8;
                }
                case 8:
                {
                    m_Price = reader.ReadInt();
                    goto case 7;
                }
                case 7:
                {
                    m_Access = reader.ReadMobileList();
                    goto case 6;
                }
                case 6:
                {
                    m_BuiltOn = reader.ReadDateTime();
                    m_LastTraded = reader.ReadDateTime();
                    goto case 5;
                }
                case 5: // just removed fields
                case 4:
                {
                    m_Addons = reader.ReadItemList();
                    goto case 3;
                }
                case 3:
                {
                    count = reader.ReadInt();
                    m_Secures = new ArrayList( count );

                    for ( int i = 0; i < count; ++i )
                    {
                        SecureInfo info = new SecureInfo( reader );

                        if ( info.Item != null )
                        {
                            info.Item.IsSecure = true;
                            m_Secures.Add( info );
                        }
                    }

                    goto case 2;
                }
                case 2:
                {
                    m_Public = reader.ReadBool();
                    goto case 1;
                }
                case 1:
                {
                    if ( version < 13 )
                        reader.ReadPoint3D(); // house ban location
                    goto case 0;
                }
                case 0:
                {
                    if ( version < 14 )
                        m_RelativeBanLocation = this.BaseBanLocation;

                    if ( version < 12 )
                    {
                        m_VendorRentalContracts = new ArrayList();
                        m_InternalizedVendors = new ArrayList();
                    }

                    if ( version < 4 )
                        m_Addons = new ArrayList();

                    if ( version < 7 )
                        m_Access = new ArrayList();

                    if ( version < 8 )
                        m_Price = DefaultPrice;

                    m_Owner = reader.ReadMobile();

                    if ( version < 5 )
                    {
                        count = reader.ReadInt();

                        for(int i=0;i<count;i++)
                            reader.ReadRect2D();
                    }

                    UpdateRegion();

                    m_CoOwners = reader.ReadMobileList();
                    m_Friends = reader.ReadMobileList();
                    m_Bans = reader.ReadMobileList();

                    m_Sign = reader.ReadItem() as HouseSign;
                    m_Trash = reader.ReadItem() as TrashBarrel;
                    m_Chest = reader.ReadItem() as TentChest;
                    m_KeyOwner = reader.ReadUInt();

                    m_SmallForge = reader.ReadItem() as SmallForgeAddon;
                    m_LargeForge = reader.ReadItem() as LargeForgeSouthHouseAddon;
                    m_Anvil = reader.ReadItem() as AnvilEastAddon;
                    m_Loom = reader.ReadItem() as LoomSouthAddon;
                    m_SpinningWheel1 = reader.ReadItem() as SpinningwheelEastAddon;
                    m_SpinningWheel2 = reader.ReadItem() as SpinningwheelSouthAddon;
                    m_Oven = reader.ReadItem() as StoneOvenSouthAddon;
                    m_Fireplace = reader.ReadItem() as GrayBrickFireplaceSouthAddon;
                    m_Mill = reader.ReadItem() as FlourMillSouthAddon;
                    m_Training1 = reader.ReadItem() as TrainingDummyEastAddon;
                    m_Training2 = reader.ReadItem() as TrainingDummySouthAddon;
                    m_Pick1 = reader.ReadItem() as PickpocketDipEastAddon;
                    m_Pick2 = reader.ReadItem() as PickpocketDipSouthAddon;

                    m_Doors = reader.ReadItemList();
                    m_LockDowns = reader.ReadItemList();

                    for ( int i = 0; i < m_LockDowns.Count; ++i )
                        ((Item)m_LockDowns[i]).IsLockedDown = true;

                    for ( int i = 0; i < m_VendorRentalContracts.Count; ++i )
                        ((Item)m_VendorRentalContracts[i]).IsLockedDown = true;

                    if ( version < 3 )
                    {
                        ArrayList items = reader.ReadItemList();
                        m_Secures = new ArrayList( items.Count );

                        for ( int i = 0; i < items.Count; ++i )
                        {
                            Container c = items[i] as Container;

                            if ( c != null )
                            {
                                c.IsSecure = true;
                                m_Secures.Add( new SecureInfo( c, SecureLevel.CoOwners ) );
                            }
                        }
                    }

                    m_MaxLockDowns = reader.ReadInt();
                    m_MaxSecures = reader.ReadInt();

                    if ( (Map == null || Map == Map.Internal) && Location == Point3D.Zero )
                        Delete();

                    if ( m_Owner != null )
                    {
                        List<BaseHouse> list = null;
                        m_Table.TryGetValue( m_Owner, out list );

                        if ( list == null )
                            m_Table[m_Owner] = list = new List<BaseHouse>();

                        list.Add( this );
                    }
                    break;
                }
            }

            if ( version <= 1 )
                ChangeSignType( 0xBD2 );//private house, plain brass sign

            if ( version < 10 )
            {
                /* NOTE: This can exceed the house lockdown limit. It must be this way, because
                 * we do not want players' items to decay without them knowing. Or not even
                 * having a chance to fix it themselves.
                 */

                Timer.DelayCall( TimeSpan.Zero, new TimerCallback( FixLockdowns_Sandbox ) );
            }

            if ( version < 11 )
                m_LastRefreshed = DateTime.Now + TimeSpan.FromHours( 24 * Utility.RandomDouble() );

            if ( !CheckDecay() )
            {
                if ( RelocatedEntities.Count > 0 )
                    Timer.DelayCall( TimeSpan.Zero, new TimerCallback( RestoreRelocatedEntities ) );

                if ( m_Owner == null && m_Friends.Count == 0 && m_CoOwners.Count == 0 )
                    Timer.DelayCall( TimeSpan.FromSeconds( 10.0 ), new TimerCallback( Delete ) );
            }
        }
Exemplo n.º 38
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(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 Mondain's Legacy
                        if (addon != null)
                        {
                            addon.Resource = m_Deed.Resource;

                            if (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.
                }
            }
Exemplo n.º 39
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 1:
				{
					m_RegionBounds = reader.ReadRect2D();
					m_Traps = reader.ReadStrongItemList<BaseTrap>();

					goto case 0;
				}
				case 0:
				{
					if ( version < 1 )
					{
						m_Traps = new List<BaseTrap>();
						m_RegionBounds = new Rectangle2D( X - 40, Y - 40, 80, 80 );
					}

					m_Creatures = reader.ReadStrongMobileList();

					m_TypeName = reader.ReadString();
					m_Door = reader.ReadItem<BaseDoor>(); ;
					m_Addon = reader.ReadItem<BaseAddon>(); ;
					m_Sequence = reader.ReadItem<GauntletSpawner>();

					State = (GauntletSpawnerState)reader.ReadInt();

					break;
				}
			}
		}
Exemplo n.º 40
0
		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);

			int version = reader.ReadInt();

			switch (version)
			{
				case 0:
				{
					m_Addon = reader.ReadItem() as BaseAddon;
					break;
				}
			}
		}
Exemplo n.º 41
0
        public void Placement_OnTarget(Mobile from, object targeted, object state)
        {
            IPoint3D p = targeted as IPoint3D;

            if (p == null)
            {
                return;
            }

            Point3D loc = new Point3D(p);

            BaseHouse house = BaseHouse.FindHouseAt(loc, from.Map, 16);

            if (house != null && house.IsCoOwner(from))
            {
                bool northWall = BaseAddon.IsWall(loc.X, loc.Y - 1, loc.Z, from.Map);
                bool westWall  = BaseAddon.IsWall(loc.X - 1, loc.Y, loc.Z, from.Map);

                if (northWall && westWall)
                {
                    switch (from.Direction & Direction.Mask)
                    {
                    case Direction.North:
                    case Direction.South: northWall = true; westWall = false; break;

                    case Direction.East:
                    case Direction.West: northWall = false; westWall = true; break;

                    default: from.SendMessage("Turn to face the wall on which to hang this trophy."); return;
                    }
                }

                int itemID = 0;

                if (northWall)
                {
                    itemID = 0x9964;
                }
                else if (westWall)
                {
                    itemID = 0x9965;
                }
                else
                {
                    from.SendLocalizedMessage(1042626); // The trophy must be placed next to a wall.
                }
                if (itemID > 0)
                {
                    Item addon = new StaghornFernAddon();

                    addon.ItemID = itemID;
                    addon.MoveToWorld(loc, from.Map);

                    house.Addons[addon] = from;
                    Delete();
                }
            }
            else
            {
                from.SendLocalizedMessage(1042036); // That location is not in your house.
            }
        }
Exemplo n.º 42
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.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.
                }
            }