本文整理汇总了C#中Packet.ReadLong方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.ReadLong方法的具体用法?C# Packet.ReadLong怎么用?C# Packet.ReadLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet.ReadLong方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UserAuthenticationRequest
/// <summary>
/// Initializes new instance of <see cref="UserAuthenticationRequest"/> struct.
/// </summary>
/// <param name="p"><see cref="Packet"/> to initialize from.</param>
public UserAuthenticationRequest( Packet p )
{
RequestID = p.ReadLong();
Login = p.ReadString();
Password = p.ReadString();
SessionID = p.ReadInt();
}
示例2: AddEntry
public static void AddEntry(TNLConnection session, Packet packet, SocialType type)
{
packet.ReadPadding(4);
var coid = packet.ReadLong();
/*var name = */packet.ReadUtf8StringOn(17);
packet.ReadPadding(7);
DataAccess.Social.AddEntry(session.CurrentCharacter.GetCOID(), coid, type);
}
示例3: CacheUserSessionRequest
/// <summary>
/// Initializes new instance of <see cref="CacheUserSessionRequest"/> struct.
/// </summary>
/// <param name="p"><see cref="Packet"/> to initialize from.</param>
public CacheUserSessionRequest( Packet p )
{
RequestID = p.ReadLong();
UserSession session = new UserSession();
session.AccountName = p.ReadString();
session.IPAddress = p.ReadString();
session.ID = p.ReadInt();
session.AccountID = p.ReadInt();
session.Login1 = p.ReadInt();
session.Login2 = p.ReadInt();
session.Play1 = p.ReadInt();
session.Play2 = p.ReadInt();
session.StartTime = p.InternalReadDateTime();
Session = session;
}
示例4: HandleMigration
public static void HandleMigration(Client pClient, Packet pPacket)
{
int CharacterId = pPacket.ReadInt();
pPacket.Skip(18);
long SessionId = pPacket.ReadLong();
if (Master.Instance.Worlds[pClient.World].EligableMigration(CharacterId, SessionId, false))
{
pClient.SessionId = SessionId;
pClient.Character = Master.Instance.Accessor.GetCharacter(CharacterId);
pClient.Account = Master.Instance.Accessor.GetAccount(pClient.Character.AccountId);
if (pClient.Character.Id != CharacterId)
{
pClient.Session.Disconnect();
return;
}
pClient.Character.Client = pClient;
if (pClient.Account.LoggedIn == 2)
{
pClient.Session.Disconnect();
return;
}
pClient.Account.LoggedIn = 2;
if (Master.Instance.Worlds[pClient.World].CashShopMigration(pClient.Character.Id))
{
CashShopHandler.HandleEnter(pClient, pPacket);
}
else
{
pClient.SendPacket(MapPacket.EnterFieldNew(pClient.Character));
Master.Instance.Worlds[pClient.World].Channels[pClient.Channel].Maps[pClient.Character.MapId].AddPlayer(pClient.Character);
}
}
else
{
Console.WriteLine("[{0}] Migration failed.", pClient.Session.IP);
}
}
示例5: HandleBroadcast
public static void HandleBroadcast(TNLConnection conn, Packet packet)
{
var type = (ChatType) packet.ReadUInteger();
var sendercoid = packet.ReadLong();
var isGm = packet.ReadBoolean();
packet.ReadPadding(1);
var msglen = packet.ReadUShort();
var sender = packet.ReadUtf8StringOn(17);
var msg = packet.ReadUtf8StringOn(msglen);
if (msg.StartsWith("/"))
{
if (msg.Equals("/save"))
conn.CurrentCharacter.SaveToDB();
return;
}
conn.CurrentCharacter.GetMap().BroadcastChat(type, ConstructBroadcastPacket(type, isGm, sender, sendercoid, msg), conn.CurrentCharacter);
}
示例6: UserAuthenticationResponse
/// <summary>
/// Initializes new instance of <see cref="UserAuthenticationResponse"/> struct.
/// </summary>
/// <param name="p"><see cref="Packet"/> to initialize from.</param>
public UserAuthenticationResponse( Packet p )
{
RequestID = p.ReadLong();
Response = ( UserAuthenticationResponseType )p.ReadByte();
switch ( Response )
{
case UserAuthenticationResponseType.UserAccepted:
{
UserID = p.ReadInt();
LastWorldID = p.ReadByte();
AccessLevel = p.ReadByte();
return;
}
default:
{
UserID = -1;
LastWorldID = 1;
AccessLevel = 0;
return;
}
}
}
示例7: JoinWorldRequest
/// <summary>
/// Initializes new instance of <see cref="JoinWorldRequest"/> struct.
/// </summary>
/// <param name="p"><see cref="Packet"/> to initialize from.</param>
public JoinWorldRequest( Packet p )
{
RequestID = p.ReadLong();
SessionID = p.ReadInt();
WorldID = p.ReadByte();
}
示例8: WorldsListRequest
/// <summary>
/// Initializes new instance of <see cref="WorldsListRequest"/> struct.
/// </summary>
/// <param name="p"><see cref="Packet"/> to initialize from.</param>
public WorldsListRequest( Packet p )
{
RequestID = p.ReadLong();
}
示例9: HandleGameEvent
public static void HandleGameEvent(byte eventID, Packet p)
{
switch ((GameServer.GameEvents)eventID)
{
case GameServer.GameEvents.Block_Set:
SetBlock(p.ReadShort(), p.ReadShort(), p.ReadShort(), true, p.ReadByte());
break;
case GameServer.GameEvents.Block_Set_ID:
SetBlock(p.ReadShort(), p.ReadShort(), p.ReadShort());
break;
case GameServer.GameEvents.Block_Set_MD:
short X = p.ReadShort();
short Y = p.ReadShort();
SetBlockMetaData(X, Y, p.ReadByte());
break;
case GameServer.GameEvents.Block_Set_Line:
short startX = p.ReadShort();
short startY = p.ReadShort();
long maskID = p.ReadLong();
long maskMD = p.ReadLong();
bool[] IDUpdate = maskID.BitMaskToBools();
bool[] MDUpdate = maskMD.BitMaskToBools();
for (int i = 0; i < 64; i++)
{
if (IDUpdate[i])
{
SetBlock(startX, startY + i, p.ReadShort());
}
if (MDUpdate[i])
{
SetBlockMetaData(startX, startY + i, p.ReadByte());
}
}
break;
case GameServer.GameEvents.Player_Chat:
byte playerID = p.ReadByte();
bool teamChat = p.ReadBool();
string chatText = p.ReadString();
if (playerID == ThePlayer.PlayerEntity.PlayerID)
{
ChatInterface.AddChat(new ChatEntry(ThePlayer.PlayerEntity.PlayerName, chatText, Color.White, teamChat));
}
else if (playerID != 0)
{
foreach (PlayerEntity pe in OtherPlayers)
{
if (pe.PlayerID == playerID)
{
ChatInterface.AddChat(new ChatEntry(pe.PlayerName, chatText, Color.White, teamChat));
}
}
}
else
{
ChatInterface.AddChat(new ChatEntry("Server", chatText, Color.Blue, false));
}
break;
case GameServer.GameEvents.Player_Position:
playerID = p.ReadByte();
int x = p.ReadInt();
int y = p.ReadInt();
if (playerID == ThePlayer.PlayerEntity.PlayerID)
{
ThePlayer.PlayerEntity.EntityPosition = new Vector2(x, y);
}
else
{
foreach (PlayerEntity pe in OtherPlayers)
{
if (pe.PlayerID == playerID)
{
pe.EntityPosition = new Vector2(x, y);
}
}
}
break;
case GameServer.GameEvents.Player_Aim_And_Position:
playerID = p.ReadByte();
x = p.ReadShort();
y = p.ReadShort();
if (playerID == ThePlayer.PlayerEntity.PlayerID)
{
ThePlayer.PlayerEntity.EntityPosition = new Vector2(x, y);
}
else
{
foreach (PlayerEntity pe in OtherPlayers)
{
if (pe.PlayerID == playerID)
{
pe.EntityPosition = new Vector2(x, y);
}
}
//.........这里部分代码省略.........
示例10: CacheUserSessionResponse
/// <summary>
/// Initializes new instance of <see cref="CacheUserSessionResponse"/> struct.
/// </summary>
/// <param name="p"><see cref="Packet"/> to initialize from.</param>
public CacheUserSessionResponse( Packet p )
{
RequestID = p.ReadLong();
Response = p.ReadByte();
}
示例11: JoinWorldResponse
/// <summary>
/// Initializes new instance of <see cref="JoinWorldResponse"/> struct.
/// </summary>
/// <param name="p"><see cref="Packet"/> to initialize from.</param>
public JoinWorldResponse( Packet p )
{
RequestID = p.ReadLong();
Result = ( JoinWorldRequestResult )p.ReadByte();
}