Ejemplo n.º 1
0
        /// <summary>
        ///     Serializes the tool.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <returns>ServerMessage.</returns>
        internal ServerMessage SerializeTool(GameClient session)
        {
            ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("LoadModerationToolMessageComposer"));

            serverMessage.AppendInteger(Tickets.Count);

            foreach (SupportTicket current in Tickets)
            {
                current.Serialize(serverMessage);
            }

            serverMessage.AppendInteger(UserMessagePresets.Count);

            foreach (string current2 in UserMessagePresets)
            {
                serverMessage.AppendString(current2);
            }

            IEnumerable <ModerationTemplate> enumerable =
                (from x in ModerationTemplates.Values where x.Category == -1 select x).ToArray();

            serverMessage.AppendInteger(enumerable.Count());
            using (IEnumerator <ModerationTemplate> enumerator3 = enumerable.GetEnumerator())
            {
                bool first = true;

                while (enumerator3.MoveNext())
                {
                    ModerationTemplate template = enumerator3.Current;
                    IEnumerable <ModerationTemplate> enumerable2 =
                        (from x in ModerationTemplates.Values where x.Category == (long)(ulong)template.Id select x)
                        .ToArray();
                    serverMessage.AppendString(template.CName);
                    serverMessage.AppendBool(first);
                    serverMessage.AppendInteger(enumerable2.Count());

                    foreach (ModerationTemplate current3 in enumerable2)
                    {
                        serverMessage.AppendString(current3.Caption);
                        serverMessage.AppendString(current3.BanMessage);
                        serverMessage.AppendInteger(current3.BanHours);
                        serverMessage.AppendInteger(Yupi.BoolToInteger(current3.AvatarBan));
                        serverMessage.AppendInteger(Yupi.BoolToInteger(current3.Mute));
                        serverMessage.AppendInteger(Yupi.BoolToInteger(current3.TradeLock));
                        serverMessage.AppendString(current3.WarningMessage);
                        serverMessage.AppendBool(true);
                    }

                    first = false;
                }
            }

            // but = button
            serverMessage.AppendBool(true);                                        //ticket_queue_but
            serverMessage.AppendBool(session.GetHabbo().HasFuse("fuse_chatlogs")); //chatlog_but
            serverMessage.AppendBool(session.GetHabbo().HasFuse("fuse_alert"));    //message_but
            serverMessage.AppendBool(true);                                        //modaction_but
            serverMessage.AppendBool(session.GetHabbo().HasFuse("fuse_ban"));      //ban_but
            serverMessage.AppendBool(true);
            serverMessage.AppendBool(session.GetHabbo().HasFuse("fuse_kick"));     //kick_but

            serverMessage.AppendInteger(RoomMessagePresets.Count);

            foreach (string current4 in RoomMessagePresets)
            {
                serverMessage.AppendString(current4);
            }

            return(serverMessage);
        }