Пример #1
0
 internal void QueueUpdateEvent(RoomData data)
 {
     lock (updateQueue.SyncRoot)
     {
         updateQueue.Enqueue(data);
     }
 }
Пример #2
0
 internal void QueueAddEvent(RoomData data)
 {
     lock (addQueue.SyncRoot)
     {
         addQueue.Enqueue(data);
     }
 }
Пример #3
0
 internal void QueueRemoveEvent(RoomData data)
 {
     lock (removeQueue.SyncRoot)
     {
         removeQueue.Enqueue(data);
     }
 }
Пример #4
0
 internal void QueueUpdateEvent(RoomData data, int roomEventCategory)
 {
     lock (updateQueue.SyncRoot)
     {
         updateQueue.Enqueue(data);
     }
     eventCategories[roomEventCategory].QueueUpdateEvent(data);
 }
Пример #5
0
 internal void QueueRemoveEvent(RoomData data, int roomEventCategory)
 {
     lock (removeQueue.SyncRoot)
     {
         removeQueue.Enqueue(data);
     }
     eventCategories[roomEventCategory].QueueRemoveEvent(data);
 }
Пример #6
0
        internal void QueueAddEvent(RoomData data, int roomEventCategory)
        {
            lock (addQueue.SyncRoot)
            {
                addQueue.Enqueue(data);
            }

            eventCategories[roomEventCategory].QueueAddEvent(data);
        }
Пример #7
0
        internal RoomData GenerateNullableRoomData(UInt32 RoomId)
        {
            if (GenerateRoomData(RoomId) != null)
            {
                return GenerateRoomData(RoomId);
            }

            RoomData Data = new RoomData();
            Data.FillNull(RoomId);
            return Data;
        }
Пример #8
0
 internal void QueueActiveRoomRemove(RoomData data)
 {
     //Console.WriteLine("Removing from all rooms: " + data.Name + ";" + data.Category);
     lock (activeRoomsRemoveQueue.SyncRoot)
     {
         activeRoomsRemoveQueue.Enqueue(data);
     }
 }
Пример #9
0
 internal void QueueActiveRoomAdd(RoomData data)
 {
     lock (activeRoomsAddQueue.SyncRoot)
     {
         activeRoomsAddQueue.Enqueue(data);
     }
 }
Пример #10
0
 internal void QueueActiveRoomUpdate(RoomData data)
 {
     lock (activeRoomsUpdateQueue.SyncRoot)
     {
         activeRoomsUpdateQueue.Enqueue(data);
     }
 }
Пример #11
0
 internal void QueueVoteRemove(RoomData data)
 {
     lock (votedRoomsRemoveQueue.SyncRoot)
     {
         votedRoomsRemoveQueue.Enqueue(data);
     }
 }
Пример #12
0
        private void Initialize(UInt32 Id, string Name, string Description, string Type, string Owner, int OwnerId, int Category,
            int State, int UsersMax, string ModelName, int Score, List<string> pTags, int AllowPets,
            int AllowPetsEating, int AllowWalkthrough, int Hidewall, string Password, string Wallpaper, string Floor,
            string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness, Group group, int GameId, int chattype,
            int chatballoon, int chatspeed, int chatmaxdis, int chatprotection, int whomute, int whokick, int whoban, uint groupid, List<Chatlog> Chat)
        {
            this.mDisposed = false;
            this.Id = Id;
            this.Name = Name;
            this.Description = Description;
            this.Owner = Owner;
            this.OwnerId = OwnerId;
            this.Category = Category;
            this.Type = Type;
            this.State = State;
            this.UsersNow = 0;
            this.UsersMax = UsersMax;
            this.ModelName = ModelName;
            this.Score = Score;
            tagCount = 0;
            this.Tags = new ArrayList();
            foreach (string tag in pTags)
            {
                tagCount++;
                Tags.Add(tag);
            }

            this.ChatType = chattype;
            this.ChatBalloon = chatballoon;
            this.ChatSpeed = chatspeed;
            this.ChatMaxDistance = chatmaxdis;
            this.ChatFloodProtection = chatprotection;

            this.AllowPets = AllowPets;
            this.AllowPetsEating = AllowPetsEating;
            this.AllowWalkthrough = AllowWalkthrough;
            this.Hidewall = Hidewall;
            this.Group = group;

            this.Password = Password;
            this.Bans = new Dictionary<Int64, double>();
            this.MutedUsers = new Dictionary<uint, uint>();
            this.Wallpaper = Wallpaper;
            this.Floor = Floor;
            this.Landscape = Landscape;
            this.ActiveTrades = new ArrayList();

            this.MutedPets = false;
            this.MutedBots = false;
            this.mCycleEnded = false;

            this.mRoomData = RoomData;
            this.EveryoneGotRights = RightOverride;

            this.roomMessages = new Queue();
            this.chatMessageQueue = new Queue();
            this.LoadedGroups = new Dictionary<uint, String>();

            this.roomMessages = new Queue();
            this.roomAlerts = new Queue();
            this.roomBadge = new Queue();
            this.roomKick = new Queue();
            this.roomServerMessages = new Queue();
            //this.DiceQueue = new Queue();
            this.IdleTime = 0;
            this.RoomMuted = false;
            this.WallThickness = walltickness;
            this.FloorThickness = floorthickness;

            this.gamemap = new Gamemap(this);
            if (roomItemHandling == null)
                this.roomItemHandling = new RoomItemHandling(this);
            this.roomUserManager = new RoomUserManager(this);
            this.RoomChat = Chat;
            this.ForSale = false;
            this.SalePrice = 0;
            this.Event = SilverwaveEnvironment.GetGame().GetRoomEvents().GetEvent(Id);
            this.GameId = GameId;
            this.WhoCanBan = whoban;
            this.WhoCanKick = whokick;
            this.WhoCanBan = whoban;
            this.GroupId = groupid;

            LoadRights();
            GetRoomItemHandler().LoadFurniture();
            GetGameMap().GenerateMaps();
            LoadMusic();
            LoadBans();
            InitUserBots();
            this.Added = new List<Chatlog>();
            using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("UPDATE rooms SET users_now=1 WHERE id=" + Id + " LIMIT 1");
            }
            SilverwaveEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData);
        }
Пример #13
0
        internal static ServerMessage SerializeTicketChatlog(SupportTicket Ticket, RoomData RoomData, Double Timestamp)
        {
            using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT user_id,timestamp,message FROM chatlogs WHERE room_id = " + RoomData.Id + " AND (timestamp >= " + (Timestamp - 300) + " AND timestamp <= " + Timestamp + ") OR (timestamp >= " + (Timestamp - 300) + " AND timestamp = 0) ORDER BY timestamp DESC LIMIT 150");
                DataTable Data = dbClient.getTable();

                ServerMessage Message = new ServerMessage(Outgoing.IssueChatlog);
                Message.AppendInt32(Ticket.TicketId);
                Message.AppendInt32(Ticket.SenderId);
                Message.AppendInt32(Ticket.ReportedId);
                Message.AppendInt32(RoomData.Id);
                Message.AppendBoolean(false); // Public room
                Message.AppendInt32(RoomData.Id);
                Message.AppendString(RoomData.Name);

                if (Data != null)
                {
                    Message.AppendInt32(Data.Rows.Count);

                    foreach (DataRow Row in Data.Rows)
                    {
                        Habbo Habbo = SilverwaveEnvironment.getHabboForId(Convert.ToUInt32(Row["user_id"]));
                        DateTime Time = SilverwaveEnvironment.UnixToDateTime(Convert.ToDouble(Row["timestamp"]));
                        //Message.AppendInt32(Time.Hour);
                        Message.AppendInt32(Time.Minute);
                        Message.AppendInt32(Habbo.Id);
                        Message.AppendString(Habbo.Username);
                        Message.AppendString((String)Row["message"]);
                    }
                }
                else
                {
                    Message.AppendInt32(0);
                }

                return Message;
            }
        }
Пример #14
0
        internal static ServerMessage SerializeRoomTool(RoomData Data)
        {
            Room Room = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Data.Id);

            ServerMessage Message = new ServerMessage(Outgoing.RoomTool);
            Message.AppendInt32(Data.Id);
            Message.AppendInt32(Data.UsersNow); // user count

            if (Room != null)
            {
                Message.AppendBoolean((Room.GetRoomUserManager().GetRoomUserByHabbo(Data.Owner) != null));
            }
            else
            {
                Message.AppendBoolean(false);
            }
            Message.AppendInt32(Room.OwnerId);
            Message.AppendString(Data.Owner);
            Message.AppendBoolean((Room != null)); // show data?

            Message.AppendString(Data.Name);
            Message.AppendString(Data.Description);
            Message.AppendInt32(Data.TagCount);

            foreach (string Tag in Data.Tags)
            {
                Message.AppendString(Tag);
            }

            Message.AppendBoolean(false);

            return Message;
        }
Пример #15
0
        internal RoomData GenerateRoomData(UInt32 RoomId)
        {
            
            if (loadedRoomData.ContainsKey(RoomId))
                return (RoomData)loadedRoomData[RoomId];

            Logging.WriteLine("Loading Room [" + RoomId + "]");

            RoomData Data = new RoomData();
            if (IsRoomLoaded(RoomId))
            {
                return GetRoom(RoomId).RoomData;
            }
            else
            {
                DataRow Row = null;

                using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("SELECT * FROM rooms WHERE id = " + RoomId + " LIMIT 1");
                    Row = dbClient.getRow();
                }

                if (Row == null)
                {
                    return null;
                }

                Data.Fill(Row);
                loadedRoomData.Add(RoomId, Data);
            }

            return Data;
        }
Пример #16
0
        internal RoomData FetchRoomData(UInt32 RoomId, DataRow dRow)
        {
            if (loadedRoomData.ContainsKey(RoomId))
                return (RoomData)loadedRoomData[RoomId];
            else
            {
                RoomData data = new RoomData();
                if (IsRoomLoaded(RoomId))
                    data.Fill(GetRoom(RoomId));
                else
                    data.Fill(dRow);

                loadedRoomData.Add(RoomId, data);
                return data;
            }
        }
Пример #17
0
 internal Room(RoomData Data)
 {
     InitializeFromRoomData(Data);
 }
Пример #18
0
 internal void QueueVoteAdd(RoomData data)
 {
     lock (votedRoomsAddQueue.SyncRoot)
     {
         votedRoomsAddQueue.Enqueue(data);
     }
 }
Пример #19
0
 private void InitializeFromRoomData(RoomData Data)
 {
     Initialize(Data.Id, Data.Name, Data.Description, Data.Type, Data.Owner, Data.OwnerId, Data.Category, Data.State,
     Data.UsersMax, Data.ModelName, Data.Score, Data.Tags, Data.AllowPets, Data.AllowPetsEating,
     Data.AllowWalkthrough, Data.Hidewall, Data.Password, Data.Wallpaper, Data.Floor, Data.Landscape, Data,
     Data.AllowRightsOverride, Data.WallThickness, Data.FloorThickness, Data.Group, Data.GameId, Data.ChatType, Data.ChatBalloon, Data.ChatSpeed,
     Data.ChatMaxDistance, Data.ChatFloodProtection, Data.WhoCanMute, Data.WhoCanKick, Data.WhoCanBan, Data.GroupId, Data.RoomChat);
 }
Пример #20
0
 internal List<RoomData> GetAllFriends()
 {
     List<RoomData> temp = new List<RoomData>();
     foreach(MessengerBuddy friend in friends.Values)
     {
         DataTable Data = new DataTable();
         using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
         {
             dbClient.setQuery("SELECT * FROM rooms WHERE owner = '"+friend.mUsername+"';");
             Data = dbClient.getTable();
             
         }
         foreach (DataRow d in Data.Rows)
         {
             RoomData x = new RoomData();
             t = (uint)d["id"];
             RoomManager s = new RoomManager();
             x = s.FetchRoomData(Convert.ToUInt32(t), d);
             temp.Add(x);
         }
     }
     return temp;
 }