Server.Multis.BaseHouse.HasAccountHouse C# (CSharp) Méthode

HasAccountHouse() public static méthode

public static HasAccountHouse ( Server.Mobile m ) : bool
m Server.Mobile
Résultat bool
		public static bool HasAccountHouse( Mobile m )
		{
			Account a = m.Account as Account;

			if ( a == null )
				return false;

    // A check based on Character need to be done here.
    ///////////////////////////////////////////////////////////////////
	//		for ( int i = 0; i < a.Length; ++i )
	//			if ( a[i] != null && HasHouse( a[i] ) )
	//				return true;

			return false;
		}

Usage Example

Exemple #1
0
        public void OnPlacement(Mobile from, Point3D p)
        {
            if (Deleted)
            {
                return;
            }

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                ArrayList            toMove;
                Point3D              center = new Point3D(p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z);
                HousePlacementResult res    = HousePlacement.Check(from, m_MultiID, center, out toMove, HasEastFacingDoor());

                switch (res)
                {
                case HousePlacementResult.Valid:
                {
                    if (from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse(from))
                    {
                        from.SendLocalizedMessage(501271);     // You already own a house, you may not place another!
                        return;
                    }

                    BaseHouse house = GetHouse(from);

                    //For Custom house, drop z-level by -8 <--- May need to revise after we add more custom houses
                    if (house is SmallStoneTempleHouse || house is MagistrateHouse || house is SandstoneSpaHouse || house is ArbiterEstate)
                    {
                        center.Z -= 8;
                    }

                    house.MoveToWorld(center, from.Map);
                    Delete();

                    for (int i = 0; i < toMove.Count; ++i)
                    {
                        object o = toMove[i];

                        if (o is Mobile)
                        {
                            ((Mobile)o).Location = house.BanLocation;
                        }

                        else if (o is Item)
                        {
                            ((Item)o).Location = house.BanLocation;
                        }
                    }

                    break;
                }

                case HousePlacementResult.BadRegionExistingHouse:
                {
                    from.SendMessage(149, "A house already exists at that location.");
                    break;
                }

                case HousePlacementResult.BadRegionHidden:
                {
                    from.SendMessage(149, "That location does not allow housing.");
                    break;
                }

                case HousePlacementResult.BadItem:
                case HousePlacementResult.BadLand:
                case HousePlacementResult.BadStatic:
                {
                    from.SendMessage(149, "House placement failed: White fire indicates tiles blocked by terrain and Blue fire indicates tiles violating housing proximity limits.");
                    //from.SendLocalizedMessage(1043287); // The house could not be created here.  Either something is blocking the house, or the house would not be on valid terrain.
                    break;
                }

                case HousePlacementResult.NoSurface:
                {
                    from.SendMessage(149, "House placement failed: White fire indicates tiles blocked by terrain and Blue fire indicates tiles violating housing proximity limits.");
                    //from.SendMessage("The house could not be created here.  Part of the foundation would not be on any surface.");
                    break;
                }

                case HousePlacementResult.BadRegion:
                {
                    from.SendLocalizedMessage(501265);     // Housing cannot be created in this area.
                    break;
                }

                case HousePlacementResult.BadRegionTemp:
                {
                    from.SendLocalizedMessage(501270);     //Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
                    break;
                }

                case HousePlacementResult.BadRegionRaffle:
                {
                    from.SendLocalizedMessage(1150493);     // You must have a deed for this plot of land in order to build here.
                    break;
                }
                }
            }
        }