Exemple #1
0
        public House(uint slumlord_id, Player player)
        {
            Player = player;

            var house = new HouseData();

            var instance = DatabaseManager.World.GetLandblockInstanceByGuid(slumlord_id);

            if (instance == null)
            {
                return;
            }

            house.Position = new Position(instance.ObjCellId, instance.OriginX, instance.OriginY, instance.OriginZ, instance.AnglesX, instance.AnglesY, instance.AnglesZ, instance.AnglesW);
            house.Type     = HouseType.Cottage;

            var SlumLord = (SlumLord)WorldObjectFactory.CreateNewWorldObject(instance.WeenieClassId);

            if (SlumLord == null)
            {
                Console.WriteLine($"House constructor({slumlord_id:X8}): couldn't build slumlord");
                return;
            }

            house.SetBuyItems(SlumLord.GetBuyItems());
            house.SetRentItems(SlumLord.GetRentItems());

            house.BuyTime  = (uint)(player.HousePurchaseTimestamp ?? 0);
            house.RentTime = GetRentTimestamp();

            HouseData = house;
        }