Exemple #1
0
        internal void Serialize(ServerMessage Message, GameClient Session)
        {
            var Relationship = Session.GetHabbo().Relationships.FirstOrDefault(x => x.Value.UserId == Convert.ToInt32(UserId)).Value;
            int y = Relationship == null ? 0 : Relationship.Type;

            Message.AppendInt32(UserId);
            Message.AppendString(mUsername);
            Message.AppendInt32(1);
            if (!mAppearOffline || Session.GetHabbo().Rank >= 4)
                Message.AppendBoolean(IsOnline);
            else
                Message.AppendBoolean(false);

            if (!mHideInroom || Session.GetHabbo().Rank >= 4)
                Message.AppendBoolean(InRoom);
            else
                Message.AppendBoolean(false);

            Message.AppendString(IsOnline ? mLook : "");
            Message.AppendInt32(0); // categoryid
            Message.AppendString(mMotto);
            Message.AppendString(string.Empty); // Facebook username
            Message.AppendString(string.Empty);
            Message.AppendBoolean(true); // Allows offline messaging
            Message.AppendBoolean(false); // ?
            Message.AppendBoolean(false); // Uses phone
            Message.AppendShort(y);
        }
Exemple #2
0
        private ServerMessage GetRelativeHeightmap()
        {
            int area = MapSizeX * MapSizeY;

            ServerMessage Message = new ServerMessage(Outgoing.RelativeMap);
            Message.AppendInt32(MapSizeX);
            Message.AppendInt32(area);
            //int count = 0;
            for( int y = 0; y < MapSizeY; y++)
            {
                for (int x = 0; x < MapSizeX; x++)
                {
                    if (SqState[x, y] == SquareState.BLOCKED)
                        Message.AppendShort(-1);
                    else
                        Message.AppendShort(SqFloorHeight[x,y]<<8);
                    //count++;
                }
            }
            return Message;
        }
Exemple #3
0
        internal static ServerMessage SerializeRoomChatlog(uint roomID)
        {
            // NEW CHATLOGS [March 2014] Coded by Finn
            // Please don't remove credits, this took me some time to do... :(
            // Credits to Itachi for the structure's "context" enigma :D




            ServerMessage Message = new ServerMessage();
            RoomData Room = SilverwaveEnvironment.GetGame().GetRoomManager().GenerateRoomData(roomID);
            if (Room == null)
            {
                throw new NullReferenceException("No room found.");
            }




            Message.Init(Outgoing.RoomChatlog);
            Message.AppendByte(1);
            Message.AppendShort(2);
            Message.AppendString("roomName");
            Message.AppendByte(2);
            Message.AppendString(Room.Name);
            Message.AppendString("roomId");
            Message.AppendByte(1);
            Message.AppendInt32(Room.Id);




            Message.AppendShort(Room.RoomChat.Count);
            Room.RoomChat.Reverse();
            foreach (Chatlog Log in Room.RoomChat)
            {
                Habbo Habbo = SilverwaveEnvironment.getHabboForId(Log.UserId);
                DateTime Date = SilverwaveEnvironment.UnixToDateTime(Log.Timestamp);
                if (Habbo == null)
                {
                    Message.AppendInt32((DateTime.Now - Date).Seconds);
                    Message.AppendInt32(Log.UserId);
                    Message.AppendString("*User not found*");
                    Message.AppendString(Log.Message);
                    Message.AppendBoolean(true);
                }
                else
                {
                    Message.AppendInt32((DateTime.Now - Date).Seconds);
                    Message.AppendInt32(Habbo.Id);
                    Message.AppendString(Habbo.Username);
                    Message.AppendString(Log.Message);
                    Message.AppendBoolean(false); // Text is bold
                }
            }
            Room.RoomChat.Reverse();
            return Message;
        }