Inheritance: MonoBehaviour
Beispiel #1
1
 public WalksOnFurni(RoomItem item, Room room)
 {
     Item = item;
     Room = room;
     ToWork = new Queue();
     Items = new List<RoomItem>();
 }
Beispiel #2
1
 public override void Update(Room room, Player player)
 {
     Vector2 offset = player.position - position;
     Vector2 range = Main.instance.Size();
     if (Math.Abs(offset.X) > range.X / 2f || Math.Abs(offset.Y) > range.Y / 2f)
     {
         shootTimer = 0;
     }
     else
     {
         shootTimer++;
         if (shootTimer >= maxShootTimer)
         {
             Vector2 direction = offset;
             if (direction != Vector2.Zero)
             {
                 direction.Normalize();
             }
             direction *= shootSpeed;
             PositionalBullet bullet = new PositionalBullet(position, direction, 10f, bulletTexture, bulletTime);
             room.bullets.Add(bullet);
             shootTimer = 0;
         }
     }
 }
Beispiel #3
0
        public static void Main(string[] args)
        {
            var trung = new Student() {
                Name = "Trung",
                ID = 5
            };

            var c1203l = new Class() {
                ID = 1,
                Name = "C1203L",
                Teacher = "NhatNK"
            };

            var lab1 = new Room() {
                Name = "Lab1"
            };

            var late = new TimeSlot() {
                StartTime = DateTime.MinValue.AddDays(4).AddHours(17).AddMinutes(30),
                EndTime = DateTime.MinValue.AddDays(4).AddHours(19).AddMinutes(30)
            };

            var m = new Manager();
            m.Students.Add(trung);
            m.Classes.Add(c1203l);
            m.TimeSlots.Add(late);
            m.Rooms.Add(lab1);
            m.RegisterStudentWithClass(trung, c1203l);
            m.RegisterClassRoomTimeSlot(c1203l, lab1, late);

            foreach (var a in m.Allocation)
            {
                Console.WriteLine("{0} {1} {2}", a.Item1.Name, a.Item2.Name, a.Item3.StartTime.DayOfWeek);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RoomReference"/> class.
 /// </summary>
 /// <param name="roomCache">
 /// The room cache.
 /// </param>
 /// <param name="room">
 /// The room.
 /// </param>
 public RoomReference(RoomCacheBase roomCache, Room room, PeerBase ownerPeer)
 {
     this.roomCache = roomCache;
     this.id = Guid.NewGuid();
     this.Room = room;
     this.ownerPeer = ownerPeer;
 }
Beispiel #5
0
    public static void BuildLevel()
    {
        Room room00 = new Room("room 00", "It's clearly a room");

        Room room01 = new Room("room 01", "It's clearly a room");
        Room room02 = new Room("room 02", "It's clearly a room");
        Room room10 = new Room("room 10", "It's clearly a room");
        Room room11 = new Room("room 11", "It's clearly a room");
        Room room12 = new Room("room 12", "It's clearly a room");
        //Room room20 = new Room("room 20", "room description");
        //Room room21 = new Room("room 21", "room description");
        Room room22 = new Room("room 22", "It's clearly a room");

        Item key = new Item("Key", "A brass object used to unlock a specific lock. Commonly known as a 'Key'", room11, null, Action.OpenDoor, room11);
        room11.AddItem(key);

        Door door = new Door("Door", "A wooden board with hinges on one side, usually used to block a passage way. Commonly known as a 'Door'", room12, room22, key, null, Action.None);
        door.locked = true;
        room12.doorSouth = door;
        room12.AddObject(door);
        room22.doorNorth = door;
        room22.AddObject(door);

        dungeon[0, 0] = room00;
        dungeon[0, 1] = room01;
        dungeon[0, 2] = room02;
        dungeon[1, 0] = room10;
        dungeon[1, 1] = room11;
        dungeon[1, 2] = room12;
        //dungeon[2, 0] = room20;
        //dungeon[2, 1] = room21;
        dungeon[2, 2] = room22;

        startingRoom = room00;
    }
Beispiel #6
0
        public Stu(Point position, Room.Room room)
            : base(room)
        {
            Stats = new CharacterStats
            {
                MinimumDamage = 10,
                MaximumDamage = 15,
                BaseHealth = 100,
                DamageReduction = 0.04,
                Dexterity = 15
            };

            Position = position;

            /*Drinks.Add(new OrangeJuice());
            Drinks.Add(new RedBull());
            Drinks.Add(new Coffee());
            FoodItems.Add(new Pizza());
            FoodItems.Add(new Burger());
            FoodItems.Add(new Taco());*/

            ResourceImage = "Resources/stu.jpg";
            Name = "Stu";

            ResetHealth();
        }
    public void BuildLevel(Board board)
    {
        var children = new List<GameObject>();
        foreach (Transform child in transform)
            children.Add(child.gameObject);
        children.ForEach(child => Destroy(child));

        originalMatrix = board.Grid;
        matrix = PrepareMatrix(originalMatrix);
        int n = board.NoRooms;
        floors = new Floor[matrix.GetLength(0)-2,matrix.GetLength(1)-2];
        walls = new Wall[matrix.GetLength(0)-1, matrix.GetLength(1)-1];
        Rooms = new Room[n];
        graph = new Graph();
        for (int i = 0; i < n; ++i)
        {
            Rooms[i] = new Room(i+1, DefaultFloorMaterial);
        }
        RoomPropertiesPanel.InitializePanel(n);
        Vector3 shift = new Vector3(((matrix.GetLength(1) - 2) * unit) / 2, 0f, ((matrix.GetLength(0) - 2) * -unit) / 2);
        this.transform.position = shift;
        SpawnWalls();
        SpawnFloors();
        SpawnDoors();
        foreach (var room in Rooms)
        {
            room.SetRoomMaterial();
        }
        isSaved = false;
    }
Beispiel #8
0
        public RoomImage(Room room, Wall wall, Point source)
        {
            if(!room.Walls.Contains(wall) || !room.Sources.Contains(source)) throw new ArgumentException("Room elements are non-existent");
            ImageWalls = new Wall[room.Walls.Count];
            ImageWalls[0] = wall;

            int i = 1;
            foreach (Wall roomWall in room.Walls)
            {
                if (roomWall == wall) continue;
                Point startVector = Geometry.ParallelProjection(wall, roomWall.Start,true);
                startVector.X -= roomWall.Start.X;
                startVector.Y -= roomWall.Start.Y;

                Point endVector = Geometry.ParallelProjection(wall, roomWall.End, true);
                endVector.X -= roomWall.End.X;
                endVector.Y -= roomWall.End.Y;

                Point newStart = new Point(roomWall.Start.X+2*startVector.X,roomWall.Start.Y+2*startVector.Y);
                Point newEnd = new Point(roomWall.End.X + 2 * endVector.X, roomWall.End.Y + 2 * endVector.Y);
                ImageWalls[i] = new Wall(newStart,newEnd,roomWall.WallMaterial);
                i++;
            }
            Point sourceVector = Geometry.ParallelProjection(wall, source, true);
            sourceVector.X -= source.X;
            sourceVector.Y -= source.Y;
            Source = new Point(source.X+2*sourceVector.X,source.Y+2*sourceVector.Y);
        }
Beispiel #9
0
        public override void Update(State s, Room room)
        {
            base.Update(s, room);
            Vector2 direction = new Vector2((float)((TargetX - x) * (DiverGame.Random.NextDouble() * 0.2f + 0.8f)),
                                            (float)((TargetY - y) * (DiverGame.Random.NextDouble() * 0.2f + 0.8f)));

            if(direction.LengthSquared() > 0)
                direction.Normalize();

            speedX += direction.X * 0.007f;
            speedY += direction.Y * 0.007f;
            speedX *= 0.999f;
            speedY *= 0.999f;

            float speed = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
            animationGridFrame += speed * 0.25f + 0.03f;

            x += speedX;
            y += speedY;
            X = (int)x;
            Y = (int)y;

            float desiredRot = (float)Math.Atan2(speedX, -speedY) - (float)Math.PI / 2f;
            float rotDiff = desiredRot - rotation;
            while (rotDiff > MathHelper.Pi) rotDiff -= MathHelper.TwoPi;
            while (rotDiff < -MathHelper.Pi) rotDiff += MathHelper.TwoPi;
            rotation += rotDiff * 0.1f;
        }
Beispiel #10
0
 public Session(Slot slot, Room room, Speaker speaker, string title)
 {
     Slot = slot;
     Room = room;
     Speaker = speaker;
     Title = title;
 }
        public bool addRoom(Room room)
        {
            try
            {
                int param = 3;

                string[] name = new string[param];
                object[] value = new object[param];

                name[0] = "@name"; value[0] = room.Name;
                name[1] = "@statusid"; value[1] = room.StatusID;
                name[2] = "@roomtypeid"; value[2] = room.RoomType;

                int result = this.Update("Room_Insert", name, value, param);
                if (result != 0)
                {
                    return true;
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("Message = {1}", ex.Message);
            }

            return false;
        }
Beispiel #12
0
        public Room AddRoom(Enum id)
        {
            var room = new Room(this, id.ToString());
            _rooms.Add(id, room);

            return room;
        }
        internal bool HasAllRequiredFurnis(Room room)
        {
            if (room == null)
                return false;

            return RequiredFurnis.All(furni => room.GetRoomItemHandler().HasFurniByItemName(furni));
        }
Beispiel #14
0
    private void LinkRoom(Room StartRoom, Room DestinationRoom, string Direction)
    {
        if (StartRoom == null) return;

        switch (Direction.ToLower())
        {
            case "west":
                StartRoom.West = DestinationRoom;
                if (DestinationRoom.East == null) { DestinationRoom.East = StartRoom; }
                break;
            case "east":
                StartRoom.East = DestinationRoom;
                if (DestinationRoom.West == null) { DestinationRoom.West = StartRoom; }
                break;
            case "north":
                StartRoom.North = DestinationRoom;
                if (DestinationRoom.South == null) { DestinationRoom.South = StartRoom; }
                break;
            case "south":
                StartRoom.West = DestinationRoom;
                if (DestinationRoom.North == null) { DestinationRoom.North = StartRoom; }
                break;
            default:
                if (StartRoom.AdditionalLink[Direction] == null)
                {
                    StartRoom.AdditionalLink[Direction] = DestinationRoom;
                }
                break;
        }
    }
Beispiel #15
0
 public UserIsNotWearingEffect(RoomItem item, Room room)
 {
     Item = item;
     Room = room;
     Items = new List<RoomItem>();
     OtherString = "0";
 }
Beispiel #16
0
 public UserIsWearingBadge(RoomItem item, Room room)
 {
     Item = item;
     Room = room;
     Items = new List<RoomItem>();
     OtherString = string.Empty;
 }
Beispiel #17
0
 public Inn2(Room prev)
     : base("an inn", "You can hear rowdy laughter and unintelligible speach emanating from inside.", "inn",
         "inside", "inside inn")
 {
     Items.Add(new PlateAgain());
     Exits.Add(prev);
 }
Beispiel #18
0
    public void GeneratePerimeter(Room room)
    {
        foreach (CellLocation location in PossiblePerimeterLocations (room)) {

            AddPerimeter (location);
        }
    }
Beispiel #19
0
 public void Execute(GameClient Session, Room Room, string[] Params)
 {
     if (Session != null)
     {
         if (Room != null)
         {
             if (Params.Length != 1)
             {
                 Session.SendWhisper("Invalid command! :eventalert", 0);
             }
             else if (!PlusEnvironment.Event)
             {
                 PlusEnvironment.GetGame().GetClientManager().SendMessage(new BroadcastMessageAlertComposer(":follow " + Session.GetHabbo().Username + " for events! win prizes!\r\n- " + Session.GetHabbo().Username, ""), "");
                 PlusEnvironment.lastEvent = DateTime.Now;
                 PlusEnvironment.Event = true;
             }
             else
             {
                 TimeSpan timeSpan = DateTime.Now - PlusEnvironment.lastEvent;
                 if (timeSpan.Hours >= 1)
                 {
                     PlusEnvironment.GetGame().GetClientManager().SendMessage(new BroadcastMessageAlertComposer(":follow " + Session.GetHabbo().Username + " for events! win prizes!\r\n- " + Session.GetHabbo().Username, ""), "");
                     PlusEnvironment.lastEvent = DateTime.Now;
                 }
                 else
                 {
                     int num = checked(60 - timeSpan.Minutes);
                     Session.SendWhisper("Event Cooldown! " + num + " minutes left until another event can be hosted.", 0);
                 }
             }
         }
     }
 }
Beispiel #20
0
	private void AddRoom(Room newRoom) {
		CreateRoom (newRoom);
		var roomCount = rooms.Count;
		if (roomCount > 0) {
			AddTunnel (newRoom);
		}
		lastX = newRoom.GetCenterX ();
		lastY = newRoom.GetCenterY ();
		if (roomCount > 0) {
			tiles [lastX - 1, lastY] = Map.Treasure;

			bool coin = Random.Range (0.0F, 1.0F) > 0.75F;
			if (coin) {
				tiles [lastX + 1, lastY] = Map.Enemy;
			} else {
				tiles [lastX + 1, lastY] = Map.Zombie;
			}
			if (this.ExitInd == 0) {
				tiles [lastX + 2, lastY + 2] = Map.Exit;
				this.ExitInd--;
			} else {
				this.ExitInd--;
			}
		}
		rooms.Enqueue (newRoom);
	}
Beispiel #21
0
 public LessThanTimer(int timeout, Room room, RoomItem item)
 {
     this.timeout = timeout;
     this.room = room;
     this.isDisposed = false;
     this.item = item;
 }
Beispiel #22
0
 public void Dispose()
 {
     isDisposed = true;
     room = null;
     item = null;
     handler = null;
 }
Beispiel #23
0
 public WalksOffFurni(RoomItem Item, Room Room)
 {
     this.mItem = Item;
     this.mRoom = Room;
     this.mUsers = new Queue();
     this.mItems = new List<RoomItem>();
 }
Beispiel #24
0
 public SaysKeyword(RoomItem item, Room room)
 {
     Item = item;
     Room = room;
     OtherString = string.Empty;
     OtherBool = false;
 }
Beispiel #25
0
        private static void Distribute(IDictionary<int, Person> people, Room room, int maxIterations)
        {
            var index = 0;
            var peopleByNumberFriends = people.Values.OrderBy(x => x.NumberOfFriends).ToArray();
            var spotsByNumberNeighbours = room.OrderBy(x => x.Neighbours.Keys.Count).ToArray();

            foreach (var spot in spotsByNumberNeighbours) {
                spot.Person = peopleByNumberFriends[index++];
            }

            var iterations = 0;
            var changeMade = false;
            do {
                var awfulSpots = room.OrderBy(x => x.Score).ToList();
                var spot1 = awfulSpots.First();
                foreach (var spot2 in awfulSpots.Skip(1)) {
                    var currentScore = spot1.Score + spot2.Score;
                    var p1 = spot1.Person;
                    var p2 = spot2.Person;
                    spot1.Person = p2;
                    spot2.Person = p1;

                    if (spot1.Score + spot2.Score > currentScore) {
                        changeMade = true;
                        break;
                    }

                    // restore
                    spot1.Person = p1;
                    spot2.Person = p2;
                }
                iterations++;
            } while (changeMade && iterations < maxIterations);
        }
Beispiel #26
0
 //private List<InteractionType> mBanned;
 public JoinTeam(RoomItem item, Room room)
 {
     Item = item;
     Room = room;
     _mDelay = 0;
     //this.mBanned = new List<InteractionType>();
 }
Beispiel #27
0
 public Soccer(Room room)
 {
     this._room = room;
     this.gates = new Item[4];
     this._balls = new ConcurrentDictionary<int, Item>();
     this._gameStarted = false;
 }
        public override Room[,] GenerateRooms(int maxRooms)
        {
            Directions[] directions = (Directions[])Enum.GetValues(typeof(Directions));
            List<Room> rooms = new List<Room>();
            rooms.Add(new Room(new Point(0, 0)));

            while (rooms.Count < maxRooms)
            {
                Room targetRoom = rooms[Randomizer.GetRandomNumber(rooms.Count)];
                Directions direction = Randomizer.GetRandomDirection();
                Exit targetExit = targetRoom.GetExit(direction);

                if (targetExit != null)
                    continue;

                targetExit = new Exit(direction);
                targetRoom.AddExit(direction);
                Room neighbor = GetRoomAtPoint(targetRoom.GetNeighborCoordinates(direction), rooms);
                Directions neighborDirection = ReverseDirection(direction);

                if (neighbor != null)
                    neighbor.AddExit(neighborDirection);
                else
                {
                    Room newRoom = new Room(targetRoom.GetNeighborCoordinates(direction));
                    newRoom.AddExit(neighborDirection);
                    rooms.Add(newRoom);
                }
            }
            Room[,] roomArray = ConvertListToMap(MarkSpecialRooms<Room>(rooms));

            return roomArray;
        }
Beispiel #29
0
    public void OnJoinRoom(BaseEvent evt)
    {
        Room room = (Room)evt.Params["room"];
        currentActiveRoom = room;

        Debug.Log("onjoinroom = " + currentActiveRoom.Name);

        if (room.Name == "The Lobby")
            Application.LoadLevel(room.Name);
        else if (room.IsGame)
        {
            //Debug.Log("is game!!!!");
            //store my own color on server as user data
            List<UserVariable> uData = new List<UserVariable>();
            uData.Add(new SFSUserVariable("playerID", GameValues.playerID));
            smartFox.Send(new SetUserVariablesRequest(uData));
            Application.LoadLevel("testScene");
        }
        else
        {
            Debug.Log("GameLobby- OnJoinRoom: joined " + room.Name);
            Application.LoadLevel("Game Lobby");
            Debug.Log("loading Game Lobby");
            //smartFox.Send(new SpectatorToPlayerRequest());
        }
    }
Beispiel #30
0
        private Hashtable roomMatrix; //Coord | List<IWiredCondition>

        #endregion Fields

        #region Constructors

        public ConditionHandler(Room room)
        {
            this.room = room;
            this.roomMatrix = new Hashtable();
            this.addQueue = new Queue();
            this.removeQueue = new Queue();
        }
Beispiel #31
0
 /// <summary>
 /// Returns room Start Time.
 /// </summary>
 /// <param name="room"></param>
 /// <returns></returns>
 public static double GetStartTime(this Room room)
 {
     return room.HasProperty(TIME_START) ? room.GetProperty<double>(TIME_START) : -1;
 }
Beispiel #32
0
        internal static bool ExecuteAttackBot(GameClient User1, RoomUser RoomUser2, Pet Pet, RoomBot BotData)
        {
            Room     Room      = User1.GetHabbo().CurrentRoom;
            RoomUser RoomUser1 = User1.GetHabbo().GetRoomUser();

            Vector2D Pos1      = new Vector2D(RoomUser1.X, RoomUser1.Y);
            Vector2D Pos2      = new Vector2D(RoomUser2.X, RoomUser2.Y);
            bool     canattack = false;

            #region Cooldown
            if (User1.GetRoleplay().CoolDown > 0)
            {
                User1.SendWhisper("Cooling down [" + User1.GetRoleplay().CoolDown + "/3]");
                return(false);
            }
            #endregion

            #region Distance
            if (RoleplayManager.WithinAttackDistance(RoomUser1, RoomUser2))
            {
                canattack = true;
            }
            else if (RoleplayManager.Distance(Pos1, Pos2) > 1 && RoleplayManager.Distance(Pos1, Pos2) <= 4)
            {
                User1.Shout("*Swings at " + BotData.Name + ", but misses*");
                return(false);
            }
            else if (RoleplayManager.Distance(Pos1, Pos2) >= 5)
            {
                User1.SendWhisper("You are too far away!");
                return(false);
            }
            #endregion

            #region Status Conditions

            if (Room.RoomData.Description.Contains("NOHIT") && RoleplayManager.PurgeTime == false)
            {
                User1.SendWhisper("Sorry, but this is a no hitting zone!");
                User1.GetRoleplay().CoolDown = 3;
                return(false);
            }
            if (Room.RoomData.Description.Contains("SAFEZONE"))
            {
                User1.SendWhisper("Sorry, but this is a safezone!");
                User1.GetRoleplay().CoolDown = 3;
                return(false);
            }
            if (User1.GetRoleplay().Energy <= 0)
            {
                User1.SendWhisper("You do not have enough energy to do this!");
                return(false);
            }
            if (User1.GetRoleplay().Dead)
            {
                User1.SendWhisper("Cannot complete this action while you are dead!");
                User1.GetRoleplay().CoolDown = 3;
                return(false);
            }

            if (User1.GetRoleplay().Jailed)
            {
                User1.SendWhisper("Cannot complete this action while you are jailed!");
                User1.GetRoleplay().CoolDown = 3;
                return(false);
            }

            if (RoomUser1.Stunned)
            {
                User1.SendWhisper("Cannot complete this action while you are stunned!");
                User1.GetRoleplay().CoolDown = 3;
                return(false);
            }

            #endregion


            if (canattack)
            {
                GameClient Session = User1;

                int Damage = CombatManager.DamageCalculator(User1);

                BotData.cur_Health -= Damage;

                if (BotData.cur_Health <= 0)
                {
                    if (RoomUser2.BotData != null && RoomUser2.BotData._Boss)
                    {
                        Session.GetRoleplay().GiveMafiaWarPoints(MafiaWarManager.BossKillPoints);
                        User1.Shout("*Swings at " + BotData.Name + ", causing " + Damage + " damage and killing them and winning the Game! [+ " + MafiaWarManager.BossKillPoints + " Mafia Wars Pts]*");
                    }
                    else if (!RoomUser2.BotData._Boss)
                    {
                        Session.GetRoleplay().GiveMafiaWarPoints(MafiaWarManager.ThugKillPoints);
                        User1.Shout("*Swings at " + BotData.Name + ", causing " + Damage + " damage and killing them! [+ " + MafiaWarManager.ThugKillPoints + " Mafia Wars Pts]*");
                    }

                    RoomUser2.Chat(null, "*Passes out*", true, 1);
                    User1.GetHabbo().GetRoomUser().Attacker = null;
                    RoomUser2.BotAI._Victim = null;

                    if (RoomUser2.IsPet)
                    {
                        if (RoomUser2.FollowingOwner != null)
                        {
                            RoomUser2.FollowingOwner.GetClient().GetMessageHandler().PickUpPet(RoomUser2.FollowingOwner.GetClient(), RoomUser2.PetData.PetId, true);
                            return(true);
                        }
                        else
                        {
                            Room.GetRoomUserManager().RemoveBot(RoomUser2.VirtualId, true);
                        }
                    }
                    else
                    {
                        Room.GetRoomUserManager().RemoveBot(RoomUser2.VirtualId, true);
                    }

                    if (RoomUser2.BotData != null && RoomUser2.BotData._Boss)
                    {
                        Session.GetRoleplay().GiveMafiaWarPoints(MafiaWarManager.BossKillPoints);

                        if (RoomUser2.BotData._Team.TeamName == "Green")
                        {
                            Plus.GetGame().MafiaWars.TeamWon("Blue");
                        }
                        else
                        {
                            Plus.GetGame().MafiaWars.TeamWon("Green");
                        }
                    }
                }
                else
                {
                    User1.Shout("*Swings at " + BotData.Name + ", causing " + Damage + " damage*");
                    RoomUser2.Chat(null, "[" + BotData.cur_Health + "/" + BotData.max_Health + "]", true, 1);

                    if (User1.GetHabbo().GetRoomUser().Attacker != null)
                    {
                        User1.GetHabbo().GetRoomUser().Attacker = null;
                        RoomUser2.BotAI._Victim = User1.GetHabbo().GetRoomUser();
                    }

                    User1.GetRoleplay().LastHitBot = RoomUser2;
                }

                Session.GetRoleplay().CoolDown = 3;
            }

            return(true);
        }
        public void Setup()
        {
            this.hotelController       = new HotelController();
            this.bookingController     = new BookingController();
            this.customerController    = new CustomerController();
            this.serviceController     = new ServiceController();
            this.roomTypeController    = new RoomTypeController();
            this.roomController        = new RoomController();
            this.billingController     = new BillingEntityController();
            this.pricingListController = new PricingListController();

            this.hotel = new Hotel()
            {
                Name    = "Alex Hotel",
                Address = "Syntagma",
                TaxId   = "AH123456",
                Manager = "Alex",
                Phone   = "2101234567",
                Email   = "*****@*****.**"
            };
            this.hotel = this.hotelController.CreateOrUpdateEntity(this.hotel);

            this.roomType = new RoomType()
            {
                Code    = "TreeBed",
                View    = View.MountainView,
                BedType = BedType.ModernCot,
                Tv      = true,
                WiFi    = true,
                Sauna   = true
            };
            this.roomType = this.roomTypeController.CreateOrUpdateEntity(this.roomType);

            this.room = new Room()
            {
                HotelId    = this.hotel.Id,
                Code       = "Alex Hotel 123",
                RoomTypeId = this.roomType.Id
            };
            this.room = this.roomController.CreateOrUpdateEntity(this.room);

            this.service = new Service()
            {
                HotelId     = this.hotel.Id,
                Code        = "AHBF",
                Description = "Breakfast Alex Hotel"
            };
            this.service = this.serviceController.CreateOrUpdateEntity(this.service);

            this.servicePricingList = new PricingList()
            {
                BillableEntityId     = this.service.Id,
                TypeOfBillableEntity = TypeOfBillableEntity.Service,
                ValidFrom            = DateTime.Now,
                ValidTo = Convert.ToDateTime("31/01/2017"),
                VatPrc  = 13
            };
            this.servicePricingList = this.pricingListController.CreateOrUpdateEntity(this.servicePricingList);

            this.roomTypePricingList = new PricingList()
            {
                BillableEntityId     = this.roomType.Id,
                TypeOfBillableEntity = TypeOfBillableEntity.RoomType,
                ValidFrom            = DateTime.Now,
                ValidTo = Convert.ToDateTime("31/01/2017").Date,
                VatPrc  = 13
            };
            this.roomTypePricingList = this.pricingListController.CreateOrUpdateEntity(this.roomTypePricingList);

            this.customer = new Customer()
            {
                Name     = "Thodoris",
                Surname  = "Kapiris",
                TaxId    = "TK1234567",
                IdNumber = "AB1234567",
                Address  = "Monasthraki",
                Email    = "*****@*****.**",
                Phone    = "2107654321"
            };
            this.customer = this.customerController.CreateOrUpdateEntity(this.customer);

            this.booking = new Booking()
            {
                CustomerId  = this.customer.Id,
                RoomId      = this.room.Id,
                From        = DateTime.Now,
                To          = Convert.ToDateTime("31/01/2017"),
                SystemPrice = 12,
                AgreedPrice = 12,
                Status      = Status.New,
                Comments    = "Very good!!"
            };
            this.booking = this.bookingController.CreateOrUpdateEntity(this.booking);

            this.billing = new Billing()
            {
                BookingId        = this.booking.Id,
                PriceForRoom     = this.booking.AgreedPrice,
                PriceForServices = 150,
                TotalPrice       = 12150,
                Paid             = true
            };
            this.billing = this.billingController.CreateOrUpdateEntity(this.billing);
        }
Beispiel #34
0
        public async Task <IActionResult> Edit(ReservationsEditViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var  userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
            User user   = _context.Users.FirstOrDefault(x => x.Id == userId);
            Room room   = _context.Rooms.FirstOrDefault(x => x.Id == model.RoomId);

            room.IsFree = false;


            decimal       adults = 0, kids = 0;
            List <Client> clients = new List <Client>();
            Reservation   reser   = await this._context.Reservations
                                    .Include(res => res.Clients)
                                    .ThenInclude(client => client.Client)
                                    .SingleOrDefaultAsync(rese => rese.Id == model.Id);

            List <ClientReservation> cl   = _context.ClientReservations.Where(res => res.Reservation.Id == reser.Id).ToList();
            List <string>            clId = new List <string>();

            foreach (var c in cl)
            {
                clId.Add(c.Client.Id);
            }

            foreach (var c in clId)
            {
                Client client = new Client();
                client = _context.Clients.FirstOrDefault(x => x.Id == c);
                clients.Add(client);
            }
            foreach (var client in clients)
            {
                if (client.IsAdult)
                {
                    adults++;
                }
                else
                {
                    kids++;
                }
            }
            var     days  = (decimal)(model.ReleaseDate.Subtract(model.AccommodationDate.Date).TotalDays);
            decimal dueAm = days * (adults * room.PriceForAdult + kids * room.PriceForKid);

            reser.Id   = model.Id;
            reser.User = user;
            reser.Room = room;
            reser.AccommodationDate = model.AccommodationDate;
            reser.ReleaseDate       = model.ReleaseDate;
            reser.HaveBreakFast     = model.HaveBreakFast;
            reser.IsAllInclusive    = model.IsAllInclusive;
            reser.DueAmount         = dueAm;


            _context.Update(reser);
            await _context.SaveChangesAsync();


            return(RedirectToAction(nameof(All)));
        }
Beispiel #35
0
        private void OnExplodingGrenade(ExplodingGrenadeEventArgs ev)
        {
            if (!Check(ev.Grenade))
            {
                return;
            }

            ev.IsAllowed = false;

            Room      room = Exiled.API.Features.Map.FindParentRoom(ev.Grenade);
            TeslaGate gate = null;

            Log.Debug($"{ev.Grenade.transform.position} - {room.Position} - {Exiled.API.Features.Map.Rooms.Count}", CustomItems.Instance.Config.IsDebugEnabled);

            LockedRooms079.Add(room);

            room.TurnOffLights(Duration);

            if (DisableTeslaGates)
            {
                foreach (TeslaGate teslaGate in Exiled.API.Features.Map.TeslaGates)
                {
                    if (Exiled.API.Features.Map.FindParentRoom(teslaGate.gameObject) == room)
                    {
                        disabledTeslaGates.Add(teslaGate);
                        gate = teslaGate;
                        break;
                    }
                }
            }

            Log.Debug($"{room.Doors.Count()} - {room.Type}", CustomItems.Instance.Config.IsDebugEnabled);

            foreach (DoorVariant door in room.Doors)
            {
                if (door == null ||
                    (!string.IsNullOrEmpty(door.GetNametag()) && BlacklistedDoorNames.Contains(door.GetNametag())) ||
                    (door.NetworkActiveLocks > 0 && !OpenLockedDoors) ||
                    (door.RequiredPermissions.RequiredPermissions != KeycardPermissions.None && !OpenKeycardDoors))
                {
                    continue;
                }

                Log.Debug("Opening a door!", CustomItems.Instance.Config.IsDebugEnabled);

                door.NetworkTargetState = true;
                door.ServerChangeLock(DoorLockReason.NoPower, true);

                if (lockedDoors.Contains(door))
                {
                    lockedDoors.Add(door);
                }

                Timing.CallDelayed(Duration, () =>
                {
                    door.ServerChangeLock(DoorLockReason.NoPower, false);
                    lockedDoors.Remove(door);
                });
            }

            foreach (Player player in Player.List)
            {
                if (player.Role == RoleType.Scp079)
                {
                    if (player.Camera != null && player.Camera.Room() == room)
                    {
                        player.SetCamera(198);
                    }
                }
                if (player.CurrentRoom != room)
                {
                    continue;
                }

                foreach (Inventory.SyncItemInfo item in player.ReferenceHub.inventory.items)
                {
                    if (item.id == ItemType.Radio)
                    {
                        player.ReferenceHub.inventory.items.ModifyDuration(player.ReferenceHub.GetComponent <Radio>().myRadio, 0f);
                    }
                    else if (player.ReferenceHub.weaponManager.syncFlash)
                    {
                        player.ReferenceHub.weaponManager.syncFlash = false;
                    }
                }
            }

            Timing.CallDelayed(Duration, () =>
            {
                LockedRooms079.Remove(room);
                if (gate != null)
                {
                    disabledTeslaGates.Remove(gate);
                }
            });
        }
        public void test_exceptSomeRooms_largerAndEqual_smallerAndEqual_test_pass()
        {
            using (ShimsContext.Create())
            {
                FakeHVACFunction.ExcelPath_new     = @"D:\wangT\HVAC-Checker\UnitTestHVACChecker\测试数据\测试数据_exceptSomeRoom.xlsx";
                FakeHVACFunction.roomSheetName_new = "房间(包含需要除去的房间大于等于小于等于)";
                HVAC_CheckEngine.Fakes.ShimHVACFunction.GetRoomsString = FakeHVACFunction.GetRooms_new;
                //arrange

                //打开测试数据文件
                string importExcelPath = FakeHVACFunction.ExcelPath_new;
                //打开数据文件
                IWorkbook workbook = WorkbookFactory.Create(importExcelPath);
                //读取数据表格
                ISheet sheet_rooms = workbook.GetSheet("房间(包含需要除去的房间大于等于小于等于)");

                List <Room> aimRooms = new List <Room>();
                //依次读取数据行,并根据数据内容创建房间,并加入房间集合中
                for (int index = 1; index <= sheet_rooms.LastRowNum; ++index)
                {
                    IRow row          = (IRow)sheet_rooms.GetRow(index);
                    bool isNeededRoom = row.GetCell(sheet_rooms.getColNumber("是否需要")).BooleanCellValue;
                    if (isNeededRoom)
                    {
                        long Id   = Convert.ToInt64(row.GetCell(sheet_rooms.getColNumber("ID")).ToString());
                        Room room = new Room(Id);
                        room.type              = row.GetCell(sheet_rooms.getColNumber("房间类型")).StringCellValue;
                        room.name              = row.GetCell(sheet_rooms.getColNumber("房间名称")).StringCellValue;
                        room.m_dArea           = row.GetCell(sheet_rooms.getColNumber("房间面积")).NumericCellValue;
                        room.m_eRoomPosition   = (RoomPosition)row.GetCell(sheet_rooms.getColNumber("房间位置")).NumericCellValue;
                        room.m_iNumberOfPeople = (int)row.GetCell(sheet_rooms.getColNumber("房间人数")).NumericCellValue;
                        room.m_iStoryNo        = (int)row.GetCell(sheet_rooms.getColNumber("房间楼层编号")).NumericCellValue;
                        aimRooms.Add(room);
                    }
                }
                //act
                List <Room> rooms = HVACFunction.GetRooms("");

                List <assistantFunctions.exceptRoomCondition> conditions = new List <assistantFunctions.exceptRoomCondition>();
                assistantFunctions.exceptRoomCondition        overgroundCorridorCondition = new assistantFunctions.exceptRoomCondition();
                overgroundCorridorCondition.area         = 0;
                overgroundCorridorCondition.type         = "走廊";
                overgroundCorridorCondition.name         = "";
                overgroundCorridorCondition.roomPosition = RoomPosition.overground;
                overgroundCorridorCondition.areaType     = assistantFunctions.exceptRoomCondition.AreaType.LargerAndEqualThan;
                conditions.Add(overgroundCorridorCondition);

                assistantFunctions.exceptRoomCondition overgroundSmallerThan500sqmCondition = new assistantFunctions.exceptRoomCondition();
                overgroundSmallerThan500sqmCondition.area         = 500;
                overgroundSmallerThan500sqmCondition.type         = "";
                overgroundSmallerThan500sqmCondition.name         = "";
                overgroundSmallerThan500sqmCondition.roomPosition = RoomPosition.overground;
                overgroundSmallerThan500sqmCondition.areaType     = assistantFunctions.exceptRoomCondition.AreaType.SmallerAndEqualThan;
                conditions.Add(overgroundSmallerThan500sqmCondition);

                rooms = rooms.exceptSomeRooms(conditions);

                //assert

                Custom_Assert.AreListsEqual(aimRooms, rooms);
            }
        }
Beispiel #37
0
    public void SetupCorridor(Room room, IntRange length, IntRange roomWidth, IntRange roomHeight, int columns, int rows, bool firstCorridor)
    {
        direction = (Direction)Random.Range(0, 4);

        //Direction oppositeDirection = (Direction)(((int)room.enteringCorridor +2) % 4);
    }
Beispiel #38
0
 public void Execute(GameClients.GameClient Session, Room Room, string[] Params)
 {
     Session.SendMessage(new MassEventComposer("habbopages/chat/wiredvars.txt"));
     return;
 }
Beispiel #39
0
        public ActionResult New(int roomId)
        {
            Room room = Room.Find(roomId);

            return(View(room));
        }
Beispiel #40
0
        void DetermineAdjacentElementLengthsAndWallAreas(
            Room room)
        {
            Document doc = room.Document;

            // 'Autodesk.Revit.DB.Architecture.Room.Boundary' is obsolete:
            // use GetBoundarySegments(SpatialElementBoundaryOptions) instead.

            //BoundarySegmentArrayArray boundaries = room.Boundary; // 2011

            IList <IList <BoundarySegment> > boundaries
                = room.GetBoundarySegments(
                      new SpatialElementBoundaryOptions()); // 2012

            // a room may have a null boundary property:

            int n = 0;

            if (null != boundaries)
            {
                //n = boundaries.Size; // 2011
                n = boundaries.Count; // 2012
            }

            Debug.Print(
                "{0} has {1} boundar{2}{3}",
                Util.ElementDescription(room),
                n, Util.PluralSuffixY(n),
                Util.DotOrColon(n));

            if (0 < n)
            {
                int iBoundary = 0, iSegment;

                //foreach( BoundarySegmentArray b in boundaries ) // 2011
                foreach (IList <BoundarySegment> b in boundaries) // 2012
                {
                    ++iBoundary;
                    iSegment = 0;
                    foreach (BoundarySegment s in b)
                    {
                        ++iSegment;

                        //Element neighbour = s.Element; // 2015
                        Element neighbour = doc.GetElement(s.ElementId); // 2016

                        //Curve curve = s.Curve; // 2015
                        Curve curve = s.GetCurve(); // 2016

                        double length = curve.Length;

                        Debug.Print(
                            "  Neighbour {0}:{1} {2} has {3}"
                            + " feet adjacent to room.",
                            iBoundary, iSegment,
                            Util.ElementDescription(neighbour),
                            Util.RealString(length));

                        if (neighbour is Wall)
                        {
                            Wall wall = neighbour as Wall;

                            Parameter p = wall.get_Parameter(
                                BuiltInParameter.HOST_AREA_COMPUTED);

                            double area = p.AsDouble();

                            LocationCurve lc
                                = wall.Location as LocationCurve;

                            double wallLength = lc.Curve.Length;

                            //Level bottomLevel = wall.Level; // 2013
                            Level  bottomLevel     = doc.GetElement(wall.LevelId) as Level; // 2014
                            double bottomElevation = bottomLevel.Elevation;
                            double topElevation    = bottomElevation;

                            p = wall.get_Parameter(
                                BuiltInParameter.WALL_HEIGHT_TYPE);

                            if (null != p)
                            {
                                ElementId id       = p.AsElementId();
                                Level     topLevel = doc.GetElement(id) as Level;
                                topElevation = topLevel.Elevation;
                            }

                            double height = topElevation - bottomElevation;

                            Debug.Print(
                                "    This wall has a total length,"
                                + " height and area of {0} feet,"
                                + " {1} feet and {2} square feet.",
                                Util.RealString(wallLength),
                                Util.RealString(height),
                                Util.RealString(area));
                        }
                    }
                }
            }
        }
Beispiel #41
0
 void InitRoom(Room room)
 {
     room.resizeEvent     += CreateGridButton;
     room.updateTileEvent += UpdateTile;
 }
 public bool ExistsLocation(Room id) //vrací true pokud existuje lokace s názvem id
 {
     return(_locations.ContainsKey(id));
 }
Beispiel #43
0
 /// <summary>
 /// Returns a Room property of type Bool.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="propertyName"></param>
 /// <param name="fallback"></param>
 /// <returns></returns>
 public static bool GetBool(this Room room, string propertyName, bool fallback = false)
 {
     return room.HasProperty(propertyName) ? room.GetProperty<bool>(propertyName) : fallback;
 }
Beispiel #44
0
 /// <summary>
 /// Returns a Room property of type string.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="propertyName"></param>
 /// <param name="fallback"></param>
 /// <returns></returns>
 public static string GetString(this Room room, string propertyName, string fallback = "")
 {
     return room.HasProperty(propertyName) ? room.GetProperty<string>(propertyName) : fallback;
 }
Beispiel #45
0
 /// <summary>
 /// Defines the Start Time Room.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="propertyName"></param>
 /// <param name="time"></param>
 public static void SetStartTime(this Room room, double time)
 {
     room.SetProperty<double>(TIME_START, time, false);
 }
Beispiel #46
0
 /// <summary>
 /// Defines the duration time of this Room (in seconds).
 /// </summary>
 /// <param name="player"></param>
 /// <param name="propertyName"></param>
 /// <param name="time"></param>
 public static void SetDurationTime(this Room room, int timeInSeconds)
 {
     room.SetProperty<int>(TIME_DURATION, timeInSeconds, false);
 }
Beispiel #47
0
        public async Task <Room> AddRoom(Room room)
        {
            var addedEntity = await _roomRepository.Add(RoomMapper.Map(room));

            return(RoomMapper.Map(addedEntity));
        }
Beispiel #48
0
 /// <summary>
 /// Returns room Duration Time.
 /// </summary>
 /// <param name="room"></param>
 /// <returns></returns>
 public static int GetDurationTime(this Room room)
 {
     return room.HasProperty(TIME_START) ? room.GetProperty<int>(TIME_DURATION) : -1;
 }
Beispiel #49
0
 /// <summary>
 /// Returns a Room property of type float.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="propertyName"></param>
 /// <param name="fallback"></param>
 /// <returns></returns>
 public static float GetFloat(this Room room, string propertyName, float fallback = 0)
 {
     return room.HasProperty(propertyName) ? room.GetProperty<float>(propertyName) : fallback;
 }
Beispiel #50
0
 /// <summary>
 /// Defines a bool property on this Room.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="propertyName"></param>
 /// <param name="propertyValue"></param>
 public static void SetBool(this Room room, string propertyName, bool propertyValue, bool webFoward)
 {
     room.SetProperty<bool>(propertyName, propertyValue, webFoward);
 }
Beispiel #51
0
 /// <summary>
 /// Defines a float property on this Room.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="propertyName"></param>
 /// <param name="propertyValue"></param>
 public static void SetFloat(this Room room, string propertyName, float propertyValue, bool webFoward)
 {
     room.SetProperty<float>(propertyName, propertyValue, webFoward);
 }
Beispiel #52
0
 /// <summary>
 /// Returns room Start Time.
 /// </summary>
 /// <param name="room"></param>
 /// <returns></returns>
 public static double GetRemainingTime(this Room room)
 {
     float secsPerRound = room.HasProperty(TIME_DURATION) ? room.GetDurationTime() : 0;
     return room.HasProperty(TIME_DURATION) ? secsPerRound - (room.GetElapsedTime() % secsPerRound) : room.GetElapsedTime();
 }
Beispiel #53
0
 /// <summary>
 /// Returns room Start Time.
 /// </summary>
 /// <param name="room"></param>
 /// <returns></returns>
 public static double GetElapsedTime(this Room room)
 {
     return room.HasProperty(TIME_START) ? PhotonNetwork.Time - room.GetStartTime() : 0;
 }
Beispiel #54
0
 /// <summary>
 /// Defines a double property on this Room.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="propertyName"></param>
 /// <param name="propertyValue"></param>
 public static void SetDouble(this Room room, string propertyName, double propertyValue, bool webFoward)
 {
     room.SetProperty<double>(propertyName, propertyValue, webFoward);
 }
Beispiel #55
0
 /// <summary>
 /// Returns a Room property of type int.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="propertyName"></param>
 /// <param name="fallback"></param>
 /// <returns></returns>
 public static int GetInt(this Room room, string propertyName, int fallback = 0)
 {
     return room.HasProperty(propertyName) ? room.GetProperty<int>(propertyName) : fallback;
 }
Beispiel #56
0
 /// <summary>
 /// Defines a int property on this Room.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="propertyName"></param>
 /// <param name="propertyValue"></param>
 public static void SetInt(this Room room, string propertyName, int propertyValue, bool webFoward)
 {
     room.SetProperty<int>(propertyName, propertyValue, webFoward);
 }
Beispiel #57
0
        private IEnumerator Dungeon_TriggerEvents(On.Dungeon.orig_TriggerEvents orig, Dungeon self, Room openingRoom, HeroMobCommon opener, bool canTriggerDungeonEvent)
        {
            SeedCollection collection = SeedCollection.GetMostCurrentSeeds(self.ShipName, self.Level);

            if (collection == null || !collection.Enabled || isHumanWrapper.Value)
            {
                yield return(self.StartCoroutine(orig(self, openingRoom, opener, canTriggerDungeonEvent)));

                yield break;
            }
            else
            {
                // Load seeds for each door from files/somewhere
                // Restore the seed for this room openingRoom
                RandomGenerator.RestoreSeed();

                // Calls TriggerEvents the proper number of times. Hangs on this call.
                // Random deviation seems to appear while this Coroutine is running, possibly due to monster random actions?
                // Could fix this by storing all before/after seeds, but doesn't that seem lame?
                // Would like to find a way of only wrapping the Random calls with this so that there is less UnityEngine.Random.seed
                // noise from other sources that occur during the runtime.
                // The above will probably not work, so instead wrap everything EXCEPT for the wait in the Random Save/Restore
                // Possible error from SpawnWaves, SpawnMobs (cause they have dedicated Coroutines that run)
                yield return(self.StartCoroutine(orig(self, openingRoom, opener, canTriggerDungeonEvent)));

                // I'm going to cheat for now and SKIP the saving step - the same exact seed is ALWAYS used for RandomGenerator
                // When using RandomGenerator seeds.
                //mod.Log("Saving Seed!");
                //RandomGenerator.SaveSeed();

                yield break;
            }
        }
Beispiel #58
0
 /// <summary>
 /// Returns true if the give property is found
 /// </summary>
 /// <param name="player"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static bool HasProperty(this Room room, string propertyName)
 {
     return room == null ? false : (room.CustomProperties == null ? false : room.CustomProperties.ContainsKey(propertyName));
 }
Beispiel #59
0
    public void Deconstruct()
    {
        int  x                = Tile.X;
        int  y                = Tile.Y;
        int  fwidth           = 1;
        int  fheight          = 1;
        bool linksToNeighbour = false;

        if (Tile.Furniture != null)
        {
            Furniture furniture = Tile.Furniture;
            fwidth           = furniture.Width;
            fheight          = furniture.Height;
            linksToNeighbour = furniture.LinksToNeighbour;
            furniture.CancelJobs();
        }

        // We call lua to decostruct
        EventActions.Trigger("OnUninstall", this);

        // Update thermalDiffusifity to default value
        World.Current.temperature.SetThermalDiffusivity(Tile.X, Tile.Y, Temperature.defaultThermalDiffusivity);

        Tile.UnplaceFurniture();

        if (PowerConnection != null)
        {
            World.Current.PowerSystem.Unplug(PowerConnection);
            PowerConnection.NewThresholdReached -= OnNewThresholdReached;
        }

        if (Removed != null)
        {
            Removed(this);
        }

        // Do we need to recalculate our rooms?
        if (RoomEnclosure)
        {
            Room.DoRoomFloodFill(Tile);
        }

        ////World.current.InvalidateTileGraph();

        if (World.Current.tileGraph != null)
        {
            World.Current.tileGraph.RegenerateGraphAtTile(Tile);
        }

        // We should inform our neighbours that they have just lost a
        // neighbour regardless of objectType.
        // Just trigger their OnChangedCallback.
        if (linksToNeighbour == true)
        {
            for (int xpos = x - 1; xpos < x + fwidth + 1; xpos++)
            {
                for (int ypos = y - 1; ypos < y + fheight + 1; ypos++)
                {
                    Tile t = World.Current.GetTileAt(xpos, ypos, Tile.Z);
                    if (t != null && t.Furniture != null && t.Furniture.Changed != null)
                    {
                        t.Furniture.Changed(t.Furniture);
                    }
                }
            }
        }

        // At this point, no DATA structures should be pointing to us, so we
        // should get garbage-collected.
    }
Beispiel #60
0
 /// <summary>
 /// Returns a Room property of type double.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="propertyName"></param>
 /// <param name="fallback"></param>
 /// <returns></returns>
 public static double GetDouble(this Room room, string propertyName, double fallback = 0)
 {
     return room.HasProperty(propertyName) ? room.GetProperty<double>(propertyName) : fallback;
 }