コード例 #1
0
ファイル: EventCategory.cs プロジェクト: TheNaked/Firewind
 internal void QueueUpdateEvent(RoomData data)
 {
     lock (updateQueue.SyncRoot)
     {
         updateQueue.Enqueue(data);
     }
 }
コード例 #2
0
ファイル: EventCategory.cs プロジェクト: TheNaked/Firewind
 internal void QueueRemoveEvent(RoomData data)
 {
     lock (removeQueue.SyncRoot)
     {
         removeQueue.Enqueue(data);
     }
 }
コード例 #3
0
ファイル: EventCategory.cs プロジェクト: TheNaked/Firewind
 internal void QueueAddEvent(RoomData data)
 {
     lock (addQueue.SyncRoot)
     {
         addQueue.Enqueue(data);
     }
 }
コード例 #4
0
ファイル: EventManager.cs プロジェクト: TheNaked/Firewind
 internal void QueueRemoveEvent(RoomData data, int roomEventCategory)
 {
     lock (removeQueue.SyncRoot)
     {
         removeQueue.Enqueue(data);
     }
     eventCategories[roomEventCategory].QueueRemoveEvent(data);
 }
コード例 #5
0
ファイル: EventManager.cs プロジェクト: TheNaked/Firewind
 internal void QueueUpdateEvent(RoomData data, int roomEventCategory)
 {
     lock (updateQueue.SyncRoot)
     {
         updateQueue.Enqueue(data);
     }
     eventCategories[roomEventCategory].QueueUpdateEvent(data);
 }
コード例 #6
0
ファイル: EventManager.cs プロジェクト: TheNaked/Firewind
        internal void QueueAddEvent(RoomData data, int roomEventCategory)
        {
            lock (addQueue.SyncRoot)
            {
                addQueue.Enqueue(data);
            }

            eventCategories[roomEventCategory].QueueAddEvent(data);
        }
コード例 #7
0
ファイル: RoomEvent.cs プロジェクト: Kristopher-RZ/Firewind
        internal void SerializeTo(RoomData data, ServerMessage Message)
        {
            Message.AppendString(data.OwnerId + "");
            Message.AppendString(data.Owner);
            Message.AppendString(RoomId + "");
            Message.AppendInt32(Category);
            Message.AppendString(Name);
            Message.AppendString(Description);
            Message.AppendString(StartTime);
            Message.AppendInt32(Tags.Count);

            foreach (string Tag in Tags.ToArray())
            {
                Message.AppendString(Tag);
            }
        }
コード例 #8
0
ファイル: RoomManager.cs プロジェクト: Kristopher-RZ/Firewind
 internal void QueueVoteAdd(RoomData data)
 {
     lock (votedRoomsAddQueue.SyncRoot)
     {
         votedRoomsAddQueue.Enqueue(data);
     }
 }
コード例 #9
0
ファイル: Room.cs プロジェクト: Kristopher-RZ/Firewind
 private void InitializeFromRoomData(RoomData Data)
 {
     Initialize(Data.Id, Data.Name, Data.Description, 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);
 }
コード例 #10
0
ファイル: Room.cs プロジェクト: Kristopher-RZ/Firewind
        private void Initialize(UInt32 Id, string Name, string Description, string Owner, int OwnerId, int Category,
            int State, int UsersMax, string ModelName, int Score, List<string> pTags, bool AllowPets,
            bool AllowPetsEating, bool AllowWalkthrough, bool Hidewall, string Password, string Wallpaper, string Floor,
            string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness, Group group)
        {
            this.mDisposed = false;
            this.Id = Id;
            this.Name = Name;
            this.Description = Description;
            this.Owner = Owner;
            this.OwnerId = OwnerId;
            this.Category = Category;
            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.AllowPets = AllowPets;
            this.AllowPetsEating = AllowPetsEating;
            this.AllowWalkthrough = AllowWalkthrough;
            this.Hidewall = Hidewall;

            this.Password = Password;
            this.Bans = new Dictionary<int, double>();
            this.Wallpaper = Wallpaper;
            this.Floor = Floor;
            this.Landscape = Landscape;
            this.chatMessageManager = new ChatMessageManager();
            this.ActiveTrades = new ArrayList();

            this.mCycleEnded = false;

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

            this.roomMessages = new Queue();
            this.chatMessageQueue = new Queue();
            this.rnd = new Random();

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

            this.gamemap = new GameMap(this);
            this.roomItemHandling = new RoomItemHandling(this);
            this.roomUserManager = new RoomUnitManager(this);
            this.wiredHandler = new WiredHandler(this);

            this.Group = group;

            LoadRights();
            GetRoomItemHandler().LoadFurniture();
            wiredHandler.LoadWired();
            GetGameMap().GenerateMaps();
            LoadMusic();
            //LoadBots();
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("REPLACE INTO room_active VALUES (" + Id + ",1)");
            }

            FirewindEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData);
        }
コード例 #11
0
ファイル: Room.cs プロジェクト: TheNaked/Firewind
        private void Initialize(UInt32 Id, string Name, string Description, string Owner, int OwnerId, int Category,
                                int State, int UsersMax, string ModelName, int Score, List <string> pTags, bool AllowPets,
                                bool AllowPetsEating, bool AllowWalkthrough, bool Hidewall, string Password, string Wallpaper, string Floor,
                                string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness, Group group)
        {
            this.mDisposed   = false;
            this.Id          = Id;
            this.Name        = Name;
            this.Description = Description;
            this.Owner       = Owner;
            this.OwnerId     = OwnerId;
            this.Category    = Category;
            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.AllowPets        = AllowPets;
            this.AllowPetsEating  = AllowPetsEating;
            this.AllowWalkthrough = AllowWalkthrough;
            this.Hidewall         = Hidewall;

            this.Password           = Password;
            this.Bans               = new Dictionary <UInt32, double>();
            this.Wallpaper          = Wallpaper;
            this.Floor              = Floor;
            this.Landscape          = Landscape;
            this.chatMessageManager = new ChatMessageManager();
            this.ActiveTrades       = new ArrayList();


            this.mCycleEnded = false;

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

            this.roomMessages     = new Queue();
            this.chatMessageQueue = new Queue();
            this.rnd = new Random();

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

            this.gamemap          = new Gamemap(this);
            this.roomItemHandling = new RoomItemHandling(this);
            this.roomUserManager  = new RoomUserManager(this);
            this.wiredHandler     = new WiredHandler(this);

            this.Group = group;

            LoadRights();
            GetRoomItemHandler().LoadFurniture();
            wiredHandler.LoadWired();
            GetGameMap().GenerateMaps();
            LoadMusic();
            //LoadBots();
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("REPLACE INTO room_active VALUES (" + Id + ",1)");
            }

            FirewindEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData);
        }
コード例 #12
0
ファイル: Room.cs プロジェクト: Kristopher-RZ/Firewind
 internal Room(RoomData Data)
 {
     InitializeFromRoomData(Data);
 }
コード例 #13
0
ファイル: Room.cs プロジェクト: TheNaked/Firewind
 internal Room(RoomData Data)
 {
     InitializeFromRoomData(Data);
 }
コード例 #14
0
ファイル: Room.cs プロジェクト: TheNaked/Firewind
 private void InitializeFromRoomData(RoomData Data)
 {
     Initialize(Data.Id, Data.Name, Data.Description, 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);
 }
コード例 #15
0
ファイル: ModerationTool.cs プロジェクト: TheNaked/Firewind
        internal static ServerMessage SerializeTicketChatlog(SupportTicket Ticket, RoomData RoomData, Double Timestamp)
        {
            Room currentRoom = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(RoomData.Id);

            ServerMessage Message = new ServerMessage(Outgoing.IssueChatlog);
            Message.AppendUInt(Ticket.TicketId);
            Message.AppendUInt(Ticket.SenderId);
            Message.AppendUInt(Ticket.ReportedId);
            Message.AppendUInt(RoomData.Id); //maybe?
            Message.AppendBoolean(false); // is public
            Message.AppendUInt(RoomData.Id);
            Message.AppendString(RoomData.Name);

            if (currentRoom == null)
            {
                Message.AppendInt32(0);
                return Message;
            }
            else
            {
                ChatMessageManager manager = currentRoom.GetChatMessageManager();
                Message.AppendInt32(manager.messageCount);
                manager.Serialize(ref Message);

                return Message;
            }

            //using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            //{
            //    dbClient.setQuery("SELECT user_id,user_name,hour,minute,message FROM chatlogs WHERE room_id = " + RoomData.Id + " AND timestamp >= " + (Timestamp - 300) + " AND timestamp <= " + Timestamp + " ORDER BY timestamp DESC");
            //    DataTable Data = dbClient.getTable();

            //    ServerMessage Message = new ServerMessage(534);
            //    Message.AppendUInt(Ticket.TicketId);
            //    Message.AppendUInt(Ticket.SenderId);
            //    Message.AppendUInt(Ticket.ReportedId);
            //    Message.AppendBoolean(RoomData.IsPublicRoom);
            //    Message.AppendUInt(RoomData.Id);
            //    Message.AppendString(RoomData.Name);

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

            //        foreach (DataRow Row in Data.Rows)
            //        {
            //            Message.AppendInt32((int)Row["hour"]);
            //            Message.AppendInt32((int)Row["minute"]);
            //            Message.AppendUInt((UInt32)Row["user_id"]);
            //            Message.AppendString((String)Row["user_name"]);
            //            Message.AppendString((String)Row["message"]);
            //        }
            //    }
            //    else
            //    {
            //        Message.AppendInt32(0);
            //    }

            //    return Message;
            //}
        }
コード例 #16
0
ファイル: ModerationTool.cs プロジェクト: TheNaked/Firewind
        internal static ServerMessage SerializeRoomTool(RoomData Data)
        {
            Room Room = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Data.Id);
            UInt32 OwnerId = 0;

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                try
                {
                    dbClient.setQuery("SELECT id FROM users WHERE username = @owner");
                    dbClient.addParameter("owner", Data.Owner);
                    OwnerId = Convert.ToUInt32(dbClient.getRow()[0]);
                }
                catch (Exception e)
                {
                    Logging.HandleException(e, "ModerationTool.SerializeRoomTool");
                }
            }

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

            if (Room != null)
            {
                Message.AppendBoolean((Room.GetRoomUserManager().GetRoomUserByHabbo(Data.Owner) != null));
            }
            else
            {
                Message.AppendBoolean(false);
            }

            Message.AppendUInt(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((Room != null) ? Room.HasOngoingEvent : false);
            if (Room != null)
            {
                if (Room.Event != null)
                {
                    Message.AppendString(Room.Event.Name);
                    Message.AppendString(Room.Event.Description);
                    Message.AppendInt32(Room.Event.Tags.Count);

                    foreach (string Tag in Room.Event.Tags.ToArray())
                    {
                        Message.AppendString(Tag);
                    }
                }
            }

            return Message;
        }
コード例 #17
0
ファイル: RoomManager.cs プロジェクト: Kristopher-RZ/Firewind
 internal void QueueVoteRemove(RoomData data)
 {
     lock (votedRoomsRemoveQueue.SyncRoot)
     {
         votedRoomsRemoveQueue.Enqueue(data);
     }
 }
コード例 #18
0
ファイル: RoomManager.cs プロジェクト: Kristopher-RZ/Firewind
        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;
            }
        }
コード例 #19
0
ファイル: RoomManager.cs プロジェクト: Kristopher-RZ/Firewind
        internal RoomData GenerateNullableRoomData(UInt32 RoomId)
        {
            if (GenerateRoomData(RoomId) != null)
            {
                return GenerateRoomData(RoomId);
            }

            RoomData Data = new RoomData();
            Data.FillNull(RoomId);
            return Data;
        }
コード例 #20
0
ファイル: RoomManager.cs プロジェクト: Kristopher-RZ/Firewind
 internal void QueueActiveRoomUpdate(RoomData data)
 {
     lock (activeRoomsUpdateQueue.SyncRoot)
     {
         activeRoomsUpdateQueue.Enqueue(data);
     }
 }
コード例 #21
0
ファイル: RoomManager.cs プロジェクト: Kristopher-RZ/Firewind
 internal void QueueActiveRoomRemove(RoomData data)
 {
     //Logging.WriteLine("Removing from all rooms: " + data.Name + ";" + data.Category);
     lock (activeRoomsRemoveQueue.SyncRoot)
     {
         activeRoomsRemoveQueue.Enqueue(data);
     }
 }
コード例 #22
0
ファイル: RoomManager.cs プロジェクト: Kristopher-RZ/Firewind
 internal void QueueActiveRoomAdd(RoomData data)
 {
     lock (activeRoomsAddQueue.SyncRoot)
     {
         activeRoomsAddQueue.Enqueue(data);
     }
 }
コード例 #23
0
ファイル: RoomManager.cs プロジェクト: Kristopher-RZ/Firewind
        internal RoomData GenerateRoomData(UInt32 RoomId)
        {
            if (loadedRoomData.ContainsKey(RoomId))
                return (RoomData)loadedRoomData[RoomId];

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

                using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("SELECT rooms.*, room_active.active_users FROM rooms LEFT JOIN room_active ON (room_active.roomid = rooms.id) WHERE id = " + RoomId);
                    Row = dbClient.getRow();
                }

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

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

            return Data;
        }