本文整理汇总了C#中Azure.Messages.ServerMessage.AppendShort方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.AppendShort方法的具体用法?C# ServerMessage.AppendShort怎么用?C# ServerMessage.AppendShort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Azure.Messages.ServerMessage
的用法示例。
在下文中一共展示了ServerMessage.AppendShort方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnHeightMapUpdate
/// <summary>
/// Called when [height map update].
/// </summary>
/// <param name="affectedTiles">The affected tiles.</param>
internal void OnHeightMapUpdate(ICollection affectedTiles)
{
var message = new ServerMessage(LibraryParser.OutgoingRequest("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);
}
示例2: Serialize
/// <summary>
/// Serializes the specified message.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="session">The session.</param>
internal void Serialize(ServerMessage message, GameClient session)
{
if (Id == 0)
{
message.AppendInteger(Id);
message.AppendString(UserName);
message.AppendInteger(1);
message.AppendBool(true);
message.AppendBool(false);
message.AppendString(_look);
message.AppendInteger(0); // category
message.AppendString(string.Empty);
message.AppendString(string.Empty); // realname
message.AppendString(string.Empty); // shit?
message.AppendBool(true); // offline message
message.AppendBool(false); // pocket user
message.AppendBool(false); // pocketHabboUser
message.AppendShort(0);
}
else
{
var value =
session.GetHabbo().Relationships.FirstOrDefault(x => x.Value.UserId == Convert.ToInt32(Id)).Value;
var i = (value == null) ? 0 : value.Type;
message.AppendInteger(Id);
message.AppendString(UserName);
message.AppendInteger(IsOnline);
message.AppendBool(IsOnline);
message.AppendBool(InRoom);
message.AppendString(IsOnline ? _look : string.Empty);
message.AppendInteger(0); // category
message.AppendString(IsOnline ? _motto : string.Empty);
message.AppendString(string.Empty); // realname
message.AppendString(string.Empty); // shit?
message.AppendBool(true); // offline message
message.AppendBool(false); // pocket user
message.AppendBool(false); // pocketHabboUser
message.AppendShort(i);
}
}
示例3: NewHeightMap
/// <summary>
/// News the height map.
/// </summary>
/// <returns>ServerMessage.</returns>
private ServerMessage NewHeightMap()
{
var serverMessage = new ServerMessage();
serverMessage.Init(LibraryParser.OutgoingRequest("HeightMapMessageComposer"));
serverMessage.AppendInteger(Model.MapSizeX);
{
serverMessage.AppendInteger(Model.MapSizeX * Model.MapSizeY);
for (Int32 i = 0; i < Model.MapSizeY; i++)
for (Int32 j = 0; j < Model.MapSizeX; j++)
serverMessage.AppendShort((short)(SqAbsoluteHeight(j, i) * 256));
// serverMessage.AppendShort(this.Model.SqFloorHeight[j, i] * 256);
return serverMessage;
}
}
示例4: SerializeUserChatlog
/// <summary>
/// Serializes the user chatlog.
/// </summary>
/// <param name="userId">The user identifier.</param>
/// <returns>ServerMessage.</returns>
internal static ServerMessage SerializeUserChatlog(uint userId)
{
ServerMessage result;
using (IQueryAdapter queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor())
{
queryReactor.SetQuery(string.Format("SELECT DISTINCT room_id FROM users_chatlogs WHERE user_id = {0} ORDER BY timestamp DESC LIMIT 4", userId));
DataTable table = queryReactor.GetTable();
var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("ModerationToolUserChatlogMessageComposer"));
serverMessage.AppendInteger(userId);
serverMessage.AppendString(AzureEmulator.GetGame().GetClientManager().GetNameById(userId));
if (table != null)
{
serverMessage.AppendInteger(table.Rows.Count);
IEnumerator enumerator = table.Rows.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
var dataRow = (DataRow)enumerator.Current;
queryReactor.SetQuery(string.Concat("SELECT user_id,timestamp,message FROM users_chatlogs WHERE room_id = ", (uint)dataRow["room_id"], " AND user_id = ", userId, " ORDER BY timestamp DESC LIMIT 30"));
DataTable table2 = queryReactor.GetTable();
RoomData roomData = AzureEmulator.GetGame().GetRoomManager().GenerateRoomData((uint)dataRow["room_id"]);
if (table2 != null)
{
serverMessage.AppendByte(1);
serverMessage.AppendShort(2);
serverMessage.AppendString("roomName");
serverMessage.AppendByte(2);
serverMessage.AppendString(roomData == null ? "This room was deleted" : roomData.Name);
serverMessage.AppendString("roomId");
serverMessage.AppendByte(1);
serverMessage.AppendInteger((uint)dataRow["room_id"]);
serverMessage.AppendShort(table2.Rows.Count);
IEnumerator enumerator2 = table2.Rows.GetEnumerator();
try
{
while (enumerator2.MoveNext())
{
var dataRow2 = (DataRow)enumerator2.Current;
Habbo habboForId = AzureEmulator.GetHabboById((uint)dataRow2["user_id"]);
AzureEmulator.UnixToDateTime((double)dataRow2["timestamp"]);
if (habboForId == null)
{
return null;
}
serverMessage.AppendInteger(((int)(AzureEmulator.GetUnixTimeStamp() - (double)dataRow2["timestamp"])));
serverMessage.AppendInteger(habboForId.Id);
serverMessage.AppendString(habboForId.UserName);
serverMessage.AppendString(dataRow2["message"].ToString());
serverMessage.AppendBool(false);
}
continue;
}
finally
{
var disposable = enumerator2 as IDisposable;
if (disposable != null)
{
disposable.Dispose();
}
}
}
serverMessage.AppendByte(1);
serverMessage.AppendShort(0);
serverMessage.AppendShort(0);
}
goto IL_29B;
}
finally
{
var disposable2 = enumerator as IDisposable;
if (disposable2 != null)
{
disposable2.Dispose();
}
}
}
serverMessage.AppendInteger(0);
IL_29B:
result = serverMessage;
}
return result;
}
示例5: SerializeTicketChatlog
/// <summary>
/// Serializes the ticket chatlog.
/// </summary>
/// <param name="ticket">The ticket.</param>
/// <param name="roomData">The room data.</param>
/// <param name="timestamp">The timestamp.</param>
/// <returns>ServerMessage.</returns>
/// <exception cref="System.NullReferenceException">No room found.</exception>
internal static ServerMessage SerializeTicketChatlog(SupportTicket ticket, RoomData roomData, double timestamp)
{
var message = new ServerMessage();
RoomData room = AzureEmulator.GetGame().GetRoomManager().GenerateRoomData(ticket.RoomId);
//if (room == null)
//{
// throw new NullReferenceException("No room found.");
//}
message.Init(LibraryParser.OutgoingRequest("ModerationToolIssueChatlogMessageComposer"));
message.AppendInteger(ticket.TicketId);
message.AppendInteger(ticket.SenderId);
message.AppendInteger(ticket.ReportedId);
message.AppendInteger(ticket.RoomId);
message.AppendByte(1);
message.AppendShort(2);
message.AppendString("roomName");
message.AppendByte(2);
message.AppendString(ticket.RoomName);
message.AppendString("roomId");
message.AppendByte(1);
message.AppendInteger(ticket.RoomId);
var tempChatlogs = room.RoomChat.Reverse().Skip(Math.Max(0, room.RoomChat.Count() - 60)).Take(60).ToList();
message.AppendShort(tempChatlogs.Count());
foreach (var chatLog in tempChatlogs)
{
chatLog.Serialize(ref message);
}
tempChatlogs = null;
return message;
}
示例6: SerializeRoomChatlog
/// <summary>
/// Serializes the room chatlog.
/// </summary>
/// <param name="roomId">The room identifier.</param>
/// <returns>ServerMessage.</returns>
/// <exception cref="System.NullReferenceException">No room found.</exception>
internal static ServerMessage SerializeRoomChatlog(uint roomId)
{
var message = new ServerMessage();
Room room = AzureEmulator.GetGame().GetRoomManager().LoadRoom(roomId);
message.Init(LibraryParser.OutgoingRequest("ModerationToolRoomChatlogMessageComposer"));
message.AppendByte(1); //type
message.AppendShort(2);
message.AppendString("roomName");
message.AppendByte(2);
message.AppendString(room.RoomData.Name);
message.AppendString("roomId");
message.AppendByte(1);
message.AppendInteger(room.RoomData.Id);
if (room != null)
{
var tempChatlogs = room.RoomData.RoomChat.Reverse().Skip(Math.Max(0, room.RoomData.RoomChat.Count() - 150)).Take(150).ToList();
message.AppendShort(tempChatlogs.Count());
foreach (var chatLog in tempChatlogs)
{
chatLog.Serialize(ref message);
}
tempChatlogs = null;
}
else
{
DateTime Date = AzureEmulator.UnixToDateTime(1413672144);
message.AppendInteger((DateTime.Now - Date).Seconds); // niet goed denk ik
message.AppendInteger(1);
message.AppendString("*Kamer is niet geladen!*");
message.AppendString("");
message.AppendBool(false);
}
return message;
}
示例7: Serialize
/// <summary>
/// Serializes the specified message.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="session">The session.</param>
internal void Serialize(ServerMessage message, GameClient session)
{
var value =
session.GetHabbo().Relationships.FirstOrDefault(x => x.Value.UserId == Convert.ToInt32(Id)).Value;
var i = value?.Type ?? 0;
message.AppendInteger(Id);
message.AppendString(UserName);
message.AppendInteger(IsOnline || Id == 0);
message.AppendBool(Id == 0 || (!_appearOffline || session.GetHabbo().Rank >= 4) && IsOnline);
message.AppendBool(Id != 0 && (!_hideInroom || session.GetHabbo().Rank >= 4) && InRoom);
message.AppendString(IsOnline || Id == 0 ? _look : string.Empty);
message.AppendInteger(0);
message.AppendString(_motto);
message.AppendString(string.Empty);
message.AppendString(string.Empty);
message.AppendBool(true);
message.AppendBool(false);
message.AppendBool(false);
message.AppendShort(i);
}
示例8: SerializeRoomChatlog
/// <summary>
/// Serializes the room chatlog.
/// </summary>
/// <param name="roomId">The room identifier.</param>
/// <returns>ServerMessage.</returns>
/// <exception cref="System.NullReferenceException">No room found.</exception>
internal static ServerMessage SerializeRoomChatlog(uint roomId)
{
var message = new ServerMessage();
var room = Azure.GetGame().GetRoomManager().LoadRoom(roomId);
if (room?.RoomData != null)
{
message.Init(LibraryParser.OutgoingRequest("ModerationToolRoomChatlogMessageComposer"));
message.AppendByte(1);
message.AppendShort(2);
message.AppendString("roomName");
message.AppendByte(2);
message.AppendString(room.RoomData.Name);
message.AppendString("roomId");
message.AppendByte(1);
message.AppendInteger(room.RoomData.Id);
var tempChatlogs =
room.RoomData.RoomChat.Reverse()
.Skip(Math.Max(0, room.RoomData.RoomChat.Count - 60))
.Take(60)
.ToList();
message.AppendShort(tempChatlogs.Count);
foreach (var chatLog in tempChatlogs)
chatLog.Serialize(ref message);
return message;
}
return null;
}