Пример #1
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter the username you wish to flag.");
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            if (TargetClient.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                Session.SendWhisper("You are not allowed to flag that user.");
                return;
            }
            else
            {
                TargetClient.GetHabbo().LastNameChange = 0;
                TargetClient.GetHabbo().ChangingName = true;
                TargetClient.SendNotification("Please be aware that if your username is deemed as inappropriate, you will be banned without question.\r\rAlso note that Staff will NOT allow you to change your username again should you have an issue with what you have chosen.\r\rClose this window and click yourself to begin choosing a new username!");
                TargetClient.SendMessage(new UserObjectComposer(TargetClient.GetHabbo()));
            }
        }
Пример #2
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null || User.GetClient() == null)
                return;

            string[] headParts;
            string[] figureParts = Session.GetHabbo().Look.Split('.');
            foreach (string Part in figureParts)
            {
                if (Part.StartsWith("hd"))
                {
                    headParts = Part.Split('-');
                    if (!headParts[1].Equals("99999"))
                        headParts[1] = "99999";
                    else
                        return;

                    Session.GetHabbo().Look = Session.GetHabbo().Look.Replace(Part, "hd-" + headParts[1] + "-" + headParts[2]);
                    break;
                }
            }
            Session.GetHabbo().Look = PlusEnvironment.GetGame().GetAntiMutant().RunLook(Session.GetHabbo().Look);
            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `users` SET `look` = '" + Session.GetHabbo().Look + "' WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
            }

            Session.SendMessage(new UserChangeComposer(User, true));
            Session.GetHabbo().CurrentRoom.SendMessage(new UserChangeComposer(User, false));
            return;
        }
Пример #3
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            Room = Session.GetHabbo().CurrentRoom;
            if (Room == null)
                return;

            if (Room.Group == null)
            {
                Session.SendWhisper("Oops, there is no group here?");
                return;
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("DELETE FROM `groups` WHERE `id` = '" + Room.Group.Id + "'");
                dbClient.RunQuery("DELETE FROM `group_memberships` WHERE `group_id` = '" + Room.Group.Id + "'");
                dbClient.RunQuery("DELETE FROM `group_requests` WHERE `group_id` = '" + Room.Group.Id + "'");
                dbClient.RunQuery("UPDATE `rooms` SET `group_id` = '0' WHERE `group_id` = '" + Room.Group.Id + "' LIMIT 1");
                dbClient.RunQuery("UPDATE `user_stats` SET `groupid` = '0' WHERE `groupid` = '" + Room.Group.Id + "' LIMIT 1");
                dbClient.RunQuery("DELETE FROM `items_groups` WHERE `group_id` = '" + Room.Group.Id + "'");
            }

            PlusEnvironment.GetGame().GetGroupManager().DeleteGroup(Room.RoomData.Group.Id);

            Room.Group = null;
            Room.RoomData.Group = null;

            PlusEnvironment.GetGame().GetRoomManager().UnloadRoom(Room, true);

            Session.SendNotification("Success, group deleted.");
            return;
        }
Пример #4
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter the username of the user you wish to alert.");
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            if (TargetClient.GetHabbo() == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username)
            {
                Session.SendWhisper("Get a life.");
                return;
            }

            string Message = CommandManager.MergeParams(Params, 2);

            TargetClient.SendNotification(Session.GetHabbo().Username + " alerted you with the following message:\n\n" + Message);
            Session.SendWhisper("Alert successfully sent to " + TargetClient.GetHabbo().Username);
        }
Пример #5
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            int TotalValue = 0;

            try
            {
                DataTable Table = null;
                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT `id` FROM `items` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND (`room_id`=  '0' OR `room_id` = '')");
                    Table = dbClient.getTable();
                }

                if (Table == null)
                {
                    Session.SendWhisper("You currently have no items in your inventory!");
                    return;
                }

                foreach (DataRow Row in Table.Rows)
                {
                    Item Item = Session.GetHabbo().GetInventoryComponent().GetItem(Convert.ToInt32(Row[0]));
                    if (Item == null)
                        continue;

                    if (!Item.GetBaseItem().ItemName.StartsWith("CF_") && !Item.GetBaseItem().ItemName.StartsWith("CFC_"))
                        continue;

                    if (Item.RoomId > 0)
                        continue;

                    string[] Split = Item.GetBaseItem().ItemName.Split('_');
                    int Value = int.Parse(Split[1]);

                    using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1");
                    }

                    Session.GetHabbo().GetInventoryComponent().RemoveItem(Item.Id);

                    TotalValue += Value;

                    if (Value > 0)
                    {
                        Session.GetHabbo().Credits += Value;
                        Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                    }
                }

                if (TotalValue > 0)
                    Session.SendNotification("All credits have successfully been converted!\r\r(Total value: " + TotalValue + " credits!");
                else
                    Session.SendNotification("It appears you don't have any exchangeable items!");
            }
            catch
            {
                Session.SendNotification("Oops, an error occoured whilst converting your credits!");
            }
        }
Пример #6
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (!Room.CheckRights(Session, true))
            {
                Session.SendWhisper("Oops, only the room owner can run this command!");
                return;
            }

            foreach (RoomUser User in Room.GetRoomUserManager().GetUserList().ToList())
            {
                if (User == null || User.IsPet || !User.IsBot)
                    continue;

                RoomUser BotUser = null;
                if (!Room.GetRoomUserManager().TryGetBot(User.BotData.Id, out BotUser))
                    return;

                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `bots` SET `room_id` = '0' WHERE `id` = @id LIMIT 1");
                    dbClient.AddParameter("id", User.BotData.Id);
                    dbClient.RunQuery();
                }

                Session.GetHabbo().GetInventoryComponent().TryAddBot(new Bot(Convert.ToInt32(BotUser.BotData.Id), Convert.ToInt32(BotUser.BotData.ownerID), BotUser.BotData.Name, BotUser.BotData.Motto, BotUser.BotData.Look, BotUser.BotData.Gender));
                Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots()));
                Room.GetRoomUserManager().RemoveBot(BotUser.VirtualId, false);
            }

            Session.SendWhisper("Success, removed all bots.");
        }
Пример #7
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            RoomUser ThisUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (ThisUser == null)
                return;

            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter an ID of a dance.");
                return;
            }

            int DanceId;
            if (int.TryParse(Params[1], out DanceId))
            {
                if (DanceId > 4 || DanceId < 0)
                {
                    Session.SendWhisper("The dance ID must be between 0 and 4!");
                    return;
                }

                Session.GetHabbo().CurrentRoom.SendMessage(new DanceComposer(ThisUser, DanceId));
            }
            else
                Session.SendWhisper("Please enter a valid dance ID.");
        }
Пример #8
0
 public Area(string name, string description)
 {
     Rooms = new Rooms(this);
     SetColor();
     Name = name;
     Description = description;
 }
Пример #9
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length != 3)
            {
                Session.SendWhisper("Please enter a username and the code of the badge you'd like to give!");
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient != null)
            {
                if (!TargetClient.GetHabbo().GetBadgeComponent().HasBadge(Params[2]))
                {
                    TargetClient.GetHabbo().GetBadgeComponent().GiveBadge(Params[2], true, TargetClient);
                    if (TargetClient.GetHabbo().Id != Session.GetHabbo().Id)
                        TargetClient.SendNotification("You have just been given a badge!");
                    else
                        Session.SendWhisper("You have successfully given yourself the badge " + Params[2] + "!");
                }
                else
                    Session.SendWhisper("Oops, that user already has this badge (" + Params[2] + ") !");
                return;
            }
            else
            {
                Session.SendWhisper("Oops, we couldn't find that target user!");
                return;
            }
        }
Пример #10
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter a dance ID. (1-4)");
                return;
            }

            int DanceId = Convert.ToInt32(Params[1]);
            if (DanceId < 0 || DanceId > 4)
            {
                Session.SendWhisper("Please enter a dance ID. (1-4)");
                return;
            }

            List<RoomUser> Users = Room.GetRoomUserManager().GetRoomUsers();
            if (Users.Count > 0)
            {
                foreach (RoomUser U in Users.ToList())
                {
                    if (U == null)
                        continue;

                    if (U.CarryItemID > 0)
                        U.CarryItemID = 0;

                    U.DanceId = DanceId;
                    Room.SendMessage(new DanceComposer(U, DanceId));
                }
            }
        }
Пример #11
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter the username of the user you wish to summon.");
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            if (TargetClient.GetHabbo() == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username)
            {
                Session.SendWhisper("Get a life.");
                return;
            }

            TargetClient.SendNotification("You have been summoned to " + Session.GetHabbo().Username + "!");
            if (!TargetClient.GetHabbo().InRoom)
                TargetClient.SendMessage(new RoomForwardComposer(Session.GetHabbo().CurrentRoomId));
            else
                TargetClient.GetHabbo().PrepareRoom(Session.GetHabbo().CurrentRoomId, "");
        }
Пример #12
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please provide a reason for muting the room to show to the users.");
                return;
            }

            if (!Room.RoomMuted)
                Room.RoomMuted = true;

            string Msg = CommandManager.MergeParams(Params, 1);

            List<RoomUser> RoomUsers = Room.GetRoomUserManager().GetRoomUsers();
            if (RoomUsers.Count > 0)
            {
                foreach (RoomUser User in RoomUsers)
                {
                    if (User == null || User.GetClient() == null || User.GetClient().GetHabbo() == null || User.GetClient().GetHabbo().Username == Session.GetHabbo().Username)
                        continue;

                    User.GetClient().SendWhisper("This room has been muted because: " + Msg);
                }
            }
        }
Пример #13
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null)
                return;

            if (Params.Length == 1)
            {
                Session.SendWhisper("Oops, you forgot to enter a bubble ID!");
                return;
            }

            int Bubble = 0;
            if (!int.TryParse(Params[1].ToString(), out Bubble))
            {
                Session.SendWhisper("Please enter a valid number.");
                return;
            }

            ChatStyle Style = null;
            if (!PlusEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Bubble, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
            {
                Session.SendWhisper("Oops, you cannot use this bubble due to a rank requirement, sorry!");
                return;
            }

            User.LastBubble = Bubble;
            Session.GetHabbo().CustomBubbleId = Bubble;
            Session.SendWhisper("Bubble set to: " + Bubble);
        }
Пример #14
0
 internal override void OnUserEnterRoom(Rooms.RoomUser User)
 {
     if (User.GetClient() != null && User.GetClient().GetHabbo() != null)
     {
         if (User.GetClient().GetHabbo().Username.ToLower() == "ryan")
             GetRoomUser().Chat(null, "Wow! Ryan is in de kamer <3", true);
     }
 }
Пример #15
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (ThisUser == null)
                return;

            Session.SendNotification("X: " + ThisUser.X + "\n - Y: " + ThisUser.Y + "\n - Z: " + ThisUser.Z + "\n - Rot: " + ThisUser.RotBody + ", sqState: " + Room.GetGameMap().GameMap[ThisUser.X, ThisUser.Y].ToString() + "\n\n - RoomID: " + Session.GetHabbo().CurrentRoomId);
        }
Пример #16
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter a username and a valid length in days (min 1 day, max 365 days).");
                return;
            }

            Habbo Habbo = PlusEnvironment.GetHabboByUsername(Params[1]);
            if (Habbo == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user in the database.");
                return;
            }

            if (Convert.ToDouble(Params[2]) == 0)
            {
                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '0' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
                }

                if (Habbo.GetClient() != null)
                {
                    Habbo.TradingLockExpiry = 0;
                    Habbo.GetClient().SendNotification("Your outstanding trade ban has been removed.");
                }

                Session.SendWhisper("You have successfully removed " + Habbo.Username + "'s trade ban.");
                return;
            }

            double Days;
            if (double.TryParse(Params[2], out Days))
            {
                if (Days < 1)
                    Days = 1;

                if (Days > 365)
                    Days = 365;

                double Length = (PlusEnvironment.GetUnixTimestamp() + (Days * 86400));
                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '" + Length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
                }

                if (Habbo.GetClient() != null)
                {
                    Habbo.TradingLockExpiry = Length;
                    Habbo.GetClient().SendNotification("You have been trade banned for " + Days + " day(s)!");
                }

                Session.SendWhisper("You have successfully trade banned " + Habbo.Username + " for " + Days + " day(s).");
            }
            else
                Session.SendWhisper("Please enter a valid integer.");
        }
Пример #17
0
 private void Generate(Rooms.Room room)
 {
     Vector2 spoutPos = Center;
     if (direction.X < 0)
         spoutPos = new Vector2(Position.X - 175, Center.Y);
     if (direction.X > 0)
         spoutPos = new Vector2(Position.X + room.Tilesize.X + Spout.SIZE.Y*(3f/4f), Center.Y);
     room.Add(new Spout(spoutPos, color, direction, isWater));
 }
Пример #18
0
 private void FillRoomControls(Rooms.Room room)
 {
     roomIdValue.Text = room.Id.ToString();
     roomTitleValue.Text = room.Title;
     roomDescriptionValue.Text = room.Description;
     room.GetRoomExits();
     FillExits(room.RoomExits);
     FillModifiers(Rooms.Room.GetModifiers(room.Id));
 }
Пример #19
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null)
                return;

            User.AllowOverride = !User.AllowOverride;
            Session.SendWhisper("Override mode updated.");
        }
Пример #20
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null)
                return;

            User.TeleportEnabled = !User.TeleportEnabled;
            Room.GetGameMap().GenerateMaps();
        }
Пример #21
0
 public Area()
 {
     ClassType = classObjectType.area;
     Rooms = new Rooms(this);
     SetColor();
     Name = "new area";
     Description = "new area";
     AreaSettings = new AreaSettings();
     cancellationTokenSource = new CancellationTokenSource();
 }
Пример #22
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Session.GetHabbo().Id == Room.OwnerId)
            {
                //Let us check anyway.
                if (!Room.CheckRights(Session, true))
                    return;

                foreach (Item Item in Room.GetRoomItemHandler().GetWallAndFloor.ToList())
                {
                    if (Item == null || Item.UserID == Session.GetHabbo().Id)
                        continue;

                    GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Item.UserID);
                    if (TargetClient != null && TargetClient.GetHabbo() != null)
                    {
                        Room.GetRoomItemHandler().RemoveFurniture(TargetClient, Item.Id);
                        TargetClient.GetHabbo().GetInventoryComponent().AddNewItem(Item.Id, Item.BaseItem, Item.ExtraData, Item.GroupId, true, true, Item.LimitedNo, Item.LimitedTot);
                        TargetClient.GetHabbo().GetInventoryComponent().UpdateItems(false);
                    }
                    else
                    {
                        Room.GetRoomItemHandler().RemoveFurniture(null, Item.Id);
                        using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.RunQuery("UPDATE `items` SET `room_id` = '0' WHERE `id` = '" + Item.Id + "' LIMIT 1");
                        }
                    }
                }
            }
            else
            {
                foreach (Item Item in Room.GetRoomItemHandler().GetWallAndFloor.ToList())
                {
                    if (Item == null || Item.UserID != Session.GetHabbo().Id)
                        continue;

                    GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Item.UserID);
                    if (TargetClient != null && TargetClient.GetHabbo() != null)
                    {
                        Room.GetRoomItemHandler().RemoveFurniture(TargetClient, Item.Id);
                        TargetClient.GetHabbo().GetInventoryComponent().AddNewItem(Item.Id, Item.BaseItem, Item.ExtraData, Item.GroupId, true, true, Item.LimitedNo, Item.LimitedTot);
                        TargetClient.GetHabbo().GetInventoryComponent().UpdateItems(false);
                    }
                    else
                    {
                        Room.GetRoomItemHandler().RemoveFurniture(null, Item.Id);
                        using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.RunQuery("UPDATE `items` SET `room_id` = '0' WHERE `id` = '" + Item.Id + "' LIMIT 1");
                        }
                    }
                }
            }
        }
Пример #23
0
        public override void Update(Rooms.Room room, GameTime gameTime)
        {
            if (intervalTimer == INTERVAL)
            {
                intervalTimer = 0;
                Generate(room);
            }

            intervalTimer++;
            base.Update(room, gameTime);
        }
Пример #24
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (!Room.CheckRights(Session, true))
            {
                Session.SendWhisper("Oops, only the owner of this room can run this command!");
                return;
            }

            Room.GetGameMap().DiagonalEnabled = !Room.GetGameMap().DiagonalEnabled;
            Session.SendWhisper("Successfully updated the diagonal boolean value for this room.");
        }
Пример #25
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (!Room.CheckRights(Session, true))
            {
                Session.SendWhisper("Oops, only the owner of this room can run this command!");
                return;
            }

            Room.GetGameMap().GenerateMaps();
            Session.SendWhisper("Game map of this room successfully re-generated.");
        }
Пример #26
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (!this.CanChangeName(Session.GetHabbo()))
            {
                Session.SendWhisper("Sorry, it seems you currently do not have the option to change your username!");
                return;
            }

            Session.GetHabbo().ChangingName = true;
            Session.SendNotification("Please be aware that if your username is deemed as inappropriate, you will be banned without question.\r\rAlso note that Staff will NOT change your username again should you have an issue with what you have chosen.\r\rClose this window and click yourself to begin choosing a new username!");
            Session.SendMessage(new UserObjectComposer(Session.GetHabbo()));
        }
Пример #27
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            Session.GetHabbo().AllowGifts = !Session.GetHabbo().AllowGifts;
            Session.SendWhisper("You're " + (Session.GetHabbo().AllowGifts == true ? "now" : "no longer") + " accepting gifts.");

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `allow_gifts` = @AllowGifts WHERE `id` = '" + Session.GetHabbo().Id + "'");
                dbClient.AddParameter("AllowGifts", PlusEnvironment.BoolToEnum(Session.GetHabbo().AllowGifts));
                dbClient.RunQuery();
            }
        }
Пример #28
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null)
                return;

            if (!Room.GetGameMap().ValidTile(User.X + 2, User.Y + 2) && !Room.GetGameMap().ValidTile(User.X + 1, User.Y + 1))
            {
                Session.SendWhisper("Oops, cannot lay down here - try elsewhere!");
                return;
            }

            if (User.Statusses.ContainsKey("sit") || User.isSitting || User.RidingHorse || User.IsWalking)
                return;

            if (Session.GetHabbo().Effects().CurrentEffect > 0)
                Session.GetHabbo().Effects().ApplyEffect(0);

            if (!User.Statusses.ContainsKey("lay"))
            {
                if ((User.RotBody % 2) == 0)
                {
                    if (User == null)
                        return;

                    try
                    {
                        User.Statusses.Add("lay", "1.0 null");
                        User.Z -= 0.35;
                        User.isLying = true;
                        User.UpdateNeeded = true;
                    }
                    catch { }
                }
                else
                {
                    User.RotBody--;//
                    User.Statusses.Add("lay", "1.0 null");
                    User.Z -= 0.35;
                    User.isLying = true;
                    User.UpdateNeeded = true;
                }

            }
            else
            {
                User.Z += 0.35;
                User.Statusses.Remove("lay");
                User.Statusses.Remove("1.0");
                User.isLying = false;
                User.UpdateNeeded = true;
            }
        }
Пример #29
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter a message to send.");
                return;
            }

            string Message = CommandManager.MergeParams(Params, 1);
            PlusEnvironment.GetGame().GetClientManager().StaffAlert(new BroadcastMessageAlertComposer("Staff Alert:\r\r" + Message + "\r\n" + "- " + Session.GetHabbo().Username));
            return;
        }
Пример #30
0
    public void InitRoom(Rooms rooms, string url, int id)
    {
        //StartCoroutine(RealLoadRoomImage(url));
        RealLoadLocalImage(url);
        GetComponent<Button>().onClick.AddListener(() =>
        {
            Data.Instance.SetRoomFromLocalFiles(false);
            if (texture2d == null) return;
            Data.Instance.lastPhotoThumbTexture = texture2d;
            OnSelectedRoom(rooms, id);

        });
    }
Пример #31
0
        public Room SetupRooms()
        {
            //have to initialize first room. Add anything you need here that needs to load on start. -- may as well add rooms, etc
            Room bedroom = new Room("bedroom", @"
        You wake up from a great night of slumber. Stretching slowly you roll over and see you slept through your 
        alarms and you are running late for school! You dress as fast as possible and now you need to grab your 
        --> computer <-- (To add computer to Inventory, enter: take computer). Go --> east <-- to your office. 
        (to go east, enter: go east).
        
        *****************************************************************************************
        *       mini menu>> help | reset | quit | --> take item <-- | --> go direction <--      *
        *****************************************************************************************
        
        
        ");

            Room office = new Room("office", @"
        Now in your office you see it is flooding from the drains due to a laundry accident. 
        Even though you are running late you can't leave until you are able to stop the leak! 
        First you must --> take wrench <-- and I wonder what you must ** use ** to keep this 
        water from throwing a ** wrench ** in your plans...

        *****************************************************************************************
        *       mini menu>> help | reset | quit | --> take item <-- | --> go direction <--      *
        *****************************************************************************************


        
        ");

            Room stairs = new Room("stairs", @"
        You climb the stairs and realize you are incredibly hungry. 
        You see a --> sandwich <-- on the counter next to your keys.
        Time is a wastin! Better head --> west <-- to the garage...
             
        *****************************************************************************************
        *       mini menu>> help | reset | quit | --> take item <-- | --> go direction <--      *
        *****************************************************************************************



        ");



            Room garage = new Room("garage", @"
        Even though you are running late, you see an alert on your phone that traffic is backed up. 
        You can either take ** go ** by --> bike <-- or --> car <--.
  
        *****************************************************************************************
        *       mini menu>> help | reset | quit | --> take item <-- | --> go direction <--      *
        *****************************************************************************************




        ");

            Room school = new Room("school", $@"
        Climbing off your bike with mere moments to spare you rush into class only to realize it is Saturday... 
        
        Oh Well! At least you get and A for Awesome Sauce!
                  





        ");

            Room deathbycar = new Room("deathbycar", @"
        In addition to destroying the universe by using fossil fuels you have also done worse by
        not getting to school on time! The traffic jam consumes you like a campfire hungry for
        marshmallows. Or yeah something very much like that...





        ");

            Rooms.Add(bedroom);
            Rooms.Add(office);
            Rooms.Add(stairs);
            Rooms.Add(garage);
            Rooms.Add(deathbycar);
            Rooms.Add(school);

            //bedroom directions
            bedroom.Directions.Add("east", office);

            //office directions
            office.Directions.Add("west", bedroom);

            stairs.Directions.Add("west", garage);
            stairs.Directions.Add("south", office);


            //garage directions
            garage.Directions.Add("east", stairs);

            //go by bike directions
            garage.Directions.Add("bike", school);

            //go by directions
            garage.Directions.Add("car", deathbycar);



            Item computer   = new Item("computer", "Your laptop for school");
            Item powercable = new Item("powercable", "Won't work without it!");
            Item sandwich   = new Item("sandwich", "Time to level up!");
            Item wrench     = new Item("wrench", "Time to level up!");



            bedroom.Items.Add(computer);
            stairs.Items.Add(sandwich);
            office.Items.Add(wrench);
            office.Items.Add(powercable);

            return(bedroom);
            //have to initialize first room
        }
Пример #32
0
        public SlaveClientCollection([NotNull] ISendQueue <TPeer> sender, [NotNull] ISession session, [NotNull] EventQueue events, [NotNull] Rooms localRooms, [NotNull] string playerName, CodecSettings codecSettings)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            if (sender == null)
            {
                throw new ArgumentNullException("sender");
            }
            if (events == null)
            {
                throw new ArgumentNullException("events");
            }
            if (localRooms == null)
            {
                throw new ArgumentNullException("localRooms");
            }
            if (playerName == null)
            {
                throw new ArgumentNullException("playerName");
            }

            _session       = session;
            _sender        = sender;
            _events        = events;
            _localRooms    = localRooms;
            _playerName    = playerName;
            _codecSettings = codecSettings;
        }
Пример #33
0
 public IQueryable <Room> GetOwnedRooms(string userName) =>
 Rooms.Where(room => room.User.Username == userName);
Пример #34
0
    private void InstantiateBuildings(ref Rooms apartment)
    {
        int buildings_per_block = tiles_per_block * tiles_per_block - 2 * tiles_per_block + 1;
        int building_count      = buildings_per_block * block_count.x * block_count.y;
        var buildings           = manager.Instantiate(building, building_count, Allocator.Temp);

        var buildings_occupied = manager.Instantiate(
            building_occupied, building_count * rooms_per_apartment, Allocator.Temp);

        float marker_spacing           = 3f;
        int   occupied_markers_per_row = (int)((tile_size - 4f) / marker_spacing);

        int idx  = 0;
        int hash = 0;

        apartment.max_room_idx = 0;
        for (int x = 0; x < tile_count.x - tiles_per_block; x++)
        {
            for (int y = 0; y < tile_count.y - tiles_per_block; y++)
            {
                if (x % tiles_per_block > 0 && y % tiles_per_block > 0)
                {
                    var b = buildings[idx];

                    var scale = Random.Range(250, 750);

                    var T = new Translation();
                    T.Value = new Vector3(
                        x * tile_size + bounds.min.x,
                        scale / 200f,
                        y * tile_size + bounds.min.y);
                    manager.AddComponentData(b, T);

                    var S = new NonUniformScale();
                    S.Value = new Vector3(2500f, scale, 2500f);
                    manager.AddComponentData(b, S);

                    var cidx = Random.Range(0, building_colors.Length);

                    var color = new URPMaterialPropertyBaseColor()
                    {
                        Value = new float4(
                            building_colors[cidx].r,
                            building_colors[cidx].g,
                            building_colors[cidx].b,
                            building_colors[cidx].a)
                    };
                    manager.AddComponentData(b, color);

                    var data = new BuildingData()
                    {
                        type            = BuildingType.Apartment,
                        start_hash      = hash,
                        end_hash        = hash + rooms_per_apartment,
                        people_per_room = people_per_room_apartment
                    };
                    manager.AddComponentData(b, data);

                    for (int h = 0; h < rooms_per_apartment; h++)
                    {
                        var b_o = buildings_occupied[h + hash];

                        var T_o = new Translation()
                        {
                            Value = T.Value +
                                    new float3(tile_size / 2 - 3f, 0f, tile_size / 2 - 3f) -
                                    marker_spacing * new float3(
                                h % occupied_markers_per_row, 0f, (int)(h / occupied_markers_per_row))
                        };
                        manager.AddComponentData(b_o, T_o);

                        var color_o = new URPMaterialPropertyBaseColor()
                        {
                            Value = new float4(0f, 0f, 0f, 0f)
                        };
                        manager.AddComponentData(b_o, color_o);

                        var occ_data = new OccupiedData()
                        {
                            base_color = new float4(1f, 1f, 1f, 1f)
                        };
                        manager.AddComponentData(b_o, occ_data);

                        apartment.space[h + hash]       = rooms_per_apartment;
                        apartment.coordinates[h + hash] = new int2(x, y);

                        apartment.max_room_idx++;
                    }

                    hash += rooms_per_apartment;

                    idx++;
                }
            }
        }

        buildings.Dispose();
        buildings_occupied.Dispose();
    }
Пример #35
0
 public Room Find(string name)
 {
     return(Rooms.Find(x => x.Name == name));
 }
Пример #36
0
 public Office()
 {
     this.Rooms = new Rooms();
 }
Пример #37
0
        public VoiceReceiver(ISession session, IClientCollection <TPeer?> clients, EventQueue events, Rooms rooms, ConcurrentPool <byte[]> byteArrayPool, ConcurrentPool <List <RemoteChannel> > channelListPool)
        {
            _session         = session;
            _clients         = clients;
            _events          = events;
            _rooms           = rooms;
            _byteArrayPool   = byteArrayPool;
            _channelListPool = channelListPool;

            _events.OnEnqueuePlayerLeft += OnPlayerLeft;
        }
Пример #38
0
 //Remove Room
 public void RemoveRoom(Room room)
 {
     Rooms.Remove(room);
     SaveRooms();
 }
Пример #39
0
 //Add Room
 public void AddRoom(string rName)
 {
     Rooms.Add(new Room(rName));
     SaveRooms();
 }
Пример #40
0
 public PeerVoiceReceiver(string remoteName, ushort localId, string localName, EventQueue events, Rooms listeningRooms, ConcurrentPool <List <RemoteChannel> > channelListPool)
 {
     _name                = remoteName;
     _localId             = localId;
     _localName           = localName;
     _events              = events;
     _localListeningRooms = listeningRooms;
     _channelListPool     = channelListPool;
 }
        private void PopulateRoomDetailData(DateTime period, int clientId)
        {
            // gets either current or prior period data
            DataTable dtRoom = RoomBillingBL.GetRoomBillingDataByClientID(ContextBase, period, clientId);

            if (!dtRoom.Columns.Contains("IsParent"))
            {
                dtRoom.Columns.Add("IsParent", typeof(bool));
            }

            if (!dtRoom.Columns.Contains("ParentID"))
            {
                dtRoom.Columns.Add("ParentID", typeof(int));
            }

            if (!dtRoom.Columns.Contains("RowCssClass"))
            {
                dtRoom.Columns.Add("RowCssClass", typeof(string));
            }

            var rooms = CacheManager.Current.Rooms();

            foreach (DataRow dr in dtRoom.Rows)
            {
                var r = rooms.FirstOrDefault(x => x.RoomID == dr.Field <int>("RoomID"));

                if (r.ParentID.HasValue)
                {
                    dr.SetField("IsParent", false);
                    dr.SetField("ParentID", r.ParentID.Value);
                    dr.SetField("RowCssClass", "child");
                }
                else
                {
                    dr.SetField("IsParent", true);
                    dr.SetField("ParentID", r.RoomID);
                    dr.SetField("RowCssClass", "parent");
                }
            }

            dtRoom.DefaultView.Sort = "ParentID ASC, IsParent DESC, Room ASC";

            rptRoomDetail.DataSource = dtRoom.DefaultView;
            rptRoomDetail.DataBind();

            decimal totalCleanRoomHours = 0, totalWetChemHours = 0, totalTestLabHours = 0, totalOrganicsHours = 0, totalLnfHours = 0;

            foreach (DataRow dr in dtRoom.Rows)
            {
                LabRoom room = Rooms.GetRoom(dr.Field <int>("RoomID"));

                // Using Convert.ToDecimal because value might be decimal or double depending no if it is from RoomBilling or RoomBillingTemp
                decimal hours = Convert.ToDecimal(dr["Hours"]);

                if (room == LabRoom.CleanRoom)
                {
                    totalCleanRoomHours += hours;
                }
                else if (room == LabRoom.ChemRoom)
                {
                    totalWetChemHours += hours;
                }
                else if (room == LabRoom.TestLab)
                {
                    totalTestLabHours += hours;
                }
                else if (room == LabRoom.OrganicsBay)
                {
                    totalOrganicsHours += hours;
                }
                else if (room == LabRoom.LNF)
                {
                    totalLnfHours += hours;
                }
            }

            string lnfName = "LNF";
            string cleanRoomName = "Clean Room";
            string wetChemName   = "ROBIN";

            lblRoomHours.Text = $"|  {lnfName}: {totalLnfHours:#0.00} hours, {cleanRoomName}: {totalCleanRoomHours:#0.00} hours, {wetChemName}: {totalWetChemHours:#0.00} hours";

            lblRoomsSum.Text = string.Empty;
            if (dtRoom.Rows.Count > 0)
            {
                double totalRoomCharge = Convert.ToDouble(dtRoom.Compute("SUM(LineCost)", string.Empty));
                lblRoom.Text = string.Format("Total room usage fees: {0:$#,##0.00}", totalRoomCharge);
                UpdateRoomSums(dtRoom, lblRoomsSum);
            }
            else
            {
                lblRoom.Text = "No room usage in this period";
            }

            lblRoom.Visible = true;
        }
    protected void JoinRoom( ulong roomId, Message<Room>.Callback callback )
    {
        Debug.Log( "Joining room " + roomId );

        Rooms.Join( roomId, true ).OnComplete( callback );
    }
Пример #43
0
    private void InstantiatePeople(ref Rooms apartment)
    {
        var people = manager.Instantiate(person, person_count, Allocator.Temp);
        var seed   = new System.Random();

        for (int i = 0; i < person_count; i++)
        {
            Entity p     = people[i];
            Spawn  spawn = GetSpawnPoint();

            Vector3 pos = new Vector3(
                spawn.pos.x, 2.15f, spawn.pos.y);

            Translation R = new Translation();
            R.Value = pos;

            manager.AddComponentData(p, R);

            float virus    = 0f;
            bool  infected = false;

            int house_idx = -1;
            while (house_idx < 0)
            {
                house_idx = Random.Range(0, apartment.max_room_idx);
                if (apartment.space[house_idx] == 0)
                {
                    house_idx = -1;
                }
                else
                {
                    apartment.space[house_idx] -= 1;
                }
            }

            bool is_nightowl = Random.Range(0f, 1f) < 0.25f;

            PersonData person_data = new PersonData()
            {
                virus            = virus,
                infected         = infected,
                antibodies       = 0f,
                resistence       = false,
                home_coordinates = apartment.coordinates[house_idx],
                home_idx         = house_idx,
                is_home          = false,
                schedule_phase   = (is_nightowl ? 0 : 1) + Random.Range(-0.25f, 0.25f)
            };
            manager.AddComponentData(p, person_data);

            HeadingData heading_data = new HeadingData()
            {
                speed             = person_speed + Random.Range(-person_speed_spread, person_speed_spread),
                direction         = spawn.dir,
                goal_coordinate   = apartment.coordinates[house_idx],
                next_cross_margin = Random.Range(1f, 6f),
                rng = new Unity.Mathematics.Random((uint)seed.Next())
            };
            manager.AddComponentData(p, heading_data);

            URPMaterialPropertyBaseColor color = new URPMaterialPropertyBaseColor()
            {
                Value = new float4(1f, 1f, 1f, 1f)
            };
            manager.AddComponentData(p, color);
        }

        people.Dispose();
    }
    public void ChangeRoom(Rooms newRoom)
    {
        cameraInRoom = false;

        activeRoom = newRoom;
        switch (newRoom)
        {
        case Rooms.MainStage:
            cmrPos = new Vector2(0, 8);

            if (GameManager.bossDead_PharaohMan)
            {
                pharaohIcon.enabled = false;
            }
            else
            {
                pharaohIcon.enabled = true;
            }
            if (GameManager.bossDead_GeminiMan)
            {
                geminiIcon.enabled = false;
            }
            else
            {
                geminiIcon.enabled = true;
            }
            if (GameManager.bossDead_MetalMan)
            {
                metalIcon.enabled = false;
            }
            else
            {
                metalIcon.enabled = true;
            }
            if (GameManager.bossDead_StarMan)
            {
                starIcon.enabled = false;
            }
            else
            {
                starIcon.enabled = true;
            }
            if (GameManager.bossDead_BombMan)
            {
                bombIcon.enabled = false;
            }
            else
            {
                bombIcon.enabled = true;
            }
            if (GameManager.bossDead_WindMan)
            {
                windIcon.enabled = false;
            }
            else
            {
                windIcon.enabled = true;
            }
            if (GameManager.bossDead_GalaxyMan)
            {
                galaxyIcon.enabled = false;
            }
            else
            {
                galaxyIcon.enabled = true;
            }
            if (GameManager.bossDead_CommandoMan)
            {
                commandoIcon.enabled = false;
            }
            else
            {
                commandoIcon.enabled = true;
            }
            break;

        case Rooms.FortressStage:
            cmrPos = new Vector2(0, 248);
            break;

        case Rooms.Shop:
            cmrPos = new Vector2(-272, 8);

            for (int x = 0; x < 6; x++)
            {
                for (int z = 0; z < 2; z++)
                {
                    if (z * 6 + x >= itemCatalog.Length)
                    {
                        itemSlots[z * 6 + x].sprite = null;
                    }
                    else
                    {
                        GameObject item = Item.GetObjectFromItem(itemCatalog[(shopIndex.z + z) * 6 + x]);
                        if (item != null)
                        {
                            itemSlots[z * 6 + x].sprite = item.GetComponentInChildren <SpriteRenderer>().sprite;
                        }
                        else
                        {
                            itemSlots[z * 6 + x].sprite = null;
                        }
                    }
                }
            }
            break;

        case Rooms.Data:
            cmrPos = new Vector2(272, 8);
            break;
        }
    }
Пример #45
0
 public void AddRoom(Room room)
 {
     Rooms.Add(room);
 }
Пример #46
0
        public void BuildRooms()
        {
            Room room0  = new Room("Room 0", "A mishapen cavern mostly made of crude stonework, it does not appear to go anywhere...You start to regret ever trying to enter the Warrens. Exits: No obvious exits...wait, how did you get here?!");
            Room room1  = new Room("Room 1", "Spirals of green stones cover the floor, A circle of tall stones stands in the east side of the room. Exits: East 1, East 2, South 1, South 2.\n");
            Room room2  = new Room("Room 2", "An altar of evil sits in the center of the room. You notice a pile of iron spikes lies in the north side of the room. Exits: West 1, East 1, East 2.\n");
            Room room3  = new Room("Room 3", "Someone has scrawled \"Run Away!\" in goblin runes on the north wall, Several pieces of trash are also strewn about the room. Exits: West 1, East 1, East 2, East 3, South 1.\n");
            Room room4  = new Room("Room 4", "You immediately notice the ceiling is covered in cob webs. The words \"Don't Sleep\" are etched into the East wall. Exits: West 1, West 2, East 1, South 1.\n");
            Room room5  = new Room("Room 5", "A chute descends from the room into a midden chamber below, it is too small to fit through, not that you want to. The scent of urine fills the room. Exits: East 1, South 1.\n");
            Room room6  = new Room("Room 6", "This room lacks any discernable features. Exits: West 1, East 1.\n");
            Room room7  = new Room("Room 7", "A group of draconic faces have been carved into the South wall. Near your feet you notice the words \"Kunarv was here\". Exits: West 1, South 1.\n");
            Room room8  = new Room("Room 8", "Some small piles of stone rubble ornament the floor. Exits: North 1, West 1, East 1, East 2, South 1, South 2.\n");
            Room room9  = new Room("Room 9", "The floor is smooth, but the walls of this room appear to be less worked and rough. Exits: East 1, East 2.\n");
            Room room10 = new Room("Room 10", "Several iron cages are scattered throughout the room. A pile of torn paper lies in the north-west corner of the room. Exits: West 1, East 1.\n");
            Room room11 = new Room("Room 11", "Dark moss partially covers the walls, even the air feels rather damp. Exits: North 1, North 2, West 1, West 2.\n");
            Room room12 = new Room("Room 12", "Dimly lit, and longer than most of the rooms, this one almost appears to be a slightly larger hallway. Exits: West 1, West 2, South 1.\n");
            Room room13 = new Room("Room 13", "Corpses, too badly decayed to discern what they once were, lay randomly about the room. Exits: North 1, East 1, South 1, West 1.\n");
            Room room14 = new Room("Room 14", "A tile labyrinth covers the floor, intricately and deliberatly installed. A shatter sword lies in ruin in the north-west corner. Exits: North 1.\n");
            Room room15 = new Room("Room 15", "The floor is covered in mud. Several sundered shields lay scattered about. Exits: East 1, East 2, South 1.\n");
            Room room16 = new Room("Room 16", "A set of frightening demonic war masks hang on the east wall. A rotting carpet and a small table sit in the west side of the room. Exits: North 1, North 2.\n");
            Room room17 = new Room("Room 17", "Someone has scrawled \"Twist the cog to reset the trap\" in dwarvish runes on the north wall. A corroded chain lies in the northwest corner of the room. Exits: North 1, West 1, South 1.\n");
            Room room18 = new Room("Room 18", "A magical statue in the south-west corner of the room answers questions with insults, A group of demonic faces have been carved into the east wall. Exits: West 1, South 1.\n");
            Room room19 = new Room("Room 19", "Empty, other than small splinters of wood. Exits: North 1, West 1, East 1.\n");
            Room room20 = new Room("Room 20", "A stone sarcophagus sits in the south-east corner of the room, A cold spot can be felt in the west side of the room. Exits: North 1, West 1, South 1, South 2.\n");
            Room room21 = new Room("Room 21", "A fountain of water sits against the west wall, The sound of drums fills the room. Exits: North 1, North 2.\n");
            Room room22 = new Room("Room 22", "Ugly paintings adorn the wall, the materials they are made out of is questionable. Exits: North 1, North 2, East 1, East 2, East 3.\n");
            Room room23 = new Room("Room 23", "A plain room, with a rather high ceiling. Exits: North 1, West 1, East 1, South 1.\n");
            Room room24 = new Room("Room 24", "Small ornamental tapestries decorate the walls in an unorganized manner. Exits: North 1, West 1, East 1.\n");
            Room room25 = new Room("Room 25", "The floor is flaked with odd spots of rust. Exits: North 1, East 1, East 2, South 1, South 2.\n");
            Room room26 = new Room("Room 26", "Spirals of red stones cover the floor, Someone has scrawled a crude drawing of a succubus on the west wall. Exits: North 1, West 1, West 2, East 1, East 2.\n");
            Room room27 = new Room("Room 27", "A torn paper reads, \"Has anyone seen my invisible cloak?\", Several pieces of rotten rope are scattered throughout the room. Exits: North 1, West 1, East 1, East 2, South 1, South 2.\n");
            Room room28 = new Room("Room 28", "A set of brittle and corroded armor leans against the east wall. Exits: West 1, West 2, South 1, South 2.\n");
            Room room29 = new Room("Room 29", "A ruined siege weapon sits in the north-east corner of the room, etchings read, \"The Legion of the Ring looted this place\" in orcish runes on the east wall. Exits: West 1, West 2, East 1, South 1.\n");
            Room room30 = new Room("Room 30", "Various torture devices are scattered throughout the room, strange writing covers most of the east wall. Exits: West 1, East 1, East 2, East 3, South 1, South 2.\n");
            Room room31 = new Room("Room 31", "A narrow shaft descends from the room into a natural cavern below, A toppled statue lies in the north side of the room. Exits: West 1, East 1, East 2, South 1.\n");
            Room room32 = new Room("Room 32", "A simple wooden table and stuffed beast sit in the south-east corner of the room, The ceiling is covered with bloodstains. Exits: North 1, West 1.\n");
            Room room33 = new Room("Room 33", "A small spring bubbles up from the north corner of the room making most of the floor slick. Exits: North 1, West 1, East 1, South 1.\n");
            Room room34 = new Room("Room 34", "An upright sarcophagus leans against the west wall. Exits: North 1, West 1, South 1.\n");
            Room room35 = new Room("Room 35", "The floor is covered in square tiles, alternating white and black, \"It's a trap\" is scribbled in draconic script on the west wall. Exits: North 1, West 1, South 1.\n");
            Room room36 = new Room("Room 36", "A set of demonic war masks hangs on the east wall, A large kiln and coal bin sit in the south side of the room. Exits: North 1, West 1, West 2, East 1.\n");
            Room room37 = new Room("Room 37", "This room once had severl wood and iron doors, all of them now completely smashed about the room. Exits: North 1, West 1, West 2.\n");
            Room room38 = new Room("Room 38", "A stair ascends to a very unstable wooden platform in the east side of the room, A set of demonic war masks hangs on the east wall. Exits: North 1, East 1, South 1.\n");
            Room room39 = new Room("Room 39", "Lit candles are scattered across the floor, Someone has scrawled an arcane symbol on the east wall. Exits: North 1.\n");
            Room room40 = new Room("Room 40", "The south and west walls have been engraved with incoherent labyrinths, A shallow pool of oil lies in the east side of the room. Exits: North 1, West 1.\n");

            AddRooms();
            BuildExits();
            BuildItems();

            void AddRooms()
            {
                Rooms.Add(room0);
                Rooms.Add(room2);
                Rooms.Add(room3);
                Rooms.Add(room4);
                Rooms.Add(room5);
                Rooms.Add(room6);
                Rooms.Add(room7);
                Rooms.Add(room8);
                Rooms.Add(room9);
                Rooms.Add(room10);
                Rooms.Add(room11);
                Rooms.Add(room12);
                Rooms.Add(room13);
                Rooms.Add(room14);
                Rooms.Add(room15);
                Rooms.Add(room16);
                Rooms.Add(room17);
                Rooms.Add(room18);
                Rooms.Add(room19);
                Rooms.Add(room20);
                Rooms.Add(room21);
                Rooms.Add(room22);
                Rooms.Add(room23);
                Rooms.Add(room24);
                Rooms.Add(room25);
                Rooms.Add(room26);
                Rooms.Add(room27);
                Rooms.Add(room28);
                Rooms.Add(room29);
                Rooms.Add(room30);
                Rooms.Add(room31);
                Rooms.Add(room32);
                Rooms.Add(room33);
                Rooms.Add(room34);
                Rooms.Add(room35);
                Rooms.Add(room36);
                Rooms.Add(room37);
                Rooms.Add(room38);
                Rooms.Add(room39);
                Rooms.Add(room40);
            }

            void BuildExits()
            {
                room1.AddDoor("e1", room2);
                room1.AddDoor("e2", room7);
                room1.AddDoor("s1", room16);
                room1.AddDoor("s2", room9);
                room2.AddDoor("w1", room1);
                room2.AddDoor("e1", room3);
                room2.AddDoor("e2", room24);
                room3.AddDoor("w1", room2);
                room3.AddDoor("e1", room4);
                room3.AddDoor("e2", room6);
                room3.AddDoor("e3", room8);
                room3.AddDoor("s1", room14);
                room4.AddDoor("w1", room3);
                room4.AddDoor("w2", room6);
                room4.AddDoor("s1", room8);
                room4.AddDoor("e1", room8);
                room5.AddDoor("e1", room11);
                room5.AddDoor("s1", room11);
                room6.AddDoor("w1", room3);
                room6.AddDoor("e1", room4);
                room7.AddDoor("w1", room1);
                room7.AddDoor("s1", room17);
                room8.AddDoor("n1", room4);
                room8.AddDoor("w1", room3);
                room8.AddDoor("e1", room4);
                room8.AddDoor("e2", room10);
                room8.AddDoor("s1", room13);
                room8.AddDoor("s2", room13);
                room9.AddDoor("e1", room1);
                room9.AddDoor("e2", room12);
                room10.AddDoor("w1", room8);
                room10.AddDoor("e1", room11);
                room11.AddDoor("n1", room5);
                room11.AddDoor("n2", room5);
                room11.AddDoor("w1", room10);
                room11.AddDoor("w2", room15);
                room11.AddDoor("s1", room22);
                room12.AddDoor("w1", room9);
                room12.AddDoor("w2", room16);
                room12.AddDoor("s1", room19);
                room13.AddDoor("n1", room8);
                room13.AddDoor("e1", room8);
                room13.AddDoor("s1", room20);
                room13.AddDoor("w1", room21);
                room14.AddDoor("n1", room3);
                room15.AddDoor("e1", room11);
                room15.AddDoor("e2", room18);
                room15.AddDoor("s1", room22);
                room16.AddDoor("n1", room1);
                room16.AddDoor("n2", room12);
                room17.AddDoor("n1", room7);
                room17.AddDoor("w1", room19);
                room17.AddDoor("s1", room23);
                room18.AddDoor("e1", room15);
                room18.AddDoor("s1", room22);
                room19.AddDoor("n1", room12);
                room19.AddDoor("e1", room17);
                room19.AddDoor("w1", room25);
                room20.AddDoor("n1", room13);
                room20.AddDoor("s1", room26);
                room20.AddDoor("s2", room26);
                room20.AddDoor("w1", room21);
                room21.AddDoor("n1", room13);
                room21.AddDoor("n2", room20);
                room22.AddDoor("n1", room15);
                room22.AddDoor("n2", room18);
                room22.AddDoor("e1", room11);
                room22.AddDoor("e2", room37);
                room22.AddDoor("e3", room37);
                room23.AddDoor("n1", room17);
                room23.AddDoor("e1", room24);
                room23.AddDoor("w1", room25);
                room23.AddDoor("s1", room27);
                room24.AddDoor("n1", room2);
                room24.AddDoor("e1", room26);
                room24.AddDoor("w1", room23);
                room25.AddDoor("n1", room19);
                room25.AddDoor("e1", room23);
                room25.AddDoor("e2", room27);
                room25.AddDoor("s1", room31);
                room25.AddDoor("s2", room32);
                room26.AddDoor("n1", room20);
                room26.AddDoor("e1", room20);
                room26.AddDoor("e2", room28);
                room26.AddDoor("w1", room24);
                room26.AddDoor("w2", room27);
                room27.AddDoor("n1", room23);
                room27.AddDoor("e1", room26);
                room27.AddDoor("e2", room29);
                room27.AddDoor("s1", room31);
                room27.AddDoor("s2", room35);
                room27.AddDoor("w1", room25);
                room28.AddDoor("s1", room33);
                room28.AddDoor("s2", room34);
                room28.AddDoor("w1", room26);
                room28.AddDoor("w2", room30);
                room29.AddDoor("e1", room30);
                room29.AddDoor("s1", room39);
                room29.AddDoor("w1", room27);
                room29.AddDoor("w2", room35);
                room30.AddDoor("e1", room28);
                room30.AddDoor("e2", room33);
                room30.AddDoor("e3", room36);
                room30.AddDoor("s1", room40);
                room30.AddDoor("s2", room36);
                room30.AddDoor("w1", room29);
                room31.AddDoor("e1", room32);
                room31.AddDoor("e2", room27);
                room31.AddDoor("s1", room38);
                room31.AddDoor("w1", room25);
                room32.AddDoor("w1", room31);
                room32.AddDoor("n1", room25);
                room33.AddDoor("n1", room28);
                room33.AddDoor("e1", room34);
                room33.AddDoor("s1", room36);
                room33.AddDoor("w1", room30);
                room34.AddDoor("n1", room28);
                room34.AddDoor("w1", room33);
                room34.AddDoor("s1", room37);
                room35.AddDoor("n1", room29);
                room35.AddDoor("s1", room40);
                room35.AddDoor("w1", room38);
                room36.AddDoor("n1", room33);
                room36.AddDoor("e1", room37);
                room36.AddDoor("w1", room30);
                room36.AddDoor("w2", room30);
                room37.AddDoor("n1", room34);
                room37.AddDoor("w1", room36);
                room37.AddDoor("w2", room22);
                room38.AddDoor("n1", room31);
                room38.AddDoor("e1", room35);
                room38.AddDoor("s1", room35);
                room39.AddDoor("n1", room29);
                room40.AddDoor("n1", room30);
                room40.AddDoor("w1", room35);
            }

            void BuildItems()
            {
                Item rustySword = new Item("Sword", "A rusty old sword. Looks like it once was battle ready, but probably not anymore.");

                room0.Items.Add(rustySword);
                Item smallOrb = new Item("Orb", "A small orb, probably some kids marble, dang kids....always getting into chaos.");

                room0.Items.Add(smallOrb);
                Item taco = new Item("Taco", "A Delicious taco. Are you hungry?");

                room40.Items.Add(taco);
            }

            CurrentRoom = room0;
        }
Пример #47
0
        public void addRoom()
        {
            if (RoomType == "Private")
            {
                PrivateRoom newPrivateRoom = new PrivateRoom
                {
                    RoomNumber = int.Parse(RoomNumber),
                };
                Rooms.Add(
                    new RoomCardViewModel
                {
                    ID         = newPrivateRoom.ID,
                    RoomNumber = newPrivateRoom.RoomNumber,
                    Type       = "Private Room",
                    Capacity   = newPrivateRoom.Patients.Count.ToString() + '/' + newPrivateRoom.Capacity.ToString()
                }
                    );

                FilteredRooms.Add(
                    new RoomCardViewModel
                {
                    ID         = newPrivateRoom.ID,
                    RoomNumber = newPrivateRoom.RoomNumber,
                    Type       = "Private Room",
                    Capacity   = newPrivateRoom.Patients.Count.ToString() + '/' + newPrivateRoom.Capacity.ToString()
                }
                    );

                Hospital.Rooms.Add(newPrivateRoom.ID, newPrivateRoom);
                HospitalDB.InsertRoom(newPrivateRoom);
            }

            else if (RoomType == "Semi Private")
            {
                SemiPrivateRoom newSemiPrivateRoom = new SemiPrivateRoom
                {
                    RoomNumber = int.Parse(RoomNumber)
                };
                Rooms.Add(
                    new RoomCardViewModel
                {
                    ID         = newSemiPrivateRoom.ID,
                    RoomNumber = newSemiPrivateRoom.RoomNumber,
                    Type       = "Semi Private Room",
                    Capacity   = newSemiPrivateRoom.Patients.Count.ToString() + '/' + newSemiPrivateRoom.Capacity.ToString()
                }
                    );

                FilteredRooms.Add(
                    new RoomCardViewModel
                {
                    ID         = newSemiPrivateRoom.ID,
                    RoomNumber = newSemiPrivateRoom.RoomNumber,
                    Type       = "Semi Private Room",
                    Capacity   = newSemiPrivateRoom.Patients.Count.ToString() + '/' + newSemiPrivateRoom.Capacity.ToString()
                }
                    );

                Hospital.Rooms.Add(newSemiPrivateRoom.ID, newSemiPrivateRoom);
                HospitalDB.InsertRoom(newSemiPrivateRoom);
            }

            else if (RoomType == "Standard Ward")
            {
                StandardWard newStandardWardRoom = new StandardWard
                {
                    RoomNumber = int.Parse(RoomNumber)
                };
                Rooms.Add(
                    new RoomCardViewModel
                {
                    ID         = newStandardWardRoom.ID,
                    RoomNumber = newStandardWardRoom.RoomNumber,
                    Type       = "StandardWard Room",
                    Capacity   = newStandardWardRoom.Patients.Count.ToString() + '/' + newStandardWardRoom.Capacity.ToString()
                }
                    );

                FilteredRooms.Add(
                    new RoomCardViewModel
                {
                    ID         = newStandardWardRoom.ID,
                    RoomNumber = newStandardWardRoom.RoomNumber,
                    Type       = "StandardWard Room",
                    Capacity   = newStandardWardRoom.Patients.Count.ToString() + '/' + newStandardWardRoom.Capacity.ToString()
                }
                    );

                Hospital.Rooms.Add(newStandardWardRoom.ID, newStandardWardRoom);
                HospitalDB.InsertRoom(newStandardWardRoom);
            }
        }
Пример #48
0
 public bool HasRoom(string gameName)
 {
     return(Rooms.Where(r => r.Key == gameName).Any());
 }
Пример #49
0
 public void ClearContext()
 {
     Rooms.Clear();
     Users.Clear();
     Devices.Clear();
 }
Пример #50
0
        public void Generator()
        {
            //Console.WriteLine("Loading, Please Wait");
            Objects.Clear();
            //int GeneratorPos_x = rnd.Next(0, LevelLength);
            //int GeneratorPos_y = rnd.Next(0, LevelLength);
            int GeneratorPos_x = LevelLength / 2;
            int GeneratorPos_y = LevelLength / 2;
            // Variable Floors determines how many floor elements there are:
            int Floors = 0;

            // We cover the whole level with walls (stones or whatever is under the ground):
            for (int l = 0; l < LevelLength; l++)
            {
                for (int w = 0; w < LevelLength; w++)
                {
                    Objects.Add(new Wall()
                    {
                        Position_x = l, Position_y = w
                    });
                }
            }
            // Than we add single floor elements until 80% of the level is floor
            while (Floors < Objects.Count * 0.8)
            {
                int newPos_x = 0;
                int newPos_y = 0;
                // Determine the next position:
                int k = rnd.Next(0, 4);
                //
Up:
                if (k == 0)
                {
                    newPos_x = GeneratorPos_x;
                    newPos_y = GeneratorPos_y - 1;
                }
                // Move Down:
                if (k == 1)
                {
                    newPos_x = GeneratorPos_x;
                    newPos_y = GeneratorPos_y + 1;
                }
                // Move Right:
                if (k == 2)
                {
                    newPos_x = GeneratorPos_x + 1;
                    newPos_y = GeneratorPos_y;
                }
                // Move Left:
                if (k == 3)
                {
                    newPos_x = GeneratorPos_x - 1;
                    newPos_y = GeneratorPos_y;
                }

                if (LevelLength - newPos_x < 28 || newPos_x < 28 || LevelLength - newPos_y < 28 || newPos_y < 28)
                {
                    continue;
                }

                // Check if there is a room:
                bool roomCheck = false;
                foreach (Room room in Rooms)
                {
                    if (room.Objects.Any(x => (x.Position_x == newPos_x && x.Position_y == newPos_y)))
                    {
                        roomCheck = true;
                        break;
                    }
                }

                if (roomCheck)
                {
                    continue;
                }

                k = rnd.Next(0, 11);
                // Generate floor
                if (k < 11)
                {
                    if (PutFloor(newPos_x, newPos_y))
                    {
                        GeneratorPos_x = newPos_x;
                        GeneratorPos_y = newPos_y;
                        Floors++;
                    }
                }
            }

            // Generating from 9 to 23 rooms:

            List <LevelObject> floors = Objects.FindAll(x => x.GetType() == (new Floor()).GetType());

            for (int i = 0; i < rnd.Next(9, 24);)
            {
                LevelObject floorToChange = floors[rnd.Next(0, floors.Count)];
                if (floorToChange.Position_x > 22 && floorToChange.Position_y > 22 && LevelLength - floorToChange.Position_x > 22 && LevelLength - floorToChange.Position_y > 22)
                {
                    // Check if the is no evident way to the first door:
                    if (Objects.Find(obj => (obj.Position_x == floorToChange.Position_x + 1 && obj.Position_y == floorToChange.Position_y)).GetType() == (new Wall()).GetType())
                    {
                        continue;
                    }
                    if (Objects.Find(obj => (obj.Position_x == floorToChange.Position_x - 1 && obj.Position_y == floorToChange.Position_y)).GetType() == (new Wall()).GetType())
                    {
                        continue;
                    }
                    if (Objects.Find(obj => (obj.Position_x == floorToChange.Position_x && obj.Position_y == floorToChange.Position_y + 1)).GetType() == (new Wall()).GetType())
                    {
                        continue;
                    }
                    if (Objects.Find(obj => (obj.Position_x == floorToChange.Position_x && obj.Position_y == floorToChange.Position_y - 1)).GetType() == (new Wall()).GetType())
                    {
                        continue;
                    }
                    Room room = GenRoom(floorToChange.Position_x, floorToChange.Position_y);
                    if (!floors.Any(x => x.Position_x == room.D2_Pos_x && x.Position_y == room.D2_Pos_y))
                    {
                        continue;
                    }
                    // Check if it intersects with an existing room:
                    bool cont = false;
                    foreach (Room room_to_check in Rooms)
                    {
                        foreach (LevelObject obj in room_to_check.Objects)
                        {
                            if (room.Objects.Any(x => x.Position_x == obj.Position_x && x.Position_y == obj.Position_y))
                            {
                                cont = true;
                                break;
                            }
                        }
                        if (cont)
                        {
                            break;
                        }
                    }

                    // Check if the second door leads to nowhere:
                    if (Objects.Find(obj => (obj.Position_x == room.D2_Pos_x + 1 && obj.Position_y == room.D2_Pos_y)).GetType() == (new Wall()).GetType())
                    {
                        cont = true;
                    }
                    if (Objects.Find(obj => (obj.Position_x == room.D2_Pos_x - 1 && obj.Position_y == room.D2_Pos_y)).GetType() == (new Wall()).GetType())
                    {
                        cont = true;
                    }
                    if (Objects.Find(obj => (obj.Position_x == room.D2_Pos_x && obj.Position_y == room.D2_Pos_y + 1)).GetType() == (new Wall()).GetType())
                    {
                        cont = true;
                    }
                    if (Objects.Find(obj => (obj.Position_x == room.D2_Pos_x && obj.Position_y == room.D2_Pos_y - 1)).GetType() == (new Wall()).GetType())
                    {
                        cont = true;
                    }

                    if (cont)
                    {
                        continue;
                    }


                    Rooms.Add(room);
                    foreach (LevelObject obj in room.Objects)
                    {
                        Objects.RemoveAll(x => x.Position_x == obj.Position_x && x.Position_y == obj.Position_y);
                        Objects.Add(obj);
                    }
                    i++;
                }
                else
                {
                    continue;
                }
            }
        }
Пример #51
0
 public Room FindRoom(string gameName)
 {
     return(Rooms.Where(r => r.Key == gameName).FirstOrDefault().Value);
 }
Пример #52
0
 public List <Room> GetAvailableRooms(DateTime arrival, DateTime departure)
 {
     return(Rooms.FindAll(room => room.Reservations.All(res => res.Departure <= arrival || res.Arrival >= departure)));
 }
Пример #53
0
        /// <summary>
        /// initialize the Castle with all of the rooms
        /// </summary>
        private void IntializeCastleRooms()
        {
            Rooms.Add(new Room
            {
                Name        = "Apothecary",
                RoomID      = 1,
                Description = Environment.NewLine + "\t" + "If a remedy is what you seek, " + Environment.NewLine +
                              "\t" + "For aching joints, wounds or disease; " + Environment.NewLine +
                              "\t" + "To the apothecary go, " + Environment.NewLine +
                              "\t" + "You'll get no promises though; " + Environment.NewLine +
                              "\t" + "A potion, paste, or powder we'll give, " + Environment.NewLine +
                              "\t" + "You'll have a 50/50 chance to live.",
                Accessible = true
            });

            Rooms.Add(new Room
            {
                Name        = "Armory",
                RoomID      = 2,
                Description = Environment.NewLine + "\t" + "When the sounds of war call your name, " + Environment.NewLine +
                              "\t" + "The armory will give you fame. " + Environment.NewLine +
                              "\t" + "From sword and shield and mace to boot, " + Environment.NewLine +
                              "\t" + "To truest arrows in flight to shoot. " + Environment.NewLine +
                              "\t" + "We'll gladly provide all you need, " + Environment.NewLine +
                              "\t" + "To protect yourself, squire and steed.",
                Accessible = true
            });

            Rooms.Add(new Room
            {
                Name        = "Dungeon",
                RoomID      = 3,
                Description = Environment.NewLine + "\t" + "A place where all men loathe to dwell, " + Environment.NewLine +
                              "\t" + "Our dungeon master invokes a yell; " + Environment.NewLine +
                              "\t" + "A moan, a scream, a tear to eye, " + Environment.NewLine +
                              "\t" + "A pain so deep you'll plead to die. " + Environment.NewLine +
                              "\t" + "Sympathy here you will not find; " + Environment.NewLine +
                              "\t" + "Only manic peace as you lose your mind.",
                Accessible = true
            });
            Rooms.Add(new Room
            {
                Name        = "Kitchen",
                RoomID      = 4,
                Description = Environment.NewLine + "\t" + "The castle kitchen is always bustling, " + Environment.NewLine +
                              "\t" + "With servants, bakers, and cooks all hustling. " + Environment.NewLine +
                              "\t" + "Preparing a feast for king so great, " + Environment.NewLine +
                              "\t" + "Of delightful delicacies filling your plate. " + Environment.NewLine +
                              "\t" + "Of delightful delicacies filling your plate. " + Environment.NewLine +
                              "\t" + "Stag, veal, chicken, and a whole roe-deer, " + Environment.NewLine +
                              "\t" + "Hare, goat, and pig, hurrah, give a cheer! " + Environment.NewLine +
                              "\t" + "For cheese, bread, and wine, to make the guests merry; " + Environment.NewLine +
                              "\t" + "For sugar-plums, pies, and rich cream with sweet berries. " + Environment.NewLine +
                              "\t" + "So come to the kitchen our food here is grand, " + Environment.NewLine +
                              "\t" + "But don't take without asking or you may lose a hand! ",
                Accessible = true
            });
            Rooms.Add(new Room
            {
                Name        = "Stable",
                RoomID      = 5,
                Description = Environment.NewLine + "\t" + "The mighty destrier tall, majestic, and strong; " + Environment.NewLine +
                              "\t" + "The light and swift coursers when the battle is long. " + Environment.NewLine +
                              "\t" + " The all-purpose rouncey is always just right, " + Environment.NewLine +
                              "\t" + "To be used by a squire, men-at-arms, and poor knights. " + Environment.NewLine +
                              "\t" + "The palfrey for nobles and great knights was the trait, " + Environment.NewLine +
                              "\t" + "Because ambling was a comfortable, smooth-flowing gait. " + Environment.NewLine +
                              "\t" + "The hobby a lightweight reaching less than five feet, " + Environment.NewLine +
                              "\t" + "Was perfect for skirmishing with its fast agile feet. " + Environment.NewLine +
                              "\t" + "So come visit the stable it's a glorious sight, " + Environment.NewLine +
                              "\t" + "But please watch your step lest you slip in some s***e. ",
                Accessible = true
            });
            Rooms.Add(new Room
            {
                Name        = "Tower",
                RoomID      = 6,
                Description = Environment.NewLine + "\t" + "The tower's a mystery in the heavens above, " + Environment.NewLine +
                              "\t" + "Some go to share secrets, some go to share love. " + Environment.NewLine +
                              "\t" + "But for those who journey up its long winding stair, " + Environment.NewLine +
                              "\t" + "Will surely uncover the treasure that's there. ",
                Accessible = true
            });
            Rooms.Add(new Room
            {
                Name        = "Hidden Room",
                RoomID      = -1,
                Description = " ",
                Accessible  = false
            });
        }
Пример #54
0
 public Room GetByNumber(int number)
 {
     return(Rooms.First(room => room.RoomNumber == number));
 }
Пример #55
0
        /// <summary>
        /// Attempts to place a Room perimeter on the next open segment of the Row, with optional restrictions of a perimeter within which the Room's perimeter must fit and a list of Polygons which it cannot intersect.
        /// </summary>
        /// <param name="room">The Room from which to derive the Polygon to place.</param>
        /// <param name="within">The optional Polygon perimeter within which a new Room must fit.</param>
        /// <param name="among">The optional list of Polygon perimeters the new Room cannot intersect.</param>
        /// <param name="circ">The optional additional allowance opposite the Row to allow for circulation to the Rooms.</param>
        /// <returns>
        /// True if the room was successfully placed.
        /// </returns>
        public bool AddRoom(Room room, Polygon within = null, IList <Polygon> among = null, double circ = 2.0)
        {
            if (room == null)
            {
                return(false);
            }
            circ = Math.Abs(circ);
            var polygon   = room.MakePerimeter();
            var box       = new TopoBox(polygon);
            var delta     = 0.0;
            var newDepth  = 0.0;
            var circDepth = 0.0;
            var rotation  = angle;

            if (box.SizeX <= AvailableLength)
            {
                delta     = box.SizeX;
                newDepth  = box.SizeY;
                circDepth = box.SizeY + circ;
            }
            else if (box.SizeY <= AvailableLength)
            {
                polygon   = polygon.MoveFromTo(box.NW, box.SW);
                delta     = box.SizeY;
                newDepth  = box.SizeX;
                circDepth = box.SizeX + circ;
                rotation += 90;
            }
            else
            {
                return(false);
            }
            var t = new Transform();

            t.Rotate(Vector3.ZAxis, rotation);
            var chkCirc =
                new Polygon(
                    new []
            {
                new Vector3(),
                new Vector3(delta, 0.0),
                new Vector3(delta, circDepth),
                new Vector3(0.0, circDepth)
            });

            chkCirc = t.OfPolygon(chkCirc).MoveFromTo(new Vector3(), mark);
            if (!chkCirc.Fits(within, among))
            {
                if (Rooms.Count == 0)
                {
                    mark = Row.PointAt(Math.Abs(mark.DistanceTo(Row.Start) + delta) / Row.Length());
                }
                return(false);
            }
            polygon = t.OfPolygon(polygon).MoveFromTo(new Vector3(), mark);
            if (!polygon.Fits(within, among))
            {
                if (Rooms.Count == 0)
                {
                    mark = Row.PointAt(Math.Abs(mark.DistanceTo(Row.Start) + delta) / Row.Length());
                }
                return(false);
            }
            mark = Row.PointAt(Math.Abs(mark.DistanceTo(Row.Start) + delta) / Row.Length());
            if (newDepth > Depth)
            {
                Depth = newDepth;
            }
            var dpt   = Depth + circ;
            var line1 = new Line(box.SW, new Vector3(0.0, dpt));

            line1 = line1.Rotate(box.SW, rotation).MoveFromTo(new Vector3(), Row.Start);
            var line2 = new Line(box.SW, new Vector3(0.0, dpt));

            line2          = line2.Rotate(box.SW, rotation).MoveFromTo(new Vector3(), mark);
            circulation    = new Polygon(new [] { Row.Start, mark, line2.End, line1.End });
            room.Perimeter = polygon;
            Rooms.Add(room);
            return(true);
        }
Пример #56
0
        public override void Login(string Username, string Password, string twofa)
        {
            try
            {
                /*ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                 | SecurityProtocolType.Tls11
                 | SecurityProtocolType.Tls12
                 | SecurityProtocolType.Ssl3;*/
                cookies      = new CookieContainer();
                ClientHandlr = new HttpClientHandler
                {
                    UseCookies             = true,
                    CookieContainer        = cookies,
                    AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip,
                    Proxy    = (IWebProxy)this.Prox,
                    UseProxy = this.Prox != null
                };
                WebClient = new HttpClient(ClientHandlr)
                {
                    BaseAddress = new Uri("https://fortunejack.com/")
                };
                WebClient.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
                WebClient.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
                WebClient.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("br"));
                WebClient.DefaultRequestHeaders.Host = "fortunejack.com";
                WebClient.DefaultRequestHeaders.Add("Origin", "https://fortunejack.com");
                WebClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0");
                string tmps = json.ToDateString(DateTime.UtcNow);

                /*HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://fortunejack.com/");
                 *  if (Prox != null)
                 *      betrequest.Proxy = Prox;
                 *  betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                 *  betrequest.CookieContainer = Cookies;
                 * HttpWebResponse EmitResponse;*/
                string s1 = "";
                try
                {
                    HttpResponseMessage resp = WebClient.GetAsync("").Result;
                    if (resp.IsSuccessStatusCode)
                    {
                        s1 = resp.Content.ReadAsStringAsync().Result;
                    }
                    else
                    {
                        if (resp.StatusCode == HttpStatusCode.ServiceUnavailable)
                        {
                            s1 = resp.Content.ReadAsStringAsync().Result;
                            //cflevel = 0;
                            System.Threading.Tasks.Task.Factory.StartNew(() =>
                            {
                                System.Windows.Forms.MessageBox.Show("fortunejack.com has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                            });
                            if (!Cloudflare.doCFThing(s1, WebClient, ClientHandlr, 0, "fortunejack.com"))
                            {
                                finishedlogin(false);
                                return;
                            }
                        }
                    }
                }
                catch (AggregateException e)
                {
                    finishedlogin(false);
                    return;
                }
                Cookie c = new Cookie();
                foreach (Cookie tc in ClientHandlr.CookieContainer.GetCookies(new Uri("https://fortunejack.com")))
                {
                    if (tc.Name == "__cfduid")
                    {
                        c = tc;
                        break;
                    }
                }

                /*betrequest = (HttpWebRequest)HttpWebRequest.Create("https://fortunejack.com/");
                *  if (Prox != null)
                *   betrequest.Proxy = Prox;
                *  betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                *  betrequest.CookieContainer = Cookies;
                *
                *  EmitResponse = (HttpWebResponse)betrequest.GetResponse();
                *  sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd();*/
                HttpResponseMessage resp1 = WebClient.GetAsync("").Result;
                if (resp1.IsSuccessStatusCode)
                {
                    s1 = resp1.Content.ReadAsStringAsync().Result;
                }
                else
                {
                    if (resp1.StatusCode == HttpStatusCode.Forbidden)
                    {
                        s1 = resp1.Content.ReadAsStringAsync().Result;
                        //cflevel = 0;
                        System.Threading.Tasks.Task.Factory.StartNew(() =>
                        {
                            System.Windows.Forms.MessageBox.Show("fortunejack.com has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                        });
                        if (!Cloudflare.doCFThing(s1, WebClient, ClientHandlr, 0, "fortunejack.com"))
                        {
                            finishedlogin(false);
                            return;
                        }
                    }
                }
                string           phpsess = "";
                CookieCollection tmp     = ClientHandlr.CookieContainer.GetCookies(new Uri("https://fortunejack.com"));
                List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();
                FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
                string sEmitResponse          = WebClient.PostAsync("ajax/time.php", Content).Result.Content.ReadAsStringAsync().Result;
                //https://fortunejack.com/ajax/gamesSearch.php
                pairs         = new List <KeyValuePair <string, string> >();
                Content       = new FormUrlEncodedContent(pairs);
                sEmitResponse = WebClient.PostAsync("ajax/gamesSearch.php", Content).Result.Content.ReadAsStringAsync().Result;

                pairs         = new List <KeyValuePair <string, string> >();
                Content       = new FormUrlEncodedContent(pairs);
                sEmitResponse = WebClient.PostAsync("ajax/time.php", Content).Result.Content.ReadAsStringAsync().Result;


                tmp = ClientHandlr.CookieContainer.GetCookies(new Uri("https://fortunejack.com"));

                pairs = new List <KeyValuePair <string, string> >();
                pairs.Add(new KeyValuePair <string, string>("logName", Username));
                pairs.Add(new KeyValuePair <string, string>("logPassword", Password));
                //1456046111067
                pairs.Add(new KeyValuePair <string, string>("nocache", tmps));
                WebClient.DefaultRequestHeaders.Add("X-Requested-With", "XMLHttpRequest");

                Content = new FormUrlEncodedContent(pairs);

                try
                {
                    sEmitResponse = WebClient.PostAsync("ajax/login.php", Content).Result.Content.ReadAsStringAsync().Result;
                    if (!sEmitResponse.Contains("success"))
                    {
                        finishedlogin(false); return;
                    }
                }
                catch (AggregateException e)
                { finishedlogin(false); return; }

                sEmitResponse = WebClient.GetStringAsync("user.php").Result;
                sEmitResponse = WebClient.GetStringAsync("games/dice/").Result;
                GetChatToken(sEmitResponse);
                pairs   = new List <KeyValuePair <string, string> >();
                Content = new FormUrlEncodedContent(pairs);
                KeepAlive();
                sEmitResponse = WebClient.PostAsync("ajax/time.php", Content).Result.Content.ReadAsStringAsync().Result;
                sEmitResponse = WebClient.GetStringAsync("api/dice4/diceutils.php?act=rooms").Result;
                try
                {
                    FJCurrency[] tmpCurs = json.JsonDeserialize <FJCurrency[]>(sEmitResponse);
                    foreach (FJCurrency tc in tmpCurs)
                    {
                        Curs.Add(tc.currency_name.ToLower(), tc.currency_id);
                        Rooms.Add(tc.currency_name.ToLower(), tc.room_id);
                    }
                }
                catch
                { finishedlogin(false); return; }
                //get stats
                try
                {
                    string   stats     = WebClient.GetStringAsync("api/dice3/utils.php?stats&rnd=" + R.Next(0, int.MaxValue)).Result;
                    string[] StatsVals = stats.Split('|');
                    wagered = decimal.Parse(StatsVals[0], System.Globalization.NumberFormatInfo.InvariantInfo);
                    profit  = decimal.Parse(StatsVals[1], System.Globalization.NumberFormatInfo.InvariantInfo);
                    bets    = int.Parse(StatsVals[2], System.Globalization.NumberFormatInfo.InvariantInfo);
                    wins    = int.Parse(StatsVals[3], System.Globalization.NumberFormatInfo.InvariantInfo);
                    losses  = int.Parse(StatsVals[4], System.Globalization.NumberFormatInfo.InvariantInfo);
                }
                catch
                {
                    finishedlogin(false);
                    return;
                }


                StartSocket();
                while (Client.State == WebSocketState.Connecting)
                {
                    Thread.Sleep(100);
                }
                IsFJ = true;
                new Thread(new ThreadStart(KeepAliveThread)).Start();
                finishedlogin(true);
                IsLoggedIn = true;
                return;
                //Client.Send("67,2");
            }
            catch (AggregateException e)
            {
                finishedlogin(false);
                return;
            }
            finishedlogin(false);
            return;
        }
Пример #57
0
 public void AddRoom(Room room)
 {
     Rooms.Add(room);
     SaveRooms();
 }
Пример #58
0
        internal void DoAlignment1(int max_slot, int nepoch, int niter, double tconst, int[,] slotevent)
        {
            Chart chart      = (Chart)form.GetControl("グラフ");
            Label countlabel = (Label)form.GetControl("重複数");

            Check_DB_is_not_open();
            // 部屋を準備
            rooms = new Rooms(max_slot);
            var all_room = new List <Room>();

            foreach (var room_name in excel2DB.DB.EachRoom())
            {
                all_room.Add(rooms.AddRoom(room_name));
            }
            // 不都合日程の部屋
            var p_room = rooms.AddRoom("不都合日程");

            p_room.unchangable();
            all_room.Add(p_room);
            // すべてのイベントを部屋に割り当てる
            int n_event = excel2DB.DB.EventCount();
            var pool    = new AttendeePool();
            var room_no = new int[max_slot];

            for (int i = 0; i < max_slot; i++)
            {
                room_no[i] = 0;
            }
            int max_room = all_room.Count - 1;

            for (int event_id = 0; event_id < n_event; event_id++)
            {
                bool event_allocated = false;
                for (int slot = 0; slot < max_slot; slot++)
                {
                    if (room_no[slot] == max_room)
                    {
                        continue;
                    }
                    if (slotevent[slot, event_id] == 1)
                    {
                        DefenseEvent d_ev = excel2DB.DB.GetEvent(event_id + 1);
                        var          ev   = new Event(d_ev.Student_No);
                        for (int i = 0; i < 5; i++)
                        {
                            if (d_ev.Referee_id[i] != -1)
                            {
                                ev.Attendees.Add(pool.Get(excel2DB.DB.GetProfessorName(d_ev.Referee_id[i])));
                            }
                        }
                        all_room[room_no[slot]].addEvent(ev, slot);
                        room_no[slot]++;
                        event_allocated = true;
                        break;
                    }
                }
                if (!event_allocated)
                {
                    MessageBox.Show("審査" + event_id.ToString() + "が割り当てられませんでした", "Impossible",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
            }
            // 不都合日程割り当て
            for (int slot = 0; slot < max_slot; slot++)
            {
                var ev = new Event("不都合" + slot.ToString());
                foreach (var prof_id in excel2DB.DB.GetProhibitProfs(slot + 1))
                {
                    var name = excel2DB.DB.GetProfessorName(prof_id);
                    ev.Attendees.Add(pool.Get(name));
                }
                p_room.addEvent(ev);
            }

            // ここから本番
            void callbacklinear(int epoch, int iter, double lossval, int losscount)
            {
                series.Points.AddXY(epoch * niter + iter, lossval);
                chart.Update();
                countlabel.Text = losscount.ToString();
                countlabel.Refresh();
            }

            double inittemp = 50.0;

            for (int failiter = 0; failiter < 3; failiter++)
            {
                series = new Series();
                //chart.ChartAreas.First().AxisX.IsLogarithmic = true;
                chart.Series.Add(series);
                // 全ルームの全スロットで入れ替え
                rooms.anneal(inittemp, nepoch, niter, tconst, pool.maxid + 1, callbacklinear, false);
                chart.Series.Clear();
                // 重複解消できたか
                if (countlabel.Text == "")
                {
                    break;
                }
                inittemp /= 10;
            }
            // 全ルームの同スロットで入れ替え
            double inittemp2 = 0.1;

            series = new Series();
            chart.Series.Add(series);

            rooms.anneal(inittemp2, nepoch, niter, tconst, pool.maxid + 1, callbacklinear, true);
            string resultfilename = Program.GetFilename("output.csv", "Text CSV (*.csv)|*.csv|All files(*.*)|*.*");

            if (resultfilename == null)
            {
                MessageBox.Show("中止しました", "Aborted",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }
            OutputResult(resultfilename, "<?xml version = \"1.0\" encoding = \"UTF-8\" ?>" + rooms.ToString());
        }
Пример #59
0
        /// <summary>
        /// Write out a client state packet. Mutate this writer to represent the position after the write.
        /// </summary>
        /// <param name="session"></param>
        /// <param name="clientId"></param>
        /// <param name="rooms">Rooms state of the local player</param>
        /// <param name="name">Name of the local player</param>
        /// <returns>A copy of this writer (after the write has been applied)</returns>
        public PacketWriter WriteClientState(uint session, [NotNull] string name, ushort clientId, [NotNull] Rooms rooms)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name", "Attempted to serialize ClientState with a null name");
            }
            if (rooms == null)
            {
                throw new ArgumentNullException("rooms");
            }

            WriteMagic();
            Write((byte)MessageTypes.ClientState);
            Write(session);

            //Write out ID of this client
            Write(name);
            Write(clientId);

            //Write out the rooms this client is listening to
            Write((ushort)rooms.Count);
            for (var i = 0; i < rooms.Count; i++)
            {
                Write(rooms[i].RoomName);
            }

            return(this);
        }
Пример #60
0
        internal void DoAlignment(int max_slot, int nepoch, int niter, double tconst)
        {
            Chart chart      = (Chart)form.GetControl("グラフ");
            Label countlabel = (Label)form.GetControl("重複数");

            Check_DB_is_not_open();
            // 部屋を準備
            rooms = new Rooms(max_slot);
            var all_room = new List <Room>();

            foreach (var room_name in excel2DB.DB.EachRoom())
            {
                all_room.Add(rooms.AddRoom(room_name));
            }
            // 不都合日程の部屋
            var p_room = rooms.AddRoom("不都合日程");

            p_room.unchangable();
            all_room.Add(p_room);
            // 部屋が使えない日時を設定
            foreach (var t in excel2DB.DB.EachProhibitRoom())
            {
                var room_id = t.Item1;
                var slot    = t.Item2;
                all_room[room_id - 1].events[slot - 1] = Event.Prohibit;
            }
            // すべてのイベントを適当に部屋に割り当てる
            int room_no = 0;
            var pool    = new AttendeePool();

            foreach (var event_str in excel2DB.DB.EachEventString())
            {
                var ev = new Event(event_str[1]); //学籍番号
                for (int i = 5; i < 10; i++)
                {
                    if (event_str[i] != "")
                    {
                        ev.Attendees.Add(pool.Get(event_str[i]));
                    }
                }
                try
                {
                    all_room[room_no].addEvent(ev);
                } catch
                {
                    room_no++;
                    if (!all_room[room_no].changable)
                    {
                        throw new Exception("イベントが多すぎます");
                    }
                    all_room[room_no].addEvent(ev);
                }
            }
            // 不都合日程割り当て
            for (int slot = 0; slot < max_slot; slot++)
            {
                var ev = new Event("不都合" + slot.ToString());
                foreach (var prof_id in excel2DB.DB.GetProhibitProfs(slot + 1))
                {
                    var name = excel2DB.DB.GetProfessorName(prof_id);
                    ev.Attendees.Add(pool.Get(name));
                }
                p_room.addEvent(ev);
            }
            // テスト用
            //rooms.shuffle(1000);

            // ここから本番
            void callbacklinear(int epoch, int iter, double lossval, int losscount)
            {
                int n = epoch * niter + iter;

                series.Points.AddXY(n, lossval);
                chart.Update();
                countlabel.Text = losscount.ToString();
                countlabel.Refresh();
                form.SetIterNum(n);
            }

            double inittemp = 50.0;

            for (int failiter = 0; failiter < 3; failiter++)
            {
                series = new Series();
                //chart.ChartAreas.First().AxisX.IsLogarithmic = true;
                chart.Series.Add(series);
                // 全ルームの全スロットで入れ替え
                rooms.anneal(inittemp, nepoch, niter, tconst, pool.maxid + 1, callbacklinear, false);
                chart.Series.Clear();
                // 重複解消できたか
                if (countlabel.Text == "0")
                {
                    break;
                }
                inittemp /= 10;
            }
            // 全ルームの同スロットで入れ替え
            double inittemp2 = 0.1;

            series = new Series();
            chart.Series.Add(series);

            rooms.anneal(inittemp2, nepoch, niter, tconst, pool.maxid + 1, callbacklinear, true);

            string resultfilename = Program.GetFilename("output.csv", "Text CSV (*.csv)|*.csv|All files(*.*)|*.*");

            if (resultfilename == null)
            {
                MessageBox.Show("中止しました", "Aborted",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }
            OutputResult(resultfilename, "<?xml version = \"1.0\" encoding = \"UTF-8\" ?>" + rooms.ToString());
            //OutputResult("output.csv", "<?xml version = \"1.0\" encoding = \"UTF-8\" ?>"+rooms.ToString());
            string listfilename = Program.GetFilename("alllist.csv", "Text CSV (*.csv)|*.csv|All files(*.*)|*.*");

            if (resultfilename == null)
            {
                MessageBox.Show("中止しました", "Aborted",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }
            excel2DB.DB.WriteProfDefenseList(listfilename);
        }