Ejemplo n.º 1
0
 public Unit(House owner, UnitType type, bool alive, string name)
 {
     Owner = owner;
         Type = type;
         Alive = alive;
         Name = name;
 }
Ejemplo n.º 2
0
 public void A_house_gets_one_dishwasher_one_fridge_and_one_cabinet()
 {
     House house = new House();
     Assert.IsNotNull(house.Dishwasher);
     Assert.IsNotNull(house.KitchenCabinet);
     Assert.IsNotNull(house.Refrigerator);
 }
Ejemplo n.º 3
0
 public void Ensure_that_moving_items_requires_you_to_pick_them_up_first()
 {
     Avatar avatar = new Avatar();
     BarOfSoap barOfSoap = new BarOfSoap();
     House house = new House();
     avatar.Put(barOfSoap).In(house);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Deletes state and info for specified module.
 /// </summary>
 /// <param name="house">House code.</param>
 /// <param name="unit">Unit code.</param>
 /// <exception cref="ProtocolViolationException"></exception>
 /// <exception cref="WebException"></exception>
 /// <returns>True if delete was successful</returns>
 public bool DeleteModule(House house, Unit unit)
 {
     HttpWebRequest request = GetRequest(house, unit, "DELETE");
     HttpWebResponse response = GetHttpResponse(request);
     StandardMessage module = (StandardMessage)GetX10Message(response);
     return module.ModuleType == ModuleType.Unknown && String.IsNullOrEmpty(module.Name) && !module.On.HasValue;
 }
Ejemplo n.º 5
0
            public void VisitNextHouse(char direction)
            {
                House nextHouse = null;

                switch (direction)
                {
                    case '^':
                        nextHouse = new House(CurrentHouse.X, CurrentHouse.Y + 1);
                        break;

                    case 'v':
                        nextHouse = new House(CurrentHouse.X, CurrentHouse.Y - 1);
                        break;

                    case '<':
                        nextHouse = new House(CurrentHouse.X - 1, CurrentHouse.Y);
                        break;

                    case '>':
                        nextHouse = new House(CurrentHouse.X + 1, CurrentHouse.Y);
                        break;
                }

                if (!Houses.Any(h => h.X == nextHouse.X && h.Y == nextHouse.Y))
                    Houses.Add(nextHouse);

                CurrentHouse = nextHouse;
            }
Ejemplo n.º 6
0
 public int CurrentSupplyForHouse(House h1)
 {
     foreach (House h in Position0)
     {
         if (h.HouseCharacter == h1.HouseCharacter)
         {
             Position0.Remove(h);
             return 0;
         }
     }
     foreach (House h in Position1)
     {
         if (h.HouseCharacter == h1.HouseCharacter)
         {
             Position1.Remove(h);
             return 1;
         }
     }
     foreach (House h in Position2)
     {
         if (h.HouseCharacter == h1.HouseCharacter)
         {
             Position2.Remove(h);
             return 2;
         }
     }
     foreach (House h in Position3)
     {
         if (h.HouseCharacter == h1.HouseCharacter)
         {
             Position3.Remove(h);
             return 3;
         }
     }
     foreach (House h in Position4)
     {
         if (h.HouseCharacter == h1.HouseCharacter)
         {
             Position4.Remove(h);
             return 4;
         }
     }
     foreach (House h in Position5)
     {
         if (h.HouseCharacter == h1.HouseCharacter)
         {
             Position5.Remove(h);
             return 5;
         }
     }
     foreach (House h in Position6)
     {
         if (h.HouseCharacter == h1.HouseCharacter)
         {
             Position6.Remove(h);
             return 6;
         }
     }
     return 0;
 }
Ejemplo n.º 7
0
 public InvoiceControl( Invoice invoice, House house, GUI gui )
 {
     this.invoice = invoice;
     this.gui = gui;
     this.house = house;
     InitializeComponent();
 }
Ejemplo n.º 8
0
    public void GoHome(House[] allHouses)
    {
        float nearestHouseDistance = 0;

        for(int i = 0; i < allHouses.Length; i++)
        {
            if (allHouses[i].gameObject.activeInHierarchy && allHouses[i].currentCapacity < allHouses[i].capacity)
            {
                nearestHousePosition = allHouses[i].transform.position;
                nearestHouseDistance = Vector2.Distance(nearestHousePosition, transform.position);
                break;
            }
        }

        for (int i = 0; i < allHouses.Length; i++)
        {
            if (allHouses[i].currentCapacity < allHouses[i].capacity)
            {
                if (allHouses[i].isActiveAndEnabled && Vector2.Distance(allHouses[i].transform.position, transform.position) < nearestHouseDistance)
                {
                    nearestHousePosition = allHouses[i].transform.position;
                    nearestHouseDistance = Vector2.Distance(nearestHousePosition, transform.position);

                }
            }
        }

        comingHome = true;
    }
Ejemplo n.º 9
0
 /// <summary>
 /// Creates new X10 extended message.
 /// </summary>
 /// <param name="house">Valid range is A-P.</param>
 /// <param name="unit">Valid units are 01-16.</param>
 /// <param name="command">Only commands ExtendedCode and ExtendedData are valid for extended messages.</param>
 /// <param name="extendedCommand">Byte 0-255. Make sure that either extended command or data is above 0.</param>
 /// <param name="extendedData">Byte 0-255. Make sure that either extended command or data is above 0.</param>
 public ExtendedMessage(House house, Unit unit, Command command, byte extendedCommand, byte extendedData)
     : base(house, unit, command)
 {
     Validate(extendedCommand, extendedData);
     ExtendedCommand = extendedCommand;
     ExtendedData = extendedData;
 }
Ejemplo n.º 10
0
 public Game()
 {
     House = new House();
     fOpponent = new Opponent(House.LivingRoom);
     NumMoves = 0;
     GameStatus = GameStatusEnum.InitialStatus;
 }
Ejemplo n.º 11
0
 public void SendCommand(House house, int moduleNumber, ModuleState state)
 {
     byte[] a1on = GetBytesForModule(house, moduleNumber, state);
     SendHeader();
     SendByte(a1on[0]);
     SendByte(a1on[1]);
     SendFooter();
 }
Ejemplo n.º 12
0
 public void Save(House obj)
 {
     if (obj.Id == 0)
         context.Entry(obj).State = System.Data.Entity.EntityState.Added;
     else
         context.Entry(obj).State = System.Data.Entity.EntityState.Modified;
     context.SaveChanges();
 }
Ejemplo n.º 13
0
    public static void Build(House prefab, Base team, float position)
    {
        House h = Instantiate(prefab);
        h.center = GameObject.FindGameObjectWithTag("Center").transform;

        h.Position = position;
        h.teamBase = team;
        h.DirectionIsToLeft = !(team.isLight) == (position < 270 && position > 90);
    }
Ejemplo n.º 14
0
        public void CanClone()
        {
            var house = new House("my house", 1, 3);
            var other = house.Clone();

            Assert.AreEqual(house.DoorCount, other.DoorCount);
            Assert.AreEqual(house.WindowCount, other.WindowCount);
            Assert.AreEqual(house.Name, other.Name);
        }
Ejemplo n.º 15
0
        static void tstInheritance1()
        {
            Stock stock = new Stock { Name = "MSFT", SharesOwned = 1500 };
            House house = new House { Name = "SAS", Mortgage = 2300 };

            stock.Display();
            house.Display();

            //Upcasting
            Stock stock2 = new Stock();
            Asset asset = stock2;

            Console.WriteLine((asset == stock2 ? "asset == stock2!" : "asset != stock2!"));
            //asset.SharesOwned;     - yet Stock fields aren't accessible!!!

            //To access Stock fields DOWNCASTING is needed!!
            Stock stock3 = (Stock) asset;

            Console.WriteLine(stock3.SharesOwned);      // <No error>
            Console.WriteLine(stock3 == asset);         // True
            Console.WriteLine(stock3 == stock2);        // True

            //AS operator
            Asset a = new Asset();
            Stock s = a as Stock; // s is null; no exception thrown

            try {
                long shares1 = ((Stock)a).SharesOwned; // Approach #1
            }
            catch (InvalidCastException ice) {
                Console.WriteLine(ice.ToString());
            }

            if (s != null) {
                Console.WriteLine(s.SharesOwned);
                long shares2 = (a as Stock).SharesOwned; // Approach #2
            }

            /*  
             *  Another way of looking at it is that with the cast operator (Approach #1), you’re
                saying to the compiler: “I’m certain of a value’s type; if I’m
                wrong, there’s a bug in my code, so throw an exception!”
                Whereas with the as operator (Approach #2), you’re uncertain of its type and
                want to branch according to the outcome at runtime.
             * */

            //IS operator
            if (a is Stock)
                Console.WriteLine(((Stock)a).SharesOwned);

            /*
             *  The is operator tests whether a reference conversion would succeed; in other words,
                whether an object derives from a specified class (or implements an interface). It is
                often used to test before downcasting. 
             * */
        }
Ejemplo n.º 16
0
    public int CountSupplyForHouseTerritory(House h)
    {
        int supply = 0;
        foreach (Territory T in h.OwnedTerritories)
        {
            supply = supply + T.Barrels;
        }

        return supply;
    }
Ejemplo n.º 17
0
 public SeaTerritory(string name, int numShips, House houseOccupied, bool isOccupied, OrderToken orderToken, List<string> landConnections, List<string> seaConnections)
 {
     this.name = name;
     this.numShips = numShips;
     this.houseOccupied = houseOccupied;
     this.orderToken = orderToken;
     this.landConnections = landConnections;
     this.seaConnections = seaConnections;
     this.isOccupied = isOccupied;
 }
Ejemplo n.º 18
0
        public void MultivariateScaled(decimal size, int bedroomCount, decimal priceFrom, decimal priceTo)
        {
            //var algorithm = new LinearRegression(_houses, _housePrices, new Settings { InputSplitRatio = InputSplitRatio.No, MaxIterations = 400});
            //the above works - looks like IsConverging isn't working properly
            var algorithm = new LinearRegression(_houses, _housePrices, new Settings { InputSplitRatio = InputSplitRatio.No});

            var house = new House { Size = size, BedroomCount = bedroomCount };
            var price = algorithm.GetPrediction(house);

            Assert.That(price, Is.InRange(priceFrom, priceTo), "Incorrect price prediction for [" + house + "]");
        }
Ejemplo n.º 19
0
 // Here we serialize our UserData object of myData
 public string SerializeObject(House pObject)
 {
     string XmlizedString = null;
     MemoryStream memoryStream = new MemoryStream();
     XmlSerializer xs = new XmlSerializer(typeof(House));
     XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);
     xs.Serialize(xmlTextWriter, pObject);
     memoryStream = (MemoryStream)xmlTextWriter.BaseStream;
     XmlizedString = UTF8ByteArrayToString(memoryStream.ToArray());
     return XmlizedString;
 }
Ejemplo n.º 20
0
        public override void Execute(params string[] commandParams)
        {
            string houseName = commandParams[0];
            decimal initialTreasuryAmount = decimal.Parse(commandParams[1]);

            IHouse house = new House(houseName, initialTreasuryAmount);

            this.Engine.Continent.AddHouse(house);

            this.Engine.Render("Successfully created House {0}", house.Name);
        }
Ejemplo n.º 21
0
 public void Ensure_that_moving_items_properly_transfers_them()
 {
     Avatar avatar = new Avatar();
     BarOfSoap barOfSoap = new BarOfSoap();
     avatar.PickUp(barOfSoap);
     House house = new House();
     avatar.Put(barOfSoap).In(house);
     Assert.AreSame(house, barOfSoap.ParentContainerObject);
     Assert.IsFalse(avatar.Contents.Any(x => x.ObjectId == barOfSoap.ObjectId));
     Assert.IsTrue(house.Contents.Any(x => x.ObjectId == barOfSoap.ObjectId));
 }
Ejemplo n.º 22
0
    public GameObject GetObject()
    {
        for (int i = 0; i < houses.Count; i++) {
            if(!houses[i].HouseModel.activeInHierarchy)
                return houses[i].HouseModel;
        }

        House obj = new House();
        obj.HouseModel = Instantiate(house);
        obj.HouseModel.SetActive(false);
        houses.Add(obj);
        return obj.HouseModel;
    }
Ejemplo n.º 23
0
        public override void OnPush(IBot bot, IPlayer player, House house, int dx, int dy)
        {
            int blockId = bot.Room.getBlock(0, X + 2 * dx, Y + 2 * dy).Id;

            if (blockId == 414 || blockId == 4)
            {
                int xx = X + 2 * dx + 1;
                int yy = Y + 2 * dy + 1;
                string text = "/teleport " + player.Name + " " + xx + " " + yy;
                if (player.Name == house.builder)
                    bot.ChatSayer.Say(text);
            }
        }
Ejemplo n.º 24
0
 private HouseBuilder()
 {
     this.house = new House(WidthInMeters, LengthInMeters)
     {
         Roof = new Roof { Color = Color.Red, Size = DefaultRoofSizeInSquareMeters },
         FacadeColor = Color.Gray,
         FrontDoor = new FrontDoor
         {
             Color = Color.Gray,
             Width = DefaultDoorWidthInMeters,
             Height = DefaultDoorHeightInMeters
         }
     };
 }
Ejemplo n.º 25
0
    public void environment_1(Environment e, UsefulMethods odd, Player player)
    {
        House h1 = new House();
        Console.WriteLine(" You wake up in a wooded area, you are unsure of what happened or how you got there.");
        Console.WriteLine(" You look around and can see a small cabin off in the distance. how do you procced? ");
        Console.Write("1: Go to the cabin \n2: Walk in the opposite direction");
        int ans = Convert.ToInt32(Console.ReadLine());

        if (ans == 1)
            h1.cabin(odd, player);
        else if (ans == 2)
            throw new NotImplementedException();
        else
            Console.WriteLine("Please choose from an option above");
    }
Ejemplo n.º 26
0
 /// <summary>
 /// Creates new X10 standard message.
 /// </summary>
 /// <param name="house">Valid range is A-P.</param>
 /// <param name="unit">Valid units are 01-16 and X for no unit.</param>
 /// <param name="command">All commands are valid, use X for no command.</param>
 public StandardMessage(House house, Unit unit, Command command)
 {
     Source = MessageSource.Unknown;
     if (house == House.X)
     {
         throw new ArgumentException(
             "House is outside valid range A-P. " +
             "X (all house codes) only allowed when requesting module state or parsing response from module state wipe.");
     }
     House = house;
     Unit = unit;
     Url = "/" + House + "/" + ((byte)Unit + 1) + "/";
     Command = command;
     ModuleType = ModuleType.Unknown;
 }
Ejemplo n.º 27
0
    void Start()
    {
        player = new Player ();
        houses = new List<House> ();

        float x = 0.73f;
        for (int i = 0; i < 5; i++) {
            House obj = new House();
            obj.HouseModel = Instantiate(house);
            obj.Position = new Vector3(x, 0, 0);
            houses.Add(obj);

            x -= 0.73f;
        }
    }
Ejemplo n.º 28
0
        public JsonResult Create(House house = null)
        {
            house = new House()
            {
                CreateTime = DateTime.Now,
                HouseFloor = "11",
                HouseName = "House-1",
                BuildNo = "3519",
                HouseNo = "123456"
            };


            service.Add(house);

            return Json(house, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 29
0
 public LandTerritory(string name, int numSupply, int numCrowns, int numInfantry, int numKnight, int numSiegeEngine,
     bool hasCastle, bool hasStronghold, bool isOccupied, House houseOccupied, OrderToken orderToken, Button button, List<string> connections)
 {
     this.name = name;
     this.numSupply = numSupply;
     this.numCrowns = numCrowns;
     this.hasCastle = hasCastle;
     this.hasStronghold = hasStronghold;
     this.numInfantry = numInfantry;
     this.numKnight = numKnight;
     this.isOccupied = isOccupied;
     this.numSiegeEngine = numSiegeEngine;
     this.houseOccupied = houseOccupied;
     this.orderToken = orderToken;
     this.connections = connections;
     this.button = button;
 }
Ejemplo n.º 30
0
        /// <summary>
        /// Returns the first house found for the given coordinates, or a default value.
        /// </summary>
        /// <param name="X">X coordinate of house.</param>
        /// <param name="Y">Y coordinate of house.</param>
        /// <returns>The house found, or a House instance with default values.</returns>
        public House GetForPosition(int X, int Y)
        {
            House Ho = Context.Context.Houses.FirstOrDefault(x => x.X == X && x.Y == Y);

            if (Ho != null)
                return Ho;
            else
            {
                Ho = new House();
                Ho.X = X;
                Ho.Y = Y;
                Ho.Description = "You can purchase this lot, it is not owned by anyone.";
                Ho.Name = "TestLot";

                return Ho;
            }
        }
Ejemplo n.º 31
0
 public async Task <House> Create(House house)
 {
     return(await repository.AddHouseAsync(house));
 }
Ejemplo n.º 32
0
 public SCLoginCharInfoHouse(uint id, House house) : base(SCOffsets.SCLoginCharInfoHousePacket, 5)
 {
     _id    = id;
     _house = house;
 }
Ejemplo n.º 33
0
        public void ParkCommand(Client player)
        {
            if (player.VehicleSeat != (int)VehicleSeat.Driver)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.not_vehicle_driving);
            }
            else if (player.Vehicle.GetData(EntityData.VEHICLE_FACTION) != Constants.FACTION_NONE)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.vehicle_faction_park);
            }
            else if (player.Vehicle.TraileredBy != null && player.Vehicle.TraileredBy.Exists)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.vehicle_is_trailered);
            }
            else
            {
                if (!Vehicles.HasPlayerVehicleKeys(player, player.Vehicle, true) && !Faction.IsPoliceMember(player))
                {
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.not_car_keys);
                }
                else
                {
                    // Get the closest parking
                    ParkingModel parking = parkingList.Where(p => player.Position.DistanceTo(p.position) < 3.5f).FirstOrDefault();

                    if (parking == null)
                    {
                        // Player's not in any parking
                        player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.not_parking_near);
                        return;
                    }

                    switch (parking.type)
                    {
                    case Constants.PARKING_TYPE_PUBLIC:
                        if (Vehicles.HasPlayerVehicleKeys(player, player.Vehicle, true))
                        {
                            string message = string.Format(InfoRes.parking_cost, Constants.PRICE_PARKING_PUBLIC);
                            player.SendChatMessage(Constants.COLOR_INFO + message);
                            PlayerParkVehicle(player, parking);
                        }
                        else
                        {
                            // The player doesn't have the keys
                            player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.not_car_keys);
                        }
                        break;

                    case Constants.PARKING_TYPE_GARAGE:
                        HouseModel house = House.GetHouseById(parking.houseId);
                        if (house == null || House.HasPlayerHouseKeys(player, house) == false)
                        {
                            player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_garage_access);
                        }
                        else if (GetParkedCarAmount(parking) == parking.capacity)
                        {
                            player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.parking_full);
                        }
                        else if (!Vehicles.HasPlayerVehicleKeys(player, player.Vehicle, true))
                        {
                            player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.not_car_keys);
                        }
                        else
                        {
                            player.SendChatMessage(Constants.COLOR_INFO + InfoRes.vehicle_garage_parked);
                            PlayerParkVehicle(player, parking);
                        }
                        break;

                    case Constants.PARKING_TYPE_DEPOSIT:
                        if (!Faction.IsPoliceMember(player))
                        {
                            player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_police_faction);
                        }
                        else
                        {
                            player.SendChatMessage(Constants.COLOR_INFO + InfoRes.vehicle_deposit_parked);
                            PlayerParkVehicle(player, parking);
                        }
                        break;

                    default:
                        player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.not_parking_allowed);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 34
0
 public void Add(House house)
 {
     this._houseDao.Add(house);
 }
Ejemplo n.º 35
0
        public async Task <IActionResult> Put([FromBody] House house)
        {
            await hauseService.UpdateHouse(house);

            return(Ok(house));
        }
Ejemplo n.º 36
0
 private void Awake()
 {
     currentHouse = null;
 }
Ejemplo n.º 37
0
 private void Awake()
 {
     doorView   = GetComponentInChildren <DoorView>();
     m_Collider = GetComponent <BoxCollider>();
     m_House    = GetComponentInParent <House>();
 }
Ejemplo n.º 38
0
        /// <summary>
        /// Adds character inside a house with a certain ID
        /// </summary>
        /// <param name="id">House id</param>
        /// <param name="character">Character</param>
        public void AddCharacterToHouseWithId(int id, Character character)
        {
            House house = GetHouseForId(id);

            house.AddOccupant(character);
        }
Ejemplo n.º 39
0
        /// <summary>
        /// Removes a character from a house with certain ID
        /// </summary>
        /// <param name="id">House id</param>
        /// <param name="character">Character</param>
        public void RemoveCharacterFromHouseWithId(int id, Character character)
        {
            House house = GetHouseForId(id);

            house.RemoveOccupant(character);
        }
Ejemplo n.º 40
0
        public async Task <HttpResponseMessage> Import()
        {
            if (!Request.Content.IsMimeMultipartContent())
            {
                throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
            }
            MultipartMemoryStreamProvider provider = await Request.Content.ReadAsMultipartAsync();

            HttpContent content = provider.Contents.First();
            Stream      stream  = await content.ReadAsStreamAsync();

            string    fileName = content.Headers.ContentDisposition.FileName.Trim('"');
            DataTable dt       = Excel.ExcelToDataTable(fileName, stream);

            dt.Columns.Add("导入状态");
            dt.Columns.Add("导入备注");
            foreach (DataRow dr in dt.Rows)
            {
                string EstateName = dr[0].ToString();
                if (!string.IsNullOrEmpty(EstateName))
                {
                    Estate estate = db.Estates.FirstOrDefault(w => w.EstateName == EstateName);
                    if (estate != null)
                    {
                        string HouseNo = dr[1].ToString();
                        House  house   = db.Houses.FirstOrDefault(w => w.EstateId == estate.EstateId && w.HouseNo == HouseNo);
                        if (house != null)
                        {
                            Owner owner = db.Owners.FirstOrDefault(w => w.HouseId == house.HouseId);
                            if (owner != null)
                            {
                                string   CarNumber = dr[2].ToString();
                                OwnerCar car       = db.OwnerCars.FirstOrDefault(w => w.OwnerId == owner.OwnerId && w.CarNumber == CarNumber);
                                if (car == null)
                                {
                                    car           = new OwnerCar();
                                    car.OwnerId   = owner.OwnerId;
                                    car.CarNumber = CarNumber;
                                    db.OwnerCars.Add(car);
                                    db.SaveChanges();
                                }
                                try
                                {
                                    Parking parking = new Parking();
                                    parking.CarId     = car.CarId;
                                    parking.PayerName = owner.CheckInName;
                                    parking.UnitPrice = decimal.Parse(dr[3].ToString());
                                    CostConfig config = db.CostConfigs.FirstOrDefault(w => w.EstateId == estate.EstateId && w.ConfigType == "parking" && w.UnitPrice == parking.UnitPrice);
                                    if (config != null)
                                    {
                                        parking.ConfigId = config.ConfigId;
                                    }
                                    parking.MonthCount = double.Parse(dr[4].ToString());
                                    parking.Amount     = decimal.Parse(dr[5].ToString());
                                    parking.CreateTime = DateTime.Now;
                                    DateTime PayTime = DateTime.MinValue;
                                    if (DateTime.TryParse(dr[6].ToString(), out PayTime))
                                    {
                                        parking.PayTime = PayTime;
                                    }
                                    DateTime StartDate = DateTime.MinValue;
                                    if (DateTime.TryParse(dr[7].ToString(), out StartDate))
                                    {
                                        parking.StartDate = StartDate;
                                    }
                                    DateTime EndDate = DateTime.MinValue;
                                    if (DateTime.TryParse(dr[8].ToString(), out EndDate))
                                    {
                                        parking.EndDate = EndDate;
                                    }
                                    parking.ReceiptNo    = dr[9].ToString();
                                    parking.VoucherNo    = dr[10].ToString();
                                    parking.OprationName = dr[11].ToString();
                                    parking.PayWay       = dr[12].ToString();
                                    parking.Remark       = dr[13].ToString();
                                    if (parking.PayTime != null)
                                    {
                                        parking.Status = 1;
                                    }
                                    if (db.Parkings.Count(w => w.CarId == car.CarId && w.Amount == parking.Amount && w.MonthCount == parking.MonthCount && w.StartDate == parking.StartDate && w.EndDate == parking.EndDate) == 0)
                                    {
                                        db.Parkings.Add(parking);
                                        db.SaveChanges();
                                        dr[14] = "成功";
                                        dr[15] = "新增";
                                    }
                                    else
                                    {
                                        Parking newParking = db.Parkings.First(w => w.CarId == car.CarId && w.Amount == parking.Amount && w.MonthCount == parking.MonthCount && w.StartDate == parking.StartDate && w.EndDate == parking.EndDate);
                                        Ricky.ObjectCopy.Copy <Parking>(parking, newParking, new string[] { "ParkingId", "PayerName", "UserId" });
                                        db.SaveChanges();
                                        dr[14] = "成功";
                                        dr[15] = "修改";
                                    }
                                }
                                catch (Exception e)
                                {
                                    dr[14] = "失败";
                                    dr[15] = e.Message;
                                }
                            }
                            else
                            {
                                dr[14] = "失败";
                                dr[15] = "没有找到业主";
                            }
                        }
                        else
                        {
                            dr[14] = "失败";
                            dr[15] = "沒有找到此房产";
                        }
                    }
                    else
                    {
                        dr[14] = "失败";
                        dr[15] = "沒有找到此小区";
                    }
                }
                else
                {
                    dr[14] = "失败";
                    dr[15] = "缺少所属小区名称";
                }
            }
            db.Database.ExecuteSqlCommand("update OwnerCar set ParkingExpireDate=t.EndDate from (select CarId,MAX(EndDate) EndDate from Parking group by CarId)t where OwnerCar.CarId=t.CarId");
            string fileSaveLocation = HttpContext.Current.Server.MapPath("~/upload/parking");

            if (!Directory.Exists(fileSaveLocation))
            {
                Directory.CreateDirectory(fileSaveLocation);
            }
            string Name         = fileName.Substring(0, fileName.LastIndexOf('.'));
            Excel  excel        = new Excel(dt);
            string saveFileName = string.Format("{1}{2}.xlsx", fileSaveLocation, Name, DateTime.Now.ToString("yyyyMMddHHmmssfff"));

            excel.Save(fileSaveLocation + "\\" + saveFileName);
            return(Request.CreateResponse(HttpStatusCode.OK, new { Status = 1, filename = saveFileName }));
        }
Ejemplo n.º 41
0
        public static int GetHouseNumberByPlayer(GamePlayer p)
        {
            House house = GetHouseByPlayer(p);

            return(house != null ? house.HouseNumber : 0);
        }
Ejemplo n.º 42
0
        public static bool Start(GameClient client = null)
        {
            // load hookpoint offsets
            House.LoadHookpointOffsets();

            // initialize the house template manager
            HouseTemplateMgr.Initialize();

            _houseList = new Dictionary <ushort, Dictionary <int, House> >();
            _idList    = new Dictionary <ushort, int>();

            int regions = 0;

            foreach (RegionEntry entry in WorldMgr.GetRegionList())
            {
                Region reg = WorldMgr.GetRegion(entry.id);
                if (reg != null && reg.UseHousingManager)
                {
                    if (!_houseList.ContainsKey(reg.ID))
                    {
                        _houseList.Add(reg.ID, new Dictionary <int, House>());
                    }

                    if (!_idList.ContainsKey(reg.ID))
                    {
                        _idList.Add(reg.ID, 0);
                    }

                    regions++;
                }
            }

            int houses     = 0;
            int lotmarkers = 0;

            foreach (DBHouse house in GameServer.Database.SelectAllObjects <DBHouse>())
            {
                Dictionary <int, House> housesForRegion;

                _houseList.TryGetValue(house.RegionID, out housesForRegion);

                // if we don't have the given region loaded as a housing zone, skip this house
                if (housesForRegion == null)
                {
                    continue;
                }

                // if we already loaded this house, that's no bueno, but just skip
                if (housesForRegion.ContainsKey(house.HouseNumber))
                {
                    continue;
                }

                if (SpawnLot(house, housesForRegion) == eLotSpawnType.House)
                {
                    houses++;
                }
                else
                {
                    lotmarkers++;
                }
            }

            if (log.IsInfoEnabled)
            {
                log.Info("[Housing] Loaded " + houses + " houses and " + lotmarkers + " lotmarkers in " + regions + " regions!");
            }

            if (client != null)
            {
                client.Out.SendMessage("Loaded " + houses + " houses and " + lotmarkers + " lotmarkers in " + regions + " regions!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }

            if (CheckRentTimer != null)
            {
                CheckRentTimer.Change(Properties.RENT_CHECK_INTERVAL * 60 * 1000, Properties.RENT_CHECK_INTERVAL * 60 * 1000);
            }
            else
            {
                CheckRentTimer = new Timer(CheckRents, null, Properties.RENT_CHECK_INTERVAL * 60 * 1000, Properties.RENT_CHECK_INTERVAL * 60 * 1000);
            }

            return(true);
        }
        public async Task <bool> UpdateHouseInCompanyAsync(long companyId, long houseId, House newHouse)
        {
            var efHouse = await _context.Houses.FirstOrDefaultAsync(h => h.EfCompanyId == companyId && h.Id == houseId);

            if (efHouse == null)
            {
                throw new KeyNotFoundException("Дом не найден");
            }

            efHouse.Address      = newHouse.Address;
            efHouse.MetroStation = newHouse.MetroStation;
            efHouse.Year         = newHouse.Year;
            if (newHouse.WallMaterial == null)  // материал стен не известен
            {
                efHouse.WallMaterialId = null;
            }
            else
            if (newHouse.WallMaterial.Id != 0)   // материал стен уже добавленный
            {
                efHouse.WallMaterialId = newHouse.WallMaterial.Id;
            }
            else
            if (newHouse.WallMaterial.Id == 0)  // материал стен новый
            {
                var efWallMaterial = Mapper.Map <EfWallMaterial>(newHouse.WallMaterial);
                efHouse.WallMaterial = efWallMaterial;
            }

            var res = _context.Houses.Update(efHouse);

            return(res.State == EntityState.Modified);
        }
Ejemplo n.º 44
0
        public TransactionResult PayForHouseBuy(Money money, Citizen owner, Citizen buyer, House house)
        {
            var sourceEntity      = buyer.Entity;
            var destinationEntity = owner.Entity;

            var transaction = new Transaction()
            {
                Arg1                = "House Buy From Citizen",
                Arg2                = string.Format("{0}({1}) bought for house from {2}({3})", sourceEntity.Name, sourceEntity.EntityID, destinationEntity.Name, destinationEntity.EntityID),
                SourceEntityID      = buyer.ID,
                DestinationEntityID = owner.ID,
                Money               = money,
                TransactionType     = TransactionTypeEnum.HouseBuy
            };

            return(transactionsService.MakeTransaction(transaction));
        }
Ejemplo n.º 45
0
 public XWing(Value value, IEnumerable <Position> positions, IEnumerable <Position> positionsToRemove, House house)
 {
     Value             = value;
     Positions         = positions;
     PositionsToRemove = positionsToRemove;
     House             = house;
 }
Ejemplo n.º 46
0
        public async Task <IActionResult> Post([FromBody] House house)
        {
            await hauseService.CreateNewHouse(house);

            return(Ok(house));
        }
Ejemplo n.º 47
0
        public BaseResultEntity Post(ImportHouseInfoRequestEntity ImportHouse)
        {
            Logger.LogDebug("ImportHouseInfo Request:" + JsonHelper.SerializeObject(ImportHouse), "ImportHouseInfoController", "Post");
            var ret = new BaseResultEntity();

            try
            {
                if (ImportHouse != null && ImportHouse.HouseList != null)
                {
                    if (_projectBLL.GetModels(x => x.ID == ImportHouse.ProjectID) != null)
                    {
                        #region 创建楼盘
                        var _houseEstate = _houseEstateBLL.GetModels(x => x.Name == ImportHouse.HouseEstate && x.ProjectID == ImportHouse.ProjectID);
                        if (_houseEstate == null || _houseEstate.Count() == 0)
                        {
                            _houseEstateBLL.Add(new HouseEstate()
                            {
                                ProjectID = ImportHouse.ProjectID, Name = ImportHouse.HouseEstate, CreateTime = DateTime.Now, LastUpdate = DateTime.Now
                            });
                        }
                        #endregion

                        #region 创建房源分组
                        var           groupList    = ImportHouse.HouseList.GroupBy(x => x.Group).ToList();
                        var           _existGroup  = _houseGroupBLL.GetModels(x => x.ProjectID == ImportHouse.ProjectID);
                        List <string> addGroupList = new List <string>();
                        foreach (var group in groupList)
                        {
                            if (!_existGroup.Any(x => x.Name == group.Key))
                            {
                                if (!addGroupList.Any(x => x == group.Key))
                                {
                                    addGroupList.Add(group.Key);
                                }
                            }
                        }
                        var _hsList = new List <HouseGroup>();
                        foreach (string a in addGroupList)
                        {
                            HouseGroup _hs = new HouseGroup()
                            {
                                ProjectID  = ImportHouse.ProjectID,
                                Name       = a,
                                CreateTime = DateTime.Now,
                                LastUpdate = DateTime.Now
                            };
                            _hsList.Add(_hs);
                        }
                        _houseGroupBLL.AddRange(_hsList);
                        #endregion

                        #region 创建户型
                        var           roomTypeGroupList = ImportHouse.HouseList.GroupBy(x => x.RoomType).ToList();
                        var           _existRoomType    = _roomTypeBLL.GetModels(x => 1 == 1).ToList();
                        List <string> addRoomTypeList   = new List <string>();
                        foreach (var group in roomTypeGroupList)
                        {
                            if (!_existRoomType.Any(x => x.Name == group.Key))
                            {
                                if (!addRoomTypeList.Any(x => x == group.Key))
                                {
                                    addRoomTypeList.Add(group.Key);
                                }
                            }
                        }
                        var _rtList = new List <RoomType>();
                        foreach (string a in addRoomTypeList)
                        {
                            RoomType _rt = new RoomType()
                            {
                                Name       = a,
                                CreateTime = DateTime.Now,
                                LastUpdate = DateTime.Now
                            };
                            _rtList.Add(_rt);
                        }
                        _roomTypeBLL.AddRange(_rtList);
                        #endregion

                        #region 创建房源
                        var _houseGroup    = _houseGroupBLL.GetModels(x => x.ProjectID == ImportHouse.ProjectID);
                        var _roomTypeGroup = _roomTypeBLL.GetModels(x => 1 == 1);
                        var _existhouse    = _houseBLL.GetModels(x => x.ProjectID == ImportHouse.ProjectID);
                        int _houseEstateID = _houseEstateBLL.GetModels(x => x.ProjectID == ImportHouse.ProjectID).FirstOrDefault().ID;

                        List <House> addHouseList = new List <House>();
                        foreach (var house in ImportHouse.HouseList)
                        {
                            if (_existhouse.Any(x => x.SerialNumber == house.SerialNumber))  //去重
                            {
                                continue;
                            }
                            else
                            {
                                int _groupID    = _houseGroup.FirstOrDefault(x => x.Name == house.Group).ID;
                                int _roomTypeID = _roomTypeGroup.FirstOrDefault(x => x.Name == house.RoomType).ID;

                                House _house = new House()
                                {
                                    ProjectID           = ImportHouse.ProjectID,
                                    SerialNumber        = house.SerialNumber,
                                    GroupID             = _groupID,
                                    Block               = house.Block == null ? "" : house.Block,
                                    Building            = house.Building,
                                    Unit                = house.Unit,
                                    RoomNumber          = house.RoomNumber == null ? "" : house.RoomNumber,
                                    RoomTypeID          = _roomTypeID,
                                    Toward              = house.Toward == null ? "" : house.Toward,
                                    RoomTypeCode        = house.RoomType,
                                    EstimateBuiltUpArea = house.EstimateBuiltUpArea,
                                    EstimateLivingArea  = house.EstimateLivingArea,
                                    AreaUnitPrice       = house.AreaUnitPrice,
                                    TotalPrice          = house.TotalPrice,
                                    CreateTime          = DateTime.Now,
                                    LastUpdate          = DateTime.Now,
                                    HouseEstateID       = _houseEstateID
                                };
                                addHouseList.Add(_house);
                            }
                        }
                        _houseBLL.AddRange(addHouseList);
                        #endregion
                    }
                    else
                    {
                        ret.Code   = 302;
                        ret.ErrMsg = "导入的房源信息所属项目不存在!";
                    }
                }
                else
                {
                    ret.Code   = 301;
                    ret.ErrMsg = "导入的房源信息不允许为空!";
                }
            }
            catch (Exception ex)
            {
                Logger.LogException("导入房源信息时发生异常!", "ImportHouseInfoController", "Post", ex);
                ret.Code   = 999;
                ret.ErrMsg = ex.Message;
            }
            return(ret);
        }
Ejemplo n.º 48
0
 public bool IsLandlord(Mobile m)
 {
     return(House != null && House.IsOwner(m));
 }
Ejemplo n.º 49
0
 public HousePage(House house)
 {
     InitializeComponent();
     BindingContext = new HouseViewModel(house);
 }
Ejemplo n.º 50
0
 public async Task <bool> Update(House house)
 {
     return(await repository.UpdateHouseAsync(house));
 }
Ejemplo n.º 51
0
 public void SpawnNewHouse(House housePrefab)
 {
     currentHouse = Instantiate <House>(housePrefab, spawnTarget.transform.position, Quaternion.identity, null);
 }
Ejemplo n.º 52
0
        public void EIT_StringId_Property_Id_Default()
        {
            var entity = new House();

            Assert.IsTrue(entity.Id == string.Empty);
        }
Ejemplo n.º 53
0
 /// <summary>
 /// Resets this instance. Ie, always work with  a new Instance
 /// This is used as a 'defensive' strategy to always have a new Instance.
 /// </summary>
 public void Reset()
 {
     House = new House();
 }
Ejemplo n.º 54
0
 public HouseUpdateResponseViewModel(House house)
 {
     this.FamilyName = house.FamilyName;
     this.Address    = house.Address;
     this.HasChimney = house.HasChimney;
 }
Ejemplo n.º 55
0
 public Team()
 {
     worker     = new Worker();
     teamLeader = new TeamLeader();
     house      = new House();
 }
Ejemplo n.º 56
0
        static void Proxy()
        {
            var A = new House(100, 25, 4);
            var B = new House(102, 16, 1);
            var C = new House(104, 34, 5);
            var D = new House(106, 20, 3);
            var E = new House(108, 9, 2);
            var F = new House(109, 25, 4);
            var G = new Square("G", 16, 2, 5);
            var H = new Square("H", 16, 2, 5);
            var I = new Square("I", 16, 2, 5);
            var J = new Square("J", 36, 5, 4);

            var street = new Street(110, 64, 25);

            A.Street = street;
            B.Street = street;
            C.Street = street;
            D.Street = street;
            E.Street = street;
            F.Street = street;
            G.Street = street;
            H.Street = street;
            I.Street = street;
            J.Street = street;

            G.Builder = new mixedBuilder();
            H.Builder = new FavorableBuilder();
            I.Builder = new UnfavorableBuilder();

            // WHATSAPP
            WhatsAppMessage whatsAppList = null;

            whatsAppList = new WhatsAppMessage(new FireReport(G), whatsAppList);
            whatsAppList = new WhatsAppMessage(new FireReport(H), whatsAppList);
            whatsAppList = new WhatsAppMessage(new FireReport(I), whatsAppList);

            // HEART ATTACK - 2
            var passerbyReport = new HearthAttackReport();

            passerbyReport.Pedestrian = new Passerby();
            whatsAppList = new WhatsAppMessage(passerbyReport, whatsAppList);

            var foreignPasserbyReport = new HearthAttackReport();
            var passerbyAddapter      = new ForeignPasserbyAdapter(new ForeignPasserby(pc: 0.20, pb: 0.30, phr: 0.50));

            foreignPasserbyReport.Pedestrian = passerbyAddapter;
            whatsAppList = new WhatsAppMessage(foreignPasserbyReport, whatsAppList);

            // ROBBERY - 3
            var robbertyReport1 = new RobberyReport();

            robbertyReport1.Place = A;
            whatsAppList          = new WhatsAppMessage(robbertyReport1, whatsAppList);

            var robbertyReport2 = new RobberyReport();

            robbertyReport2.Place = B;
            whatsAppList          = new WhatsAppMessage(robbertyReport2, whatsAppList);

            var robbertyReport3 = new RobberyReport();

            robbertyReport3.Place = J;
            whatsAppList          = new WhatsAppMessage(robbertyReport3, whatsAppList);

            // BURNT LAMPS - 5
            var burntReport1 = new BurntLampReport();

            burntReport1.Place = street;
            whatsAppList       = new WhatsAppMessage(burntReport1, whatsAppList);

            var burntReport2 = new BurntLampReport();

            burntReport2.Place = street;
            whatsAppList       = new WhatsAppMessage(burntReport2, whatsAppList);

            var burntReport3 = new BurntLampReport();

            burntReport3.Place = street;
            whatsAppList       = new WhatsAppMessage(burntReport3, whatsAppList);

            var burntReport4 = new BurntLampReport();

            burntReport4.Place = street;
            whatsAppList       = new WhatsAppMessage(burntReport4, whatsAppList);

            var burntReport5 = new BurntLampReport();

            burntReport5.Place = street;
            whatsAppList       = new WhatsAppMessage(burntReport5, whatsAppList);

            var complaintsByWhatsapp = new ComplaintByWhatsapp(whatsAppList);

            // TEST
            CompliantHandler handler = new CopProxy().CreateHeroe();

            handler = new FiremanProxy().CreateHeroe(handler);
            handler = new ElectricianProxy().CreateHeroe(handler);
            handler = new MedicProxy().CreateHeroe(handler);

            var operator911 = new Operator911(handler);

            operator911.AttendReport(complaintsByWhatsapp);
        }
Ejemplo n.º 57
0
        static void Iterator()
        {
            var A = new House(100, 25, 4);
            var B = new House(102, 16, 1);
            var C = new House(104, 34, 5);
            var D = new House(106, 20, 3);
            var E = new House(108, 9, 2);
            var F = new House(109, 25, 4);
            var G = new Square("G", 16, 2, 5);
            var H = new Square("H", 16, 2, 5);
            var I = new Square("I", 16, 2, 5);
            var J = new Square("J", 36, 5, 4);

            var street = new Street(110, 64, 25);

            A.Street = street;
            B.Street = street;
            C.Street = street;
            D.Street = street;
            E.Street = street;
            F.Street = street;
            G.Street = street;
            H.Street = street;
            I.Street = street;
            J.Street = street;

            G.Builder = new mixedBuilder();
            H.Builder = new FavorableBuilder();
            I.Builder = new UnfavorableBuilder();

            // BOARD
            var complaintsByBoard = new ComplaintByBoard();

            A.AddObserver(complaintsByBoard);
            B.AddObserver(complaintsByBoard);
            C.AddObserver(complaintsByBoard);
            D.AddObserver(complaintsByBoard);
            E.AddObserver(complaintsByBoard);
            F.AddObserver(complaintsByBoard);

            // WHATSAPP
            WhatsAppMessage whatsAppList = null;

            whatsAppList = new WhatsAppMessage(new FireReport(G), whatsAppList);
            whatsAppList = new WhatsAppMessage(new FireReport(H), whatsAppList);
            whatsAppList = new WhatsAppMessage(new FireReport(I), whatsAppList);
            var complaintsByWhatsapp = new ComplaintByWhatsapp(whatsAppList);

            // DESK
            var complaintsByDesk = new ComplaintByDesk(J);

            B.Spark();
            F.Spark();

            // TEST
            var fireman = new Firefighter();

            fireman.Vehicle = new FireTruck();
            fireman.Tool    = new WaterHose();
            var secretary = new FirefighterSecretary(fireman);

            secretary.AttendCompliant(complaintsByBoard);
            secretary.AttendCompliant(complaintsByDesk);
            Console.Clear();
            secretary.AttendCompliant(complaintsByWhatsapp);
        }
Ejemplo n.º 58
0
 public House Add(House house)
 {
     _dbContext.Home.Add(house);
     _dbContext.SaveChanges();
     return(house);
 }
Ejemplo n.º 59
0
        public static bool UpgradeHouse(House house, InventoryItem deed)
        {
            int newModel = 0;

            switch (deed.Id_nb)
            {
            case "housing_alb_cottage_deed":
                newModel = 1;
                break;

            case "housing_alb_house_deed":
                newModel = 2;
                break;

            case "housing_alb_villa_deed":
                newModel = 3;
                break;

            case "housing_alb_mansion_deed":
                newModel = 4;
                break;

            case "housing_mid_cottage_deed":
                newModel = 5;
                break;

            case "housing_mid_house_deed":
                newModel = 6;
                break;

            case "housing_mid_villa_deed":
                newModel = 7;
                break;

            case "housing_mid_mansion_deed":
                newModel = 8;
                break;

            case "housing_hib_cottage_deed":
                newModel = 9;
                break;

            case "housing_hib_house_deed":
                newModel = 10;
                break;

            case "housing_hib_villa_deed":
                newModel = 11;
                break;

            case "housing_hib_mansion_deed":
                newModel = 12;
                break;
            }

            if (newModel == 0)
            {
                return(false);
            }

            // remove all players from the home before we upgrade it
            foreach (GamePlayer player in house.GetAllPlayersInHouse())
            {
                player.LeaveHouse();
            }

            // if there is a consignment merchant, we have to re-initialize since we changed the house
            var merchant = DOLDB <HouseConsignmentMerchant> .SelectObject(DB.Column("HouseNumber").IsEqualTo(house.HouseNumber));

            long oldMerchantMoney = 0;

            if (merchant != null)
            {
                oldMerchantMoney = merchant.Money;
            }

            RemoveHouseItems(house);

            // change the model of the house
            house.Model = newModel;

            // re-add the merchant if there was one
            if (merchant != null)
            {
                house.AddConsignment(oldMerchantMoney);
            }

            // save the house, and broadcast an update
            house.SaveIntoDatabase();
            house.SendUpdate();

            return(true);
        }
Ejemplo n.º 60
0
        protected Teleport GetTeleportLocation(GamePlayer player, string text, eRealm realm)
        {
            // Battlegrounds are specials, as the teleport location depends on
            // the level of the player, so let's deal with that first.
            if (text.ToLower() == "battlegrounds")
            {
                if (!ServerProperties.Properties.BG_ZONES_OPENED && player.Client.Account.PrivLevel == (uint)ePrivLevel.Player)
                {
                    SayTo(player, ServerProperties.Properties.BG_ZONES_CLOSED_MESSAGE);
                }
                else
                {
                    AbstractGameKeep portalKeep = GameServer.KeepManager.GetBGPK(player);
                    if (portalKeep != null)
                    {
                        Teleport teleport = new Teleport();
                        teleport.TeleportID = "battlegrounds";
                        teleport.Realm      = (byte)portalKeep.Realm;
                        teleport.RegionID   = portalKeep.Region;
                        teleport.X          = portalKeep.X;
                        teleport.Y          = portalKeep.Y;
                        teleport.Z          = portalKeep.Z;
                        teleport.Heading    = 0;
                        return(teleport);
                    }
                    else
                    {
                        if (player.Client.Account.PrivLevel > (uint)ePrivLevel.Player)
                        {
                            player.Out.SendMessage("No portal keep found.", eChatType.CT_Skill, eChatLoc.CL_SystemWindow);
                        }
                        return(null);
                    }
                }
            }

            // Another special case is personal house, as there is no location
            // that will work for every player.
            if (text.ToLower() == "personal")
            {
                House house = HouseMgr.GetHouseByPlayer(player);

                if (house == null)
                {
                    text = "entrance";                      // Fall through, port to housing entrance.
                }
                else
                {
                    IGameLocation location = house.OutdoorJumpPoint;
                    Teleport      teleport = new Teleport();
                    teleport.TeleportID = "personal";
                    teleport.Realm      = (int)player.Realm;
                    teleport.RegionID   = location.RegionID;
                    teleport.X          = location.X;
                    teleport.Y          = location.Y;
                    teleport.Z          = location.Z;
                    teleport.Heading    = location.Heading;
                    return(teleport);
                }
            }

            // Yet another special case the port to the 'hearth' what means
            // that the player will be ported to the defined house bindstone
            if (text.ToLower() == "hearth")
            {
                // Check if player has set a house bind
                if (!(player.BindHouseRegion > 0))
                {
                    SayTo(player, "Sorry, you haven't set any house bind point yet.");
                    return(null);
                }

                // Check if the house at the player's house bind location still exists
                ArrayList houses = (ArrayList)HouseMgr.GetHousesCloseToSpot((ushort)player.
                                                                            BindHouseRegion, player.BindHouseXpos, player.
                                                                            BindHouseYpos, 700);
                if (houses.Count == 0)
                {
                    SayTo(player, "I'm afraid I can't teleport you to your hearth since the house at your " +
                          "house bind location has been torn down.");
                    return(null);
                }

                // Check if the house at the player's house bind location contains a bind stone
                House targetHouse = (House)houses[0];
                IDictionary <uint, DBHouseHookpointItem> hookpointItems = targetHouse.HousepointItems;
                Boolean hasBindstone = false;

                foreach (KeyValuePair <uint, DBHouseHookpointItem> targetHouseItem in hookpointItems)
                {
                    if (((GameObject)targetHouseItem.Value.GameObject).GetName(0, false).ToLower().EndsWith("bindstone"))
                    {
                        hasBindstone = true;
                        break;
                    }
                }

                if (!hasBindstone)
                {
                    SayTo(player, "I'm sorry to tell that the bindstone of your current house bind location " +
                          "has been removed, so I'm not able to teleport you there.");
                    return(null);
                }

                // Check if the player has the permission to bind at the house bind stone
                if (!targetHouse.CanBindInHouse(player))
                {
                    SayTo(player, "You're no longer allowed to bind at the house bindstone you've previously " +
                          "chosen, hence I'm not allowed to teleport you there.");
                    return(null);
                }

                Teleport teleport = new Teleport();
                teleport.TeleportID = "hearth";
                teleport.Realm      = (int)player.Realm;
                teleport.RegionID   = player.BindHouseRegion;
                teleport.X          = player.BindHouseXpos;
                teleport.Y          = player.BindHouseYpos;
                teleport.Z          = player.BindHouseZpos;
                teleport.Heading    = player.BindHouseHeading;
                return(teleport);
            }

            if (text.ToLower() == "guild")
            {
                House house = HouseMgr.GetGuildHouseByPlayer(player);

                if (house == null)
                {
                    return(null);                     // no teleport when guild house not found
                }
                else
                {
                    IGameLocation location = house.OutdoorJumpPoint;
                    Teleport      teleport = new Teleport();
                    teleport.TeleportID = "guild house";
                    teleport.Realm      = (int)player.Realm;
                    teleport.RegionID   = location.RegionID;
                    teleport.X          = location.X;
                    teleport.Y          = location.Y;
                    teleport.Z          = location.Z;
                    teleport.Heading    = location.Heading;
                    return(teleport);
                }
            }

            // Find the teleport location in the database.
            return(WorldMgr.GetTeleportLocation(realm, String.Format(":{0}", text)));
        }