Exemplo n.º 1
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;
                }
            }
Exemplo n.º 2
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;
                }
            }