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


C# ServerMessage.AppendShort方法代码示例

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


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

示例1: Serialize

		internal void Serialize(ServerMessage Message, GameClient Session)
		{
			Relationship value = Session.GetHabbo().Relationships.FirstOrDefault((KeyValuePair<int, Relationship> x) => x.Value.UserId == Convert.ToInt32(this.UserId)).Value;
			int i = (value == null) ? 0 : value.Type;
			Message.AppendUInt(this.UserId);
			Message.AppendString(this.mUsername);
			Message.AppendInt32(1);
			if (!this.mAppearOffline || Session.GetHabbo().Rank >= 4u)
			{
				Message.AppendBoolean(this.IsOnline);
			}
			else
			{
				Message.AppendBoolean(false);
			}
			if (!this.mHideInroom || Session.GetHabbo().Rank >= 4u)
			{
				Message.AppendBoolean(this.InRoom);
			}
			else
			{
				Message.AppendBoolean(false);
			}
			Message.AppendString(this.IsOnline ? this.mLook : "");
			Message.AppendInt32(0);
			Message.AppendString(this.mMotto);
			Message.AppendString(string.Empty);
			Message.AppendString(string.Empty);
			Message.AppendBoolean(true);
			Message.AppendBoolean(false);
			Message.AppendBoolean(false);
			Message.AppendShort(i);
		}
开发者ID:BjkGkh,项目名称:Mercury,代码行数:33,代码来源:MessengerBuddy.cs

示例2: OnHeightmapUpdate

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

示例3: 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

示例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: NewHeightMap

 private ServerMessage NewHeightMap()
 {
     ServerMessage serverMessage = new ServerMessage();
     serverMessage.Init(Outgoing.HeightMapMessageComposer);
     serverMessage.AppendInt32(this.Model.MapSizeX);
     checked
     {
         serverMessage.AppendInt32(this.Model.MapSizeX * this.Model.MapSizeY);
         for (int i = 0; i < this.Model.MapSizeY; i++)
         {
             for (int j = 0; j < this.Model.MapSizeX; j++)
             {
                 serverMessage.AppendShort((short)(this.SqAbsoluteHeight(j, i) * 256));
               //  serverMessage.AppendShort(this.Model.SqFloorHeight[j, i] * 256);
             }
         }
         return serverMessage;
     }
 }
开发者ID:BjkGkh,项目名称:Mercury,代码行数:19,代码来源:Gamemap.cs


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