コード例 #1
0
        public CatalogPage(int pageId, int parentId, string caption, bool visible, bool enabled, int minRank, bool clubOnly, int iconColor, int iconImage, string pageLayout, string pageHeadline, string pageTeaser, string pageSpecial, string pageText1, string pageText2, string pageTextDetails, string pageTextTeaser, string pageLinkDescription, string pageLinkPagename, IEnumerable <CatalogItem> items)
        {
            this.PageID    = pageId;
            this.ParentID  = parentId;
            this.Caption   = caption;
            this.Visible   = visible;
            this.Enabled   = enabled;
            this.MinRank   = minRank;
            this.ClubOnly  = clubOnly;
            this.IconColor = iconColor;
            this.IconImage = iconImage;

            this.PageLayout          = pageLayout;          //1
            this.PageHeadline        = pageHeadline;        //2
            this.PageTeaser          = pageTeaser;          //3
            this.PageSpecial         = pageSpecial;         //4
            this.PageText1           = pageText1;           //5
            this.PageText2           = pageText2;           //6
            this.PageTextDetails     = pageTextDetails;     //7
            this.PageTextTeaser      = pageTextTeaser;      //8
            this.PageLinkDescription = pageLinkDescription; //9
            this.PageLinkPagename    = pageLinkPagename;    //10
            this.Items = items.ToDictionary(i => i.Id, i => i);

            this.ServerMessagePageInfo = new MultiRevisionServerMessage(OutgoingPacketsEnum.CatalogPage, new ValueHolder("CatalogPage", this));
        }
コード例 #2
0
        public byte[] GetRelativeHeightmap(Revision revision)
        {
            if (this.RelativeHeightmapServerMessage == null)
            {
                this.RelativeHeightmapServerMessage = new MultiRevisionServerMessage(OutgoingPacketsEnum.RelativeHeightmap, new ValueHolder("RelativeHeightmap", this.BuildRelativeHeightmap()));
            }

            return(this.RelativeHeightmapServerMessage.GetBytes(revision));
        }
コード例 #3
0
ファイル: Room.cs プロジェクト: aromaa/Skylight
 public void SendToAllRespectIgnores(MultiRevisionServerMessage message, uint senderId)
 {
     foreach (RoomUnitUser user in this.RoomUserManager.GetRealUsers())
     {
         if (user.Session.GetHabbo() != null)
         {
             if (!user.Session.GetHabbo().IgnoredUsers.Contains(senderId))
             {
                 user.Session.SendData(message.GetBytes(user.Session.Revision), true);
             }
         }
     }
 }
コード例 #4
0
ファイル: Game.cs プロジェクト: aromaa/Skylight
        public void CheckTimeout()
        {
            try
            {
                int pingInterval = int.Parse(Skylight.GetConfig()["client.ping.interval"]);

                if (this.LastTimeoutCheck.ElapsedMilliseconds >= pingInterval)
                {
                    this.LastTimeoutCheck.Restart();

                    MultiRevisionServerMessage message = new MultiRevisionServerMessage(OutgoingPacketsEnum.Ping);
                    foreach (GameClient session in this.GameClientManager.GetClients())
                    {
                        if (session != null)
                        {
                            TwoFactorAuthenticationHandler twofa = session.GetMessageHandler <TwoFactorAuthenticationHandler>(TwoFactorAuthenticationHandler.DefaultIdentifier);
                            if (twofa != null)
                            {
                                if (twofa.Started.ElapsedMilliseconds > 60000) //1 minute
                                {
                                    session.Stop("Two factory authenication timeout");
                                }
                            }
                            else
                            {
                                if (session.LastPong.ElapsedMilliseconds > pingInterval * 2) //timeout
                                {
                                    session.Stop("Timeout");
                                }
                                else
                                {
                                    byte[] bytes = message.GetBytes(session.Revision);
                                    if (bytes != null)
                                    {
                                        session.SendData(bytes);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logging.LogException("Error in check timeout task! " + ex.ToString());
            }
        }
コード例 #5
0
ファイル: Room.cs プロジェクト: aromaa/Skylight
 public void SendToAll(MultiRevisionServerMessage message, List <uint> ignoreList = null)
 {
     if (!this.QueueBytes || ignoreList != null)
     {
         foreach (RoomUnitUser user in this.RoomUserManager.GetRealUsers())
         {
             if (user.Session.GetHabbo() != null)
             {
                 if (ignoreList == null || !ignoreList.Contains(user.Session.GetHabbo().ID))
                 {
                     user.Session.SendData(message.GetBytes(user.Session.Revision), true);
                 }
             }
         }
     }
     else
     {
         this.BytesWaitingToBeSend.Add(message);
     }
 }
コード例 #6
0
        public void Handle(GameClient session, ClientMessage message)
        {
            if (session != null && session.GetHabbo() != null && session.GetHabbo().GetRoomSession().RequestedRoomID > 0 && session.GetHabbo().GetRoomSession().LoadingRoom)
            {
                Room room = Skylight.GetGame().GetRoomManager().TryGetRoom(session.GetHabbo().GetRoomSession().RequestedRoomID);

                session.GetHabbo().GetRoomSession().ResetRequestedRoom();
                if (room != null)
                {
                    room.RoomUserManager.EnterRoom(session);

                    MultiRevisionServerMessage usersStatuses = room.RoomUserManager.GetUserStatus(true);
                    if (usersStatuses != null)
                    {
                        session.SendData(usersStatuses.GetBytes(session.Revision));
                    }

                    room.RoomWiredManager.UserEnterRoom(session.GetHabbo().GetRoomSession().GetRoomUser());
                }
            }
        }
コード例 #7
0
        public RoomModel(string id, int doorx, int doory, int doorz, int doorDir, string heightmap, string publicItems, string clubName)
        {
            this.ID          = id;
            this.DoorX       = doorx;
            this.DoorY       = doory;
            this.DoorZ       = doorz;
            this.DoorDir     = doorDir;
            this.Heightmap   = heightmap.ToLower();
            this.PublicItems = publicItems;
            this.ClubName    = clubName;

            string[] splitedHeightmap = this.Heightmap.Split(new char[]
            {
                Convert.ToChar(13)
            });

            this.MaxX = splitedHeightmap[0].Length;
            this.MaxY = splitedHeightmap.Length;

            this.TileStates   = new ModelTileState[this.MaxX, this.MaxY];
            this.ModelHeights = new int[this.MaxX, this.MaxY];
            for (int i = 0; i < this.MaxY; i++)
            {
                if (i > 0)
                {
                    splitedHeightmap[i] = splitedHeightmap[i].Substring(1);
                }

                for (int j = 0; j < this.MaxX; j++)
                {
                    if (splitedHeightmap[i].Length >= j + 1)
                    {
                        string text = splitedHeightmap[i].Substring(j, 1).Trim().ToLower();
                        if (text == "x")
                        {
                            this.TileStates[j, i] = ModelTileState.BLOCKED;
                        }
                        else
                        {
                            int height;
                            if (int.TryParse(text, out height))
                            {
                                this.TileStates[j, i]   = ModelTileState.OPEN;
                                this.ModelHeights[j, i] = height;
                            }
                        }
                    }
                    else
                    {
                        this.TileStates[j, i] = ModelTileState.BLOCKED;
                        Logging.WriteLine("OOPS! Room model '" + this.ID + "' got some invalid data on heightmap! Temp fixed this! :)");
                    }
                }
            }

            if (!string.IsNullOrWhiteSpace(this.PublicItems))
            {
                this.Rotation = new int[this.MaxX, this.MaxY];

                List <string[]> items = new List <string[]>();
                if (!this.PublicItems.Contains(Convert.ToChar(2)))
                {
                    foreach (string item in this.PublicItems.Split(Convert.ToChar(13)))
                    {
                        string[] data = item.Split(' ');

                        this.TileStates[int.Parse(data[2]), int.Parse(data[3])] = (ModelTileState)int.Parse(data[6]);
                        this.Rotation[int.Parse(data[2]), int.Parse(data[3])]   = int.Parse(data[5]);

                        items.Add(data);
                    }
                }
                else
                {
                    ClientMessage message = BasicUtilies.GetRevisionClientMessage(Revision.RELEASE63_35255_34886_201108111108);
                    message.Init(0, Skylight.GetDefaultEncoding().GetBytes(this.PublicItems));

                    int count = message.PopWiredInt32();
                    for (int i = 0; i < count; i++)
                    {
                        string name = message.PopStringUntilBreak();
                        string item = message.PopStringUntilBreak();
                        int    x    = message.PopWiredInt32();
                        int    y    = message.PopWiredInt32();
                        int    z    = message.PopWiredInt32();
                        int    rot  = message.PopWiredInt32();

                        if (item.Contains("bench") || item.Contains("chair") || item.Contains("stool") || item.Contains("seat") || item.Contains("sofa"))
                        {
                            this.TileStates[x, y] = ModelTileState.SEAT;
                        }
                        else
                        {
                            this.TileStates[x, y] = ModelTileState.BLOCKED;
                        }

                        items.Add(new string[] { name, item, x.ToString(), y.ToString(), z.ToString(), rot.ToString() });
                    }
                }

                this.PublicItemsServerMessage = new MultiRevisionServerMessage(OutgoingPacketsEnum.PublicItems, new ValueHolder("Items", items.ToArray()));
            }

            this.TileStates[this.DoorX, this.DoorY] = ModelTileState.DOOR;

            using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
            {
                DataTable dataTable = dbClient.ReadDataTable("SELECT * FROM room_models_triggers WHERE id = '" + this.ID + "'");
                if (dataTable != null && dataTable.Rows.Count > 0)
                {
                    this.Triggers = new RoomModelTrigger[this.MaxX, this.MaxY];

                    foreach (DataRow dataRow in dataTable.Rows)
                    {
                        this.Triggers[(int)dataRow["x"], (int)dataRow["y"]] = new RoomModelTrigger((int)dataRow["x"], (int)dataRow["y"], (string)dataRow["type"], (string)dataRow["data"]);
                    }
                }
            }
        }
コード例 #8
0
        public void Handle(GameClient session, ClientMessage message)
        {
            if (session != null && session.GetHabbo() != null && session.GetHabbo().GetRoomSession().RequestedRoomID > 0 && session.GetHabbo().GetRoomSession().LoadingRoom)
            {
                Room room = Skylight.GetGame().GetRoomManager().TryGetRoom(session.GetHabbo().GetRoomSession().RequestedRoomID);
                session.GetHabbo().GetRoomSession().ResetRequestedRoom();
                if (room != null)
                {
                    if (room.RoomGamemapManager.Model != null)
                    {
                        session.SendData(room.RoomGamemapManager.Model.GetHeightmap(session.Revision, room.RoomGamemapManager.Tiles));
                        session.SendData(room.RoomGamemapManager.Model.GetRelativeHeightmap(session.Revision));
                        session.SendData(room.RoomGamemapManager.Model.GetPublicItems(session.Revision), true);

                        if (room.RoomData.Type == "private")
                        {
                            ServerMessage floorItems = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                            floorItems.Init(r63aOutgoing.FloorItems);
                            floorItems.AppendInt32(room.RoomItemManager.FloorItems.Count);
                            foreach (RoomItem item in room.RoomItemManager.FloorItems.Values)
                            {
                                item.Serialize(floorItems);
                            }
                            session.SendMessage(floorItems);

                            ServerMessage wallItems = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                            wallItems.Init(r63aOutgoing.WallItems);
                            wallItems.AppendInt32(room.RoomItemManager.WallItems.Count);
                            foreach (RoomItem item in room.RoomItemManager.WallItems.Values)
                            {
                                item.Serialize(wallItems);
                            }
                            session.SendMessage(wallItems);
                        }

                        room.RoomUserManager.EnterRoom(session);

                        ICollection <RoomUnit> users        = room.RoomUserManager.GetRoomUsers();
                        ServerMessage          setRoomUsers = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                        setRoomUsers.Init(r63aOutgoing.SetRoomUser);
                        setRoomUsers.AppendInt32(users.Count);
                        foreach (RoomUnit user in users)
                        {
                            user.Serialize(setRoomUsers);
                        }
                        session.SendMessage(setRoomUsers);

                        ServerMessage roomVIPsetting = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                        roomVIPsetting.Init(r63aOutgoing.RoomVIPSettings);
                        roomVIPsetting.AppendBoolean(room.RoomData.Hidewalls);
                        roomVIPsetting.AppendInt32(room.RoomData.Wallthick);
                        roomVIPsetting.AppendInt32(room.RoomData.Floorthick);
                        session.SendMessage(roomVIPsetting);

                        if (room.RoomData.Type == "private")
                        {
                            ServerMessage roomOwner = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                            roomOwner.Init(r63aOutgoing.RoomOwner);
                            roomOwner.AppendBoolean(true);                          //is private room
                            roomOwner.AppendUInt(room.ID);
                            roomOwner.AppendBoolean(room.HaveOwnerRights(session)); //is roomowner
                            session.SendMessage(roomOwner);

                            ServerMessage roomData = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                            roomData.Init(r63aOutgoing.RoomData);
                            roomData.AppendBoolean(false);                     //entered room
                            room.RoomData.Serialize(roomData, false);
                            roomData.AppendBoolean(false);                     //forward
                            roomData.AppendBoolean(room.RoomData.IsStaffPick); //is staff pick
                            session.SendMessage(roomData);
                        }
                        else
                        {
                            ServerMessage roomOwner = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                            roomOwner.Init(r63aOutgoing.RoomOwner);
                            roomOwner.AppendBoolean(false); //is private room
                            roomOwner.AppendString(room.RoomGamemapManager.Model.ID);
                            roomOwner.AppendInt32(0);       //unknwown
                            session.SendMessage(roomOwner);
                        }

                        MultiRevisionServerMessage usersStatuses = room.RoomUserManager.GetUserStatus(true);
                        if (usersStatuses != null)
                        {
                            session.SendData(usersStatuses.GetBytes(session.Revision));
                        }

                        foreach (RoomUnitUser user in room.RoomUserManager.GetRealUsers())
                        {
                            if (user.Dancing)
                            {
                                ServerMessage danceMessage = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                                danceMessage.Init(r63aOutgoing.Dance);
                                danceMessage.AppendInt32(user.VirtualID);
                                danceMessage.AppendInt32(user.DanceID);
                                session.SendMessage(danceMessage);
                            }

                            if (user.Sleeps)
                            {
                                ServerMessage sleeps = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                                sleeps.Init(r63aOutgoing.Sleeps);
                                sleeps.AppendInt32(user.VirtualID);
                                sleeps.AppendBoolean(true);
                                session.SendMessage(sleeps);
                            }

                            if (user.Handitem > 0 && user.HanditemTimer > 0)
                            {
                                ServerMessage message_ = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                                message_.Init(r63aOutgoing.Handitem);
                                message_.AppendInt32(user.VirtualID);
                                message_.AppendInt32(user.Handitem);
                                session.SendMessage(message_);
                            }

                            if (user.ActiveEffect > 0)
                            {
                                session.SendMessage(BasicUtilies.GetRevisionPacketManager(Revision.PRODUCTION_201601012205_226667486).GetOutgoing(OutgoingPacketsEnum.Effect).Handle(new ValueHolder("VirtualID", user.VirtualID, "EffectID", user.ActiveEffect)));
                            }
                        }

                        room.RoomWiredManager.UserEnterRoom(session.GetHabbo().GetRoomSession().GetRoomUser());

                        if (session.GetHabbo().IsMuted())
                        {
                            ServerMessage flood = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                            flood.Init(r63aOutgoing.Flood);
                            flood.AppendInt32(session.GetHabbo().MuteTimeLeft());
                            session.SendMessage(flood);
                        }
                    }
                    else
                    {
                        session.SendNotif("Failed load room model!");
                    }
                }
                else
                {
                    session.SendNotif("Room not found!");
                }
            }
        }
コード例 #9
0
ファイル: Room.cs プロジェクト: aromaa/Skylight
        public void OnCycle()
        {
            try
            {
                if (!this.RoomUnloaded)
                {
                    this.SetQueueBytes(true);

                    if (this.ShouldGameCycle())
                    {
                        this.LastGameCycle.Restart();

                        this.RoomGameManager.OnCycle();
                    }

                    if (this.ShouldRoomCycle())
                    {
                        this.LastRoomCycle.Restart();

                        this.RoomWiredManager.OnCycle();
                        this.RoomItemManager.OnCycle();
                        this.RoomUserManager.OnCycle();

                        if (this.RoomData.UsersNow <= 0)
                        {
                            if (this.RoomEmptyTimer == null)
                            {
                                this.RoomEmptyTimer = Stopwatch.StartNew();
                            }
                            else
                            {
                                if (this.RoomEmptyTimer.Elapsed.TotalSeconds >= 30.0) //30s
                                {
                                    Skylight.GetGame().GetRoomManager().UnloadRoom(this);
                                }
                            }
                        }
                        else
                        {
                            MultiRevisionServerMessage UserStatus = this.RoomUserManager.GetUserStatus(false);
                            if (UserStatus != null)
                            {
                                this.SendToAll(UserStatus);
                            }
                        }
                    }

                    this.RoomItemManager.SyncPackets();
                    this.SetQueueBytes(false);
                }
            }
            catch (RoomOverloadException ex)
            {
                this.CrashRoom(ex);
            }
            catch (Exception ex)
            {
                Logging.LogRoomException(ex.ToString());

                foreach (RoomUnitUser user in this.RoomUserManager.GetRealUsers())
                {
                    try
                    {
                        user.Session.SendNotif("Room crashed! Something bad happend! :( This error is already reported to the staff team! :) Will be fixed soon");
                    }
                    catch
                    {
                    }
                }

                Skylight.GetGame().GetRoomManager().UnloadRoom(this);
            }
        }
コード例 #10
0
ファイル: GameClient.cs プロジェクト: aromaa/Skylight
 public void SendMessage(MultiRevisionServerMessage message)
 {
     this.SendData(message.GetBytes(this.Revision));
 }
コード例 #11
0
        public void Handle(GameClient session, ClientMessage message)
        {
            if (session != null && session.GetHabbo() != null && session.GetHabbo().GetRoomSession().RequestedRoomID > 0 && session.GetHabbo().GetRoomSession().LoadingRoom)
            {
                Room room = Skylight.GetGame().GetRoomManager().TryGetRoom(session.GetHabbo().GetRoomSession().RequestedRoomID);
                session.GetHabbo().GetRoomSession().ResetRequestedRoom();
                if (room != null)
                {
                    if (room.RoomGamemapManager.Model != null)
                    {
                        session.SendData(room.RoomGamemapManager.Model.GetRelativeHeightmap(session.Revision));
                        session.SendData(room.RoomGamemapManager.Model.GetHeightmap(session.Revision, room.RoomGamemapManager.Tiles));

                        /*//TODO: Fix public items
                         * ServerMessage publicItems = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);
                         * publicItems.Init(r63cOutgoing.PublicItems);
                         * publicItems.AppendInt32(0);
                         * session.SendMessage(publicItems);*/

                        if (room.RoomData.Type == "private")
                        {
                            Dictionary <uint, string> floorItemOwners = new Dictionary <uint, string>();
                            List <byte> tempHolder = new List <byte>();
                            foreach (RoomItem item in room.RoomItemManager.FloorItems.Values)
                            {
                                if (!floorItemOwners.ContainsKey(item.UserID))
                                {
                                    floorItemOwners.Add(item.UserID, Skylight.GetGame().GetGameClientManager().GetUsernameByID(item.UserID));
                                }

                                ServerMessage temp = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);
                                temp.Init();
                                item.Serialize(temp);
                                tempHolder.AddRange(temp.GetBytes());
                            }

                            ServerMessage floorItems = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);
                            floorItems.Init(r63cOutgoing.FloorItems);
                            floorItems.AppendInt32(floorItemOwners.Count);
                            foreach (KeyValuePair <uint, string> floorItemOwner in floorItemOwners)
                            {
                                floorItems.AppendUInt(floorItemOwner.Key);
                                floorItems.AppendString(floorItemOwner.Value);
                            }
                            floorItems.AppendInt32(room.RoomItemManager.FloorItems.Values.Count);
                            floorItems.AppendBytes(tempHolder);
                            session.SendMessage(floorItems);

                            tempHolder = new List <byte>();
                            Dictionary <uint, string> wallItemOwners = new Dictionary <uint, string>();
                            foreach (RoomItem item in room.RoomItemManager.WallItems.Values)
                            {
                                if (!wallItemOwners.ContainsKey(item.UserID))
                                {
                                    wallItemOwners.Add(item.UserID, Skylight.GetGame().GetGameClientManager().GetUsernameByID(item.UserID));
                                }

                                ServerMessage temp = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);
                                temp.Init();
                                item.Serialize(temp);
                                tempHolder.AddRange(temp.GetBytes());
                            }

                            ServerMessage wallItems = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);
                            wallItems.Init(r63cOutgoing.WallItems);
                            wallItems.AppendInt32(wallItemOwners.Count);
                            foreach (KeyValuePair <uint, string> wallItemOwner in wallItemOwners)
                            {
                                wallItems.AppendUInt(wallItemOwner.Key);
                                wallItems.AppendString(wallItemOwner.Value);
                            }
                            wallItems.AppendInt32(room.RoomItemManager.WallItems.Values.Count);
                            wallItems.AppendBytes(tempHolder);
                            session.SendMessage(wallItems);
                        }

                        room.RoomUserManager.EnterRoom(session);

                        ICollection <RoomUnit> users        = room.RoomUserManager.GetRoomUsers();
                        ServerMessage          setRoomUsers = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);
                        setRoomUsers.Init(r63cOutgoing.SetRoomUser);
                        setRoomUsers.AppendInt32(users.Count);
                        foreach (RoomUnit user in users)
                        {
                            user.Serialize(setRoomUsers);
                        }
                        session.SendMessage(setRoomUsers);

                        ServerMessage roomVIPsetting = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);
                        roomVIPsetting.Init(r63cOutgoing.RoomVIPSettings);
                        roomVIPsetting.AppendBoolean(room.RoomData.Hidewalls);
                        roomVIPsetting.AppendInt32(room.RoomData.Wallthick);
                        roomVIPsetting.AppendInt32(room.RoomData.Floorthick);
                        session.SendMessage(roomVIPsetting);

                        if (room.RoomData.Type == "private")
                        {
                            ServerMessage roomOwner = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);
                            roomOwner.Init(r63cOutgoing.RoomOwner);
                            roomOwner.AppendUInt(room.ID);
                            roomOwner.AppendBoolean(room.HaveOwnerRights(session)); //is roomowner
                            session.SendMessage(roomOwner);

                            ServerMessage roomData = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);
                            roomData.Init(r63cOutgoing.RoomData);
                            room.RoomData.SerializeRoomEntry(roomData, false, false);
                            session.SendMessage(roomData);
                        }
                        else
                        {
                            ServerMessage roomOwner = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);
                            roomOwner.Init(r63cOutgoing.RoomOwner);
                            roomOwner.AppendBoolean(false); //is private room
                            roomOwner.AppendString(room.RoomGamemapManager.Model.ID);
                            roomOwner.AppendInt32(0);       //unknwown
                            session.SendMessage(roomOwner);
                        }

                        MultiRevisionServerMessage usersStatuses = room.RoomUserManager.GetUserStatus(true);
                        if (usersStatuses != null)
                        {
                            session.SendData(usersStatuses.GetBytes(session.Revision));
                        }

                        foreach (RoomUnitUser user in room.RoomUserManager.GetRealUsers())
                        {
                            if (user.Dancing)
                            {
                                ServerMessage danceMessage = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);
                                danceMessage.Init(r63cOutgoing.Dance);
                                danceMessage.AppendInt32(user.VirtualID);
                                danceMessage.AppendInt32(user.DanceID);
                                session.SendMessage(danceMessage);
                            }

                            if (user.Sleeps)
                            {
                                ServerMessage sleeps = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);
                                sleeps.Init(r63cOutgoing.Sleeps);
                                sleeps.AppendInt32(user.VirtualID);
                                sleeps.AppendBoolean(true);
                                session.SendMessage(sleeps);
                            }

                            if (user.Handitem > 0 && user.HanditemTimer > 0)
                            {
                                ServerMessage message_ = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);
                                message_.Init(r63cOutgoing.Handitem);
                                message_.AppendInt32(user.VirtualID);
                                message_.AppendInt32(user.Handitem);
                                session.SendMessage(message_);
                            }

                            if (user.ActiveEffect > 0)
                            {
                                ServerMessage Message = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);
                                Message.Init(r63cOutgoing.Effect);
                                Message.AppendInt32(user.VirtualID);
                                Message.AppendInt32(user.ActiveEffect);
                                session.SendMessage(Message);
                            }
                        }

                        room.RoomWiredManager.UserEnterRoom(session.GetHabbo().GetRoomSession().GetRoomUser());

                        if (session.GetHabbo().IsMuted())
                        {
                            ServerMessage flood = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);
                            flood.Init(r63cOutgoing.Flood);
                            flood.AppendInt32(session.GetHabbo().MuteTimeLeft());
                            session.SendMessage(flood);
                        }
                    }
                    else
                    {
                        session.SendNotif("Failed load room model!");
                    }
                }
                else
                {
                    session.SendNotif("Room not found!");
                }
            }
        }
コード例 #12
0
 public WrappedServerMessage(MultiRevisionServerMessage multi)
 {
     this.multi = multi;
 }
コード例 #13
0
        public override bool OnUse(GameClient session, string[] args)
        {
            if (session.GetHabbo().GetHALInterval() > 0)
            {
                if (session.GetHabbo().LastHALSended <= 0)
                {
                    using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                    {
                        session.GetHabbo().LastHALSended = dbClient.ReadDouble("SELECT LastHALSended FROM users WHERE Id = " + session.GetHabbo().ID + " LIMIT 1");
                    }
                }

                if (TimeUtilies.GetUnixTimestamp() - session.GetHabbo().LastHALSended >= session.GetHabbo().GetHALInterval())
                {
                    session.GetHabbo().LastHALSended = TimeUtilies.GetUnixTimestamp();

                    using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                    {
                        dbClient.AddParamWithValue("sessionid", session.GetHabbo().ID);
                        dbClient.ExecuteQuery("UPDATE users SET LastHALSended = UNIX_TIMESTAMP() WHERE id = @sessionid");
                    }
                }
                else
                {
                    TimeSpan timeLeft = new TimeSpan(0, 0, 0, (int)(session.GetHabbo().LastHALSended - TimeUtilies.GetUnixTimestamp() + session.GetHabbo().GetHALInterval()));
                    string   alert    = "You need to wait " + timeLeft.Seconds + " seconds";

                    if (timeLeft.TotalMinutes >= 1)
                    {
                        alert += ", " + timeLeft.Minutes + " minutes";
                    }

                    if (timeLeft.TotalHours >= 1)
                    {
                        alert += ", " + timeLeft.Hours + " hours";
                    }

                    if (timeLeft.TotalDays >= 1)
                    {
                        alert += ", " + timeLeft.Days + " days";
                    }

                    alert += " before you can use this command again!";
                    session.SendNotif(alert);
                    return(true);
                }
            }

            if (args.Length >= 3)
            {
                if (session.GetHabbo().HasPermission("cmd_hal"))
                {
                    MultiRevisionServerMessage message = new MultiRevisionServerMessage(OutgoingPacketsEnum.NotifFromMod, new ValueHolder("Message", TextUtilies.MergeArrayToString(args, 2) + "\n\n" + session.GetHabbo().Username, "Link", args[1]));

                    foreach (GameClient session_ in Skylight.GetGame().GetGameClientManager().GetClients())
                    {
                        try
                        {
                            session_.SendData(message.GetBytes(session_.Revision));
                        }
                        catch
                        {
                        }
                    }
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }