public InternalTarget(TownHouseSetupGump gump, TownHouseSign sign, TargetType type, Point3D point) : base(20, true, TargetFlags.None)
 {
     c_Gump     = gump;
     c_Sign     = sign;
     c_Type     = type;
     c_BoundOne = point;
 }
Пример #2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            if (version >= 2)
            {
                c_Hanger = reader.ReadItem();
            }

            c_Sign = (TownHouseSign)reader.ReadItem();

            if (version <= 2)
            {
                c_Blocks = new ArrayList();
                int count = reader.ReadInt();
                for (int i = 0; i < count; ++i)
                {
                    c_Blocks.Add(TownHouseSetupGump.FixRect(reader.ReadRect2D()));
                }
            }

            InitSectorDefinition();

            if (Price == 0)
            {
                Price = 1;
            }

            s_TownHouses.Add(this);
        }
Пример #3
0
 public override void OnDoubleClick(Mobile m)
 {
     if (m.AccessLevel != AccessLevel.Player)
     {
         TownHouseSetupGump.SendTo(m, this);
     }
     else if (!Visible)
     {
         return;
     }
     else if (CanBuyHouse(m) && !BaseHouse.HasAccountHouse(m))
     {
         TownHouseConfirmGump.SendTo(m, this);
     }
     else
     {
         m.SendMessage("You cannot purchase this house.");
     }
 }
 public InternalTarget(TownHouseSetupGump gump, TownHouseSign sign, TargetType type) : this(gump, sign, type, Point3D.Zero)
 {
 }
Пример #5
0
			public InternalTarget( TownHouseSetupGump gump, TownHouseSign sign, TargetType type, Point3D point ) : base( 20, true, TargetFlags.None )
			{
				c_Gump = gump;
				c_Sign = sign;
				c_Type = type;
				c_BoundOne = point;
			}
Пример #6
0
			public InternalTarget( TownHouseSetupGump gump, TownHouseSign sign, TargetType type ) : this( gump, sign, type, Point3D.Zero ){}
Пример #7
0
            protected override void OnTarget(Mobile m, object o)
            {
                var point = (IPoint3D)o;

                if (c_Contract == null || c_Contract.ParentHouse == null)
                {
                    return;
                }

                if (!c_Contract.ParentHouse.Region.Contains(new Point3D(point.X, point.Y, point.Z)))
                {
                    m.SendMessage("You must target within the home.");
                    m.Target = new InternalTarget(c_Gump, c_Contract, c_Type, c_BoundOne);
                    return;
                }

                switch (c_Type)
                {
                case TargetType.SignLoc:
                    c_Contract.SignLoc = new Point3D(point.X, point.Y, point.Z);
                    c_Contract.ShowSignPreview();
                    c_Gump.NewGump();
                    break;

                case TargetType.MinZ:
                    if (!c_Contract.ParentHouse.Region.Contains(new Point3D(point.X, point.Y, point.Z)))
                    {
                        m.SendMessage("That isn't within your house.");
                    }
                    else if (c_Contract.HasContractedArea(point.Z))
                    {
                        m.SendMessage("That area is already taken by another rental contract.");
                    }
                    else
                    {
                        c_Contract.MinZ = point.Z;

                        if (c_Contract.MaxZ < c_Contract.MinZ + 19)
                        {
                            c_Contract.MaxZ = point.Z + 19;
                        }
                    }

                    c_Contract.ShowFloorsPreview(m);
                    c_Gump.NewGump();
                    break;

                case TargetType.MaxZ:
                    if (!c_Contract.ParentHouse.Region.Contains(new Point3D(point.X, point.Y, point.Z)))
                    {
                        m.SendMessage("That isn't within your house.");
                    }
                    else if (c_Contract.HasContractedArea(point.Z))
                    {
                        m.SendMessage("That area is already taken by another rental contract.");
                    }
                    else
                    {
                        c_Contract.MaxZ = point.Z + 19;

                        if (c_Contract.MinZ > c_Contract.MaxZ)
                        {
                            c_Contract.MinZ = point.Z;
                        }
                    }

                    c_Contract.ShowFloorsPreview(m);
                    c_Gump.NewGump();
                    break;

                case TargetType.BlockOne:
                    m.SendMessage("Now target the south eastern corner.");
                    m.Target = new InternalTarget(c_Gump, c_Contract, TargetType.BlockTwo, new Point3D(point.X, point.Y, point.Z));
                    break;

                case TargetType.BlockTwo:
                    var rect = TownHouseSetupGump.FixRect(new Rectangle2D(c_BoundOne, new Point3D(point.X + 1, point.Y + 1, point.Z)));

                    if (c_Contract.HasContractedArea(rect, point.Z))
                    {
                        m.SendMessage("That area is already taken by another rental contract.");
                    }
                    else
                    {
                        c_Contract.Blocks.Add(rect);
                        c_Contract.ShowAreaPreview(m);
                    }

                    c_Gump.NewGump();
                    break;
                }
            }
Пример #8
0
            protected override void OnTarget(Mobile m, object o)
            {
                IPoint3D point = (IPoint3D)o;

                if (c_Contract == null || c_Contract.ParentHouse == null)
                {
                    return;
                }

                if (!c_Contract.ParentHouse.Region.Contains(new Point3D(point.X, point.Y, point.Z)))
                {
                    m.SendMessage("Vous devez cibler dans la maison");
                    m.Target = new InternalTarget(c_Gump, c_Contract, c_Type, c_BoundOne);
                    return;
                }

                switch (c_Type)
                {
                case TargetType.SignLoc:
                    c_Contract.SignLoc = new Point3D(point.X, point.Y, point.Z);
                    c_Contract.ShowSignPreview();
                    c_Gump.NewGump();
                    break;

                case TargetType.MinZ:
                    if (!c_Contract.ParentHouse.Region.Contains(new Point3D(point.X, point.Y, point.Z)))
                    {
                        m.SendMessage("Ce n'est pas dans votre maison");
                    }
                    else if (c_Contract.HasContractedArea(point.Z))
                    {
                        m.SendMessage("Cette zone est déjà prise par un autre contrat de location");
                    }
                    else
                    {
                        c_Contract.MinZ = point.Z;

                        if (c_Contract.MaxZ < c_Contract.MinZ + 19)
                        {
                            c_Contract.MaxZ = point.Z + 19;
                        }
                    }

                    c_Contract.ShowFloorsPreview(m);
                    c_Gump.NewGump();
                    break;

                case TargetType.MaxZ:
                    if (!c_Contract.ParentHouse.Region.Contains(new Point3D(point.X, point.Y, point.Z)))
                    {
                        m.SendMessage("Ce n'est pas dans votre maison");
                    }
                    else if (c_Contract.HasContractedArea(point.Z))
                    {
                        m.SendMessage("Cette zone est déjà prise par un autre contrat de location.");
                    }
                    else
                    {
                        c_Contract.MaxZ = point.Z + 19;

                        if (c_Contract.MinZ > c_Contract.MaxZ)
                        {
                            c_Contract.MinZ = point.Z;
                        }
                    }

                    c_Contract.ShowFloorsPreview(m);
                    c_Gump.NewGump();
                    break;

                case TargetType.BlockOne:
                    m.SendMessage("Maintenant, ciblez le coin sud-est");
                    m.Target = new InternalTarget(c_Gump, c_Contract, TargetType.BlockTwo, new Point3D(point.X, point.Y, point.Z));
                    break;

                case TargetType.BlockTwo:
                    Rectangle2D rect = TownHouseSetupGump.FixRect(new Rectangle2D(c_BoundOne, new Point3D(point.X + 1, point.Y + 1, point.Z)));

                    if (c_Contract.HasContractedArea(rect, point.Z))
                    {
                        m.SendMessage("Cette zone est déjà prise par un autre contrat de location");
                    }
                    else
                    {
                        c_Contract.Blocks.Add(rect);
                        c_Contract.ShowAreaPreview(m);
                    }

                    c_Gump.NewGump();
                    break;
                }
            }