Пример #1
0
            protected override void OnTarget(Mobile m, object o)
            {
                IPoint3D point = (IPoint3D)o;

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

                if (!m_Contract.ParentHouse.Region.Contains(new Point3D(point.X, point.Y, point.Z)))
                {
                    m.SendMessage("You must target within the home.");
                    m.Target = new InternalTarget(m_Gump, m_Contract, m_Type, m_BoundOne);
                    return;
                }

                switch (m_Type)
                {
                case TargetType.SignLoc:
                    m_Contract.SignLoc = new Point3D(point.X, point.Y, point.Z);
                    m_Contract.ShowSignPreview();
                    m_Gump.NewGump();
                    break;

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

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

                    m_Contract.ShowFloorsPreview(m);
                    m_Gump.NewGump();
                    break;

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

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

                    m_Contract.ShowFloorsPreview(m);
                    m_Gump.NewGump();
                    break;

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

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

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

                    m_Gump.NewGump();
                    break;
                }
            }
Пример #2
0
 private void Preview()
 {
     m_Contract.ShowAreaPreview(Owner);
     NewGump();
 }