本文整理汇总了C#中Cyber.Messages.ServerMessage.AppendShort方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.AppendShort方法的具体用法?C# ServerMessage.AppendShort怎么用?C# ServerMessage.AppendShort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cyber.Messages.ServerMessage
的用法示例。
在下文中一共展示了ServerMessage.AppendShort方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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 = CyberEnvironment.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 = CyberEnvironment.getHabboForId(current.UserId);
DateTime Date = CyberEnvironment.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;
}
示例2: SerializeUserChatlog
internal static ServerMessage SerializeUserChatlog(uint UserId)
{
ServerMessage result;
using (IQueryAdapter queryreactor = CyberEnvironment.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(CyberEnvironment.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 = CyberEnvironment.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 = CyberEnvironment.getHabboForId((uint)dataRow2["user_id"]);
CyberEnvironment.UnixToDateTime((double)dataRow2["timestamp"]);
if (habboForId == null)
{
result = null;
return result;
}
serverMessage.AppendInt32(checked((int)unchecked((double)CyberEnvironment.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;
}
示例3: 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;
}
}
示例4: 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);
}
示例5: 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);
}