当前位置: 首页>>代码示例>>C#>>正文


C# ServerMessage.AppendByte方法代码示例

本文整理汇总了C#中Mercury.Messages.ServerMessage.AppendByte方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.AppendByte方法的具体用法?C# ServerMessage.AppendByte怎么用?C# ServerMessage.AppendByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mercury.Messages.ServerMessage的用法示例。


在下文中一共展示了ServerMessage.AppendByte方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnHeightmapUpdate

 internal void OnHeightmapUpdate(ICollection affectedTiles)
 {
     ServerMessage Message = new ServerMessage(Outgoing.UpdateFurniStackMapMessageComposer);
     Message.AppendByte((byte)affectedTiles.Count);
     foreach (Point Coord in affectedTiles)
     {
         Message.AppendByte((byte)Coord.X);
         Message.AppendByte((byte)Coord.Y);
         Message.AppendShort((short)(room.GetGameMap().SqAbsoluteHeight(Coord.X, Coord.Y) * 256));
     }
     room.SendMessage(Message);
 }
开发者ID:BjkGkh,项目名称:Mercury,代码行数:12,代码来源:RoomItemHandling.cs

示例2: SerializeRoomChatlog

		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 = MercuryEnvironment.GetGame().GetRoomManager().GenerateRoomData(roomID);
			if (Room == null)
			{
                throw new NullReferenceException("No room found.");
			}

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


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

            return Message;
		}
开发者ID:BjkGkh,项目名称:Mercury,代码行数:51,代码来源:ModerationTool.cs

示例3: OnTrigger


//.........这里部分代码省略.........
				{
					serverMessage15.AppendUInt(current15.Id);
				}
				serverMessage15.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage15.AppendUInt(Item.Id);
				serverMessage15.AppendString(ExtraInfo);
				serverMessage15.AppendInt32(0);
				serverMessage15.AppendInt32(0);
				serverMessage15.AppendInt32(7);
				serverMessage15.AppendInt32(0);
				serverMessage15.AppendInt32(0);
				serverMessage15.AppendInt32(0);
				Session.SendMessage(serverMessage15);
				return;
			}
			case InteractionType.actionteleportto:
			{
				ServerMessage serverMessage16 = new ServerMessage(Outgoing.WiredEffectMessageComposer);
				serverMessage16.AppendBoolean(false);
				serverMessage16.AppendInt32(5);
				serverMessage16.AppendInt32(list.Count);
				foreach (RoomItem current16 in list)
				{
					serverMessage16.AppendUInt(current16.Id);
				}
				serverMessage16.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage16.AppendUInt(Item.Id);
				serverMessage16.AppendString(ExtraInfo);
				serverMessage16.AppendInt32(0);
				serverMessage16.AppendInt32(8);
				serverMessage16.AppendInt32(0);
				serverMessage16.AppendInt32(i);
				serverMessage16.AppendInt32(0);
				serverMessage16.AppendByte(2);
				Session.SendMessage(serverMessage16);
				return;
			}
			case InteractionType.actiontogglestate:
			{
				ServerMessage serverMessage17 = new ServerMessage(Outgoing.WiredEffectMessageComposer);
				serverMessage17.AppendBoolean(false);
				serverMessage17.AppendInt32(5);
				serverMessage17.AppendInt32(list.Count);
				foreach (RoomItem current17 in list)
				{
					serverMessage17.AppendUInt(current17.Id);
				}
				serverMessage17.AppendInt32(Item.GetBaseItem().SpriteId);
				serverMessage17.AppendUInt(Item.Id);
				serverMessage17.AppendString(ExtraInfo);
				serverMessage17.AppendInt32(0);
				serverMessage17.AppendInt32(8);
				serverMessage17.AppendInt32(0);
				serverMessage17.AppendInt32(i);
				serverMessage17.AppendInt32(0);
				serverMessage17.AppendInt32(0);
				Session.SendMessage(serverMessage17);
				return;
			}
			case InteractionType.actiongivereward:
			{
				ServerMessage serverMessage18 = new ServerMessage(Outgoing.WiredEffectMessageComposer);
				serverMessage18.AppendBoolean(false);
				serverMessage18.AppendInt32(5);
				serverMessage18.AppendInt32(0);
				serverMessage18.AppendInt32(Item.GetBaseItem().SpriteId);
开发者ID:BjkGkh,项目名称:Mercury,代码行数:67,代码来源:InteractorWired.cs

示例4: SerializeUserChatlog

        internal static ServerMessage SerializeUserChatlog(uint UserId)
        {
            ServerMessage result;
            using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
            {
                queryreactor.setQuery("SELECT DISTINCT room_id FROM chatlogs WHERE user_id = " + UserId + " ORDER BY timestamp DESC LIMIT 4");
                DataTable table = queryreactor.getTable();
                ServerMessage serverMessage = new ServerMessage(Outgoing.ModerationToolUserChatlogMessageComposer);
                serverMessage.AppendUInt(UserId);
                serverMessage.AppendString(MercuryEnvironment.GetGame().GetClientManager().GetNameById(UserId));
                if (table != null)
                {
                    serverMessage.AppendInt32(table.Rows.Count);
                    IEnumerator enumerator = table.Rows.GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            DataRow dataRow = (DataRow)enumerator.Current;
                            queryreactor.setQuery(string.Concat(new object[]
							{
								"SELECT user_id,timestamp,message FROM chatlogs WHERE room_id = ",
								(uint)dataRow["room_id"],
								" AND user_id = ",
								UserId,
								" ORDER BY timestamp DESC LIMIT 30"
							}));
                            DataTable table2 = queryreactor.getTable();
                            RoomData roomData = MercuryEnvironment.GetGame().GetRoomManager().GenerateRoomData((uint)dataRow["room_id"]);
                            if (table2 != null)
                            {
                                serverMessage.AppendByte(1);
                                serverMessage.AppendShort(2);
                                serverMessage.AppendString("roomName");
                                serverMessage.AppendByte(2);
                                if (roomData == null)
                                {
                                    serverMessage.AppendString("This room was deleted");
                                }
                                else
                                {
                                    serverMessage.AppendString(roomData.Name);
                                }
                                serverMessage.AppendString("roomId");
                                serverMessage.AppendByte(1);
                                serverMessage.AppendUInt((uint)dataRow["room_id"]);
                                serverMessage.AppendShort(table2.Rows.Count);
                                IEnumerator enumerator2 = table2.Rows.GetEnumerator();
                                try
                                {
                                    while (enumerator2.MoveNext())
                                    {
                                        DataRow dataRow2 = (DataRow)enumerator2.Current;
                                        Habbo habboForId = MercuryEnvironment.getHabboForId((uint)dataRow2["user_id"]);
                                        MercuryEnvironment.UnixToDateTime((double)dataRow2["timestamp"]);
                                        if (habboForId == null)
                                        {
                                            result = null;
                                            return result;
                                        }
                                        serverMessage.AppendInt32(checked((int)unchecked((double)MercuryEnvironment.GetUnixTimestamp() - (double)dataRow2["timestamp"])));
                                        serverMessage.AppendUInt(habboForId.Id);
                                        serverMessage.AppendString(habboForId.Username);
                                        serverMessage.AppendString(dataRow2["message"].ToString());
                                        serverMessage.AppendBoolean(false);
                                    }
                                    continue;
                                }
                                finally
                                {
                                    IDisposable disposable = enumerator2 as IDisposable;
                                    if (disposable != null)
                                    {
                                        disposable.Dispose();
                                    }
                                }
                            }
                            serverMessage.AppendByte(1);
                            serverMessage.AppendShort(0);
                            serverMessage.AppendShort(0);
                        }
                        goto IL_29B;
                    }
                    finally
                    {
                        IDisposable disposable2 = enumerator as IDisposable;
                        if (disposable2 != null)
                        {
                            disposable2.Dispose();
                        }
                    }
                }
                serverMessage.AppendInt32(0);
            IL_29B:
                result = serverMessage;
            }
            return result;
        }
开发者ID:BjkGkh,项目名称:Mercury,代码行数:98,代码来源:ModerationTool.cs

示例5: GetGroupForumThreadRoot

        internal void GetGroupForumThreadRoot()
        {
            uint GroupId = Request.PopWiredUInt();
            int StartIndex = Request.PopWiredInt32();
            int EndIndex = Request.PopWiredInt32(); // igual siempre será 20.

            Guild Group = MercuryEnvironment.GetGame().GetGroupManager().GetGroup(GroupId);
            if (Group == null || !Group.HasForum)
            {
                return;
            }

            using (IQueryAdapter dbClient = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT * FROM group_forum_posts WHERE group_id = '" + GroupId + "' AND parent_id = 0 ORDER BY timestamp DESC;");
                DataTable Table = dbClient.getTable();

                if (Table == null)
                {
                    ServerMessage Méssich = new ServerMessage(Outgoing.GroupForumThreadRootMessageComposer);
                    Méssich.AppendUInt(GroupId);
                    Méssich.AppendInt32(0);
                    Méssich.AppendInt32(0);
                    Session.SendMessage(Méssich);
                    return;
                }

                int b = (Table.Rows.Count <= 20) ? Table.Rows.Count : 20;
                List<GroupForumPost> Threads = new List<GroupForumPost>();
                int i = 1;
                while (i <= b)
                {
                    DataRow Row = Table.Rows[i - 1];
                    if (Row == null)
                    {
                        b--;
                        continue;
                    }
                    GroupForumPost thread = new GroupForumPost(Row);
                    
                    Threads.Add(thread);
                    i++;
                }
                Threads = Threads.OrderByDescending(x => x.Pinned).ToList();

                ServerMessage Message = new ServerMessage(Outgoing.GroupForumThreadRootMessageComposer);
                Message.AppendUInt(GroupId);
                Message.AppendInt32(StartIndex);
                Message.AppendInt32(b);
                foreach (GroupForumPost Thread in Threads)
                {
                    Message.AppendUInt(Thread.Id);
                    Message.AppendUInt(Thread.PosterId);
                    Message.AppendString(Thread.PosterName);
                    Message.AppendString(Thread.Subject);
                    Message.AppendBoolean(Thread.Pinned);
                    Message.AppendBoolean(Thread.Locked);
                    Message.AppendInt32((MercuryEnvironment.GetUnixTimestamp() - Thread.Timestamp));
                    Message.AppendInt32(Thread.MessageCount + 1);
                    Message.AppendInt32(0);
                    Message.AppendInt32(0);//readtimes?
                    Message.AppendInt32(0);
                    Message.AppendString("");
                    Message.AppendInt32((MercuryEnvironment.GetUnixTimestamp() - Thread.Timestamp));
                    Message.AppendByte((Thread.Hidden) ? 10 : 1);
                    Message.AppendInt32(0);
                    Message.AppendString(Thread.Hider);
                    Message.AppendInt32(0);//Unknown, but unused. Parece ID
                }
                Session.SendMessage(Message);
            }
        }
开发者ID:BjkGkh,项目名称:Mercury,代码行数:72,代码来源:GameClientMessageHandler.cs

示例6: ReadForumThread

        internal void ReadForumThread()
        {
            uint GroupId = Request.PopWiredUInt();
            uint ThreadId = Request.PopWiredUInt();
            int StartIndex = Request.PopWiredInt32();
            int EndIndex = Request.PopWiredInt32();

            Guild Group = MercuryEnvironment.GetGame().GetGroupManager().GetGroup(GroupId);
            if (Group == null || !Group.HasForum)
            {
                return;
            }

            using (IQueryAdapter dbClient = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT * FROM group_forum_posts WHERE group_id = '" + GroupId + "' AND parent_id = '" + ThreadId + "' OR id = '" + ThreadId + "' ORDER BY timestamp ASC;");
                DataTable Table = dbClient.getTable();

                if (Table == null)
                {
                    return;
                }

                int b = (Table.Rows.Count <= 20) ? Table.Rows.Count : 20;
                List<GroupForumPost> posts = new List<GroupForumPost>();
                int i = 1;
                while (i <= b)
                {
                    DataRow Row = Table.Rows[i - 1];
                    if (Row == null)
                    {
                        b--;
                        continue;
                    }
                    GroupForumPost thread = new GroupForumPost(Row);
                    if (thread.ParentId == 0 && thread.Hidden)
                    {
                        return;//
                    }

                    posts.Add(thread);
                    i++;
                }

                ServerMessage Message = new ServerMessage(Outgoing.GroupForumReadThreadMessageComposer);
                Message.AppendUInt(GroupId);
                Message.AppendUInt(ThreadId);
                Message.AppendInt32(StartIndex);
                Message.AppendInt32(b);

                int indx = 0;

                foreach (GroupForumPost Post in posts)
                {
                    Message.AppendInt32(indx++ - 1);
                    Message.AppendInt32(indx - 1);
                    Message.AppendUInt(Post.PosterId);
                    Message.AppendString(Post.PosterName);
                    Message.AppendString(Post.PosterLook);
                    Message.AppendInt32((MercuryEnvironment.GetUnixTimestamp() - Post.Timestamp));
                    Message.AppendString(Post.PostContent);
                    Message.AppendByte(0);
                    Message.AppendInt32(0);
                    Message.AppendString(Post.Hider);
                    Message.AppendInt32(0);//Unknown, but unused. Parece ID
                }
                Session.SendMessage(Message);
            }
        }
开发者ID:BjkGkh,项目名称:Mercury,代码行数:69,代码来源:GameClientMessageHandler.cs

示例7: AlterForumThreadState

        internal void AlterForumThreadState()
        {
            uint GroupId = Request.PopWiredUInt();
            uint ThreadId = Request.PopWiredUInt();
            int StateToSet = Request.PopWiredInt32();


            using (IQueryAdapter dbClient = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT * FROM group_forum_posts WHERE group_id = '" + GroupId + "' AND id = '" + ThreadId + "' LIMIT 1;");
                DataRow Row = dbClient.getRow();
                Guild Group = MercuryEnvironment.GetGame().GetGroupManager().GetGroup(GroupId);
                if (Row != null)
                {
                    if ((uint)Row["poster_id"] == Session.GetHabbo().Id || Group.Admins.ContainsKey(Session.GetHabbo().Id))
                    {
                        dbClient.setQuery("UPDATE group_forum_posts SET hidden = @hid WHERE id = " + ThreadId + ";");
                        dbClient.addParameter("hid", (StateToSet == 10) ? "1" : "0");
                        dbClient.runQuery();
                    }
                }

                GroupForumPost Thread = new GroupForumPost(Row);

                ServerMessage Notif = new ServerMessage(Outgoing.SuperNotificationMessageComposer);
                Notif.AppendString((StateToSet == 10) ? "forums.thread.hidden" : "forums.thread.restored");
                    Notif.AppendInt32(0);
                    Session.SendMessage(Notif);

                if (Thread.ParentId != 0)
                {
                    return;
                }
                ServerMessage Message = new ServerMessage(Outgoing.GroupForumThreadUpdateMessageComposer);
                Message.AppendUInt(GroupId);
                Message.AppendUInt(Thread.Id);
                Message.AppendUInt(Thread.PosterId);
                Message.AppendString(Thread.PosterName);
                Message.AppendString(Thread.Subject);
                Message.AppendBoolean(Thread.Pinned);
                Message.AppendBoolean(Thread.Locked);
                Message.AppendInt32((MercuryEnvironment.GetUnixTimestamp() - Thread.Timestamp));
                Message.AppendInt32(Thread.MessageCount + 1);
                Message.AppendInt32(0);
                Message.AppendInt32(0);//readtimes?
                Message.AppendInt32(0);
                Message.AppendString("");
                Message.AppendInt32((MercuryEnvironment.GetUnixTimestamp() - Thread.Timestamp));
                Message.AppendByte(StateToSet);
                Message.AppendInt32(0);
                Message.AppendString(Thread.Hider);
                Message.AppendInt32(0);//Unknown, but unused. Parece ID
                Session.SendMessage(Message);
            }
        }
开发者ID:BjkGkh,项目名称:Mercury,代码行数:55,代码来源:GameClientMessageHandler.cs

示例8: PublishForumThread

        internal void PublishForumThread()
        {
            if ((MercuryEnvironment.GetUnixTimestamp() - Session.GetHabbo().lastSqlQuery) < 20)
            {
                Session.SendNotif("Please wait 20 seconds before publishing the next post!");
                return;
            }

            uint GroupId = Request.PopWiredUInt();
            uint ThreadId = Request.PopWiredUInt();
            string Subject = Request.PopFixedString();
            string Content = Request.PopFixedString();

            Guild Group = MercuryEnvironment.GetGame().GetGroupManager().GetGroup(GroupId);
            
            if (Group == null || !Group.HasForum)
            {
                return;
            }

            int Timestamp = MercuryEnvironment.GetUnixTimestamp();

            using (IQueryAdapter dbClient = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
            {
                if (ThreadId != 0)
                {
                    dbClient.setQuery("SELECT * FROM group_forum_posts WHERE id = " + ThreadId);
                    DataRow Row = dbClient.getRow();
                    GroupForumPost Post = new GroupForumPost(Row);

                    if (Post.Locked || Post.Hidden)
                    {
                        Session.SendNotif("¡No puedes publicar a este tema porque está oculto y/o bloqueado! Por favor, haz clic en 'Cancelar'.");
                        return;
                    }
                }

                this.Session.GetHabbo().lastSqlQuery = MercuryEnvironment.GetUnixTimestamp();
                dbClient.setQuery("INSERT INTO group_forum_posts (group_id, parent_id, timestamp, poster_id, poster_name, poster_look, subject, post_content) VALUES (@gid, @pard, @ts, @pid, @pnm, @plk, @subjc, @content)");
                dbClient.addParameter("gid", GroupId);
                dbClient.addParameter("pard", ThreadId);
                dbClient.addParameter("ts", Timestamp);
                dbClient.addParameter("pid", Session.GetHabbo().Id);
                dbClient.addParameter("pnm", Session.GetHabbo().Username);
                dbClient.addParameter("plk", Session.GetHabbo().Look);
                dbClient.addParameter("subjc", Subject);
                dbClient.addParameter("content", Content);
                ThreadId = (uint)dbClient.getInteger();
            }

            Group.ForumScore += 0.25;
            Group.ForumLastPosterName = Session.GetHabbo().Username;
            Group.ForumLastPosterId = Session.GetHabbo().Id;
            Group.ForumLastPosterTimestamp = Timestamp;
            Group.ForumMessagesCount++;
            Group.UpdateForum();

            if (ThreadId == 0)
            {
                ServerMessage Message = new ServerMessage(Outgoing.GroupForumNewThreadMessageComposer);
                Message.AppendUInt(GroupId);
                Message.AppendUInt(ThreadId);
                Message.AppendUInt(Session.GetHabbo().Id);
                Message.AppendString(Subject);
                Message.AppendString(Content);
                Message.AppendBoolean(false);
                Message.AppendBoolean(false);
                Message.AppendInt32((MercuryEnvironment.GetUnixTimestamp() - Timestamp));
                Message.AppendInt32(1);
                Message.AppendInt32(0);
                Message.AppendInt32(0);//readtimes?
                Message.AppendInt32(1);
                Message.AppendString("");
                Message.AppendInt32((MercuryEnvironment.GetUnixTimestamp() - Timestamp));
                Message.AppendByte(1);
                Message.AppendInt32(1);
                Message.AppendString("");
                Message.AppendInt32(0);//Unknown, but unused. Parece ID
                Session.SendMessage(Message);
            }
            else
            {
                ServerMessage Message = new ServerMessage(Outgoing.GroupForumNewResponseMessageComposer);
                Message.AppendUInt(GroupId);
                Message.AppendUInt(ThreadId);
                Message.AppendUInt(Group.ForumMessagesCount);//something quick
                Message.AppendInt32(0);//something quick
                Message.AppendUInt(Session.GetHabbo().Id);
                Message.AppendString(Session.GetHabbo().Username);
                Message.AppendString(Session.GetHabbo().Look);
                Message.AppendInt32((MercuryEnvironment.GetUnixTimestamp() - Timestamp));
                Message.AppendString(Content);
                Message.AppendByte(0);
                Message.AppendInt32(0);
                Message.AppendString("");
                Message.AppendInt32(0);//Unknown, but unused. Parece ID
                Session.SendMessage(Message);
            }
        }
开发者ID:BjkGkh,项目名称:Mercury,代码行数:99,代码来源:GameClientMessageHandler.cs


注:本文中的Mercury.Messages.ServerMessage.AppendByte方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。