Пример #1
0
        public static ServerPacket SerializeRoomChatlog(int roomID)
        {
            Room room = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(roomID);

            ServerPacket Message = new ServerPacket(ServerPacketHeader.ModeratorRoomChatlogMessageComposer);

            Message.WriteByte(1);

            Message.WriteShort(2);

            Message.WriteString("roomName");
            Message.WriteByte(2);
            Message.WriteString(room.RoomData.Name);

            Message.WriteString("roomId");
            Message.WriteByte(1);
            Message.WriteInteger(room.RoomData.Id);

            if (room == null)
            {
                Message.WriteShort(0);
                return(Message);
            }
            else
            {
                ChatMessageManager chatMessageManager = room.GetChatMessageManager();
                Message.WriteShort(chatMessageManager.messageCount);
                chatMessageManager.Serialize(ref Message);
                return(Message);
            }
        }
Пример #2
0
        public static ServerPacket SerializeTicketChatlog(SupportTicket Ticket, RoomData RoomData, double Timestamp)
        {
            Room         room    = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(RoomData.Id);
            ServerPacket message = new ServerPacket(ServerPacketHeader.ModeratorTicketChatlogMessageComposer);

            message.WriteInteger(Ticket.TicketId);
            message.WriteInteger(Ticket.SenderId);
            message.WriteInteger(Ticket.ReportedId);
            message.WriteInteger(RoomData.Id);

            message.WriteBoolean(false);
            message.WriteInteger(RoomData.Id);
            message.WriteString(RoomData.Name);

            if (room == null)
            {
                message.WriteInteger(0);
                return(message);
            }
            else
            {
                ChatMessageManager chatMessageManager = room.GetChatMessageManager();
                message.WriteInteger(chatMessageManager.messageCount);
                chatMessageManager.Serialize(ref message);
                return(message);
            }
        }
Пример #3
0
        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;
            //}
        }
Пример #4
0
        internal static ServerMessage SerializeRoomChatlog(UInt32 roomID)
        {
            Room currentRoom = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(roomID);

            ServerMessage Message = new ServerMessage(534);

            Message.AppendBoolean(currentRoom.IsPublic);
            Message.AppendUInt(currentRoom.RoomId);
            Message.AppendStringWithBreak(currentRoom.Name);

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

                return(Message);
            }

            //Room Room = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(RoomId);

            //if (Room == null)
            //{
            //    throw new NullReferenceException("Noo room found.");
            //}

            //Boolean IsPublic = false;

            //if (Room.Type.ToLower() == "public")
            //{
            //    IsPublic = true;
            //}

            //using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            //{
            //    dbClient.setQuery("SELECT user_id,user_name,hour,minute,message FROM chatlogs WHERE room_id = " + Room.RoomId + " ORDER BY timestamp DESC LIMIT 150");
            //    DataTable Data = dbClient.getTable();

            //    ServerMessage Message = new ServerMessage(535);
            //    Message.AppendBoolean(IsPublic);
            //    Message.AppendUInt(Room.RoomId);
            //    Message.AppendStringWithBreak(Room.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.AppendStringWithBreak((string)Row["user_name"]);
            //            Message.AppendStringWithBreak((string)Row["message"]);
            //        }
            //    }
            //    else
            //    {
            //        Message.AppendInt32(0);
            //    }

            //    return Message;
            //}
        }