本文整理汇总了C#中Framework.Network.Packets.PacketWriter类的典型用法代码示例。如果您正苦于以下问题:C# PacketWriter类的具体用法?C# PacketWriter怎么用?C# PacketWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PacketWriter类属于Framework.Network.Packets命名空间,在下文中一共展示了PacketWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleRequestUITime
public static void HandleRequestUITime(ref PacketReader packet, ref WorldClass session)
{
PacketWriter uiTime = new PacketWriter(LegacyMessage.UITime);
uiTime.WriteUnixTime();
session.Send(uiTime);
}
示例2: HandleLogoutComplete
public static void HandleLogoutComplete(ref PacketReader packet, ref WorldClass session)
{
WorldMgr.DeleteSession(session.Character.Guid);
PacketWriter logoutComplete = new PacketWriter(LegacyMessage.LogoutComplete);
session.Send(logoutComplete);
}
示例3: BroadcastToAllPacket
public void BroadcastToAllPacket(ref PacketWriter packet)
{
foreach (WorldClass session in Globals.WorldMgr.Sessions.Values)
{
session.Send(ref packet);
}
}
示例4: HandleSendKnownSpells
public static void HandleSendKnownSpells(ref WorldClass session)
{
Character pChar = session.Character;
var specializationSpells = SpecializationMgr.GetSpecializationSpells(pChar);
var specializationSpellCount = ((specializationSpells != null) ? specializationSpells.Count : 0);
var talentSpells = SpecializationMgr.GetTalentSpells(pChar, pChar.ActiveSpecGroup);
var talentSpellCount = ((talentSpells != null) ? talentSpells.Count : 0);
int count = pChar.SpellList.Count + specializationSpellCount + talentSpellCount;
PacketWriter writer = new PacketWriter(ServerMessage.SendKnownSpells);
BitPack BitPack = new BitPack(writer);
BitPack.Write(1);
BitPack.Write(count, 22);
BitPack.Flush();
pChar.SpellList.ForEach(spell =>
writer.WriteUInt32(spell.SpellId));
if (specializationSpells != null)
specializationSpells.ForEach(spell => writer.WriteUInt32(spell.Spell));
if (talentSpells != null)
talentSpells.ForEach(spell => writer.WriteUInt32(spell));
session.Send(ref writer);
}
示例5: HandleAuthLogonChallenge
public void HandleAuthLogonChallenge(RealmClass session, PacketReader data)
{
Log.Message(LogType.NORMAL, "AuthLogonChallenge");
data.Skip(10);
ushort ClientBuild = data.ReadUInt16();
data.Skip(8);
account.Language = data.ReadStringFromBytes(4);
data.Skip(4);
account.IP = data.ReadIPAddress();
account.Name = data.ReadAccountName();
SQLResult result = DB.Realms.Select("SELECT id, name, password, expansion, gmlevel, securityFlags FROM accounts WHERE name = '{0}'", account.Name);
PacketWriter logonChallenge = new PacketWriter();
logonChallenge.WriteUInt8((byte)ClientLink.CMD_AUTH_LOGON_CHALLENGE);
logonChallenge.WriteUInt8(0);
if (result.Count != 0)
{
account.Id = result.Read<Int32>(0, "id");
account.Expansion = result.Read<Byte>(0, "expansion");
account.SecurityFlags = result.Read<Byte>(0, "securityFlags");
DB.Realms.Execute("UPDATE accounts SET ip = '{0}', language = '{1}' WHERE id = {2}", account.IP, account.Language, account.Id);
byte[] username = Encoding.ASCII.GetBytes(result.Read<String>(0, "name").ToUpper());
byte[] password = Encoding.ASCII.GetBytes(result.Read<String>(0, "password").ToUpper());
// WoW 5.1.0.16173 (5.1.0 PTR)
if (ClientBuild == 16173)
{
session.SecureRemotePassword.CalculateX(username, password);
byte[] buf = new byte[0x10];
SRP6.RAND_bytes(buf, 0x10);
logonChallenge.WriteUInt8((byte)AuthResults.WOW_SUCCESS);
logonChallenge.WriteBytes(session.SecureRemotePassword.B);
logonChallenge.WriteUInt8(1);
logonChallenge.WriteUInt8(session.SecureRemotePassword.g[0]);
logonChallenge.WriteUInt8(0x20);
logonChallenge.WriteBytes(session.SecureRemotePassword.N);
logonChallenge.WriteBytes(session.SecureRemotePassword.salt);
logonChallenge.WriteBytes(buf);
// Security flags
logonChallenge.WriteUInt8(account.SecurityFlags);
// Enable authenticator
if ((account.SecurityFlags & 4) != 0)
logonChallenge.WriteUInt8(1);
}
}
else
logonChallenge.WriteUInt8((byte)AuthResults.WOW_FAIL_UNKNOWN_ACCOUNT);
session.Send(logonChallenge);
}
示例6: HandleTutorialFlags
public static void HandleTutorialFlags(ref WorldClass session)
{
PacketWriter tutorialFlags = new PacketWriter(LegacyMessage.TutorialFlags);
for (int i = 0; i < 8; i++)
tutorialFlags.WriteUInt32(0);
session.Send(ref tutorialFlags);
}
示例7: HandleCacheVersion
public static void HandleCacheVersion(ref WorldClass session)
{
PacketWriter cacheVersion = new PacketWriter(ServerMessage.CacheVersion);
cacheVersion.WriteUInt32(0);
session.Send(ref cacheVersion);
}
示例8: HandleUpdateClientCacheVersion
public static void HandleUpdateClientCacheVersion(ref WorldClass session)
{
PacketWriter cacheVersion = new PacketWriter(LegacyMessage.UpdateClientCacheVersion);
cacheVersion.WriteUInt32(0);
session.Send(cacheVersion);
}
示例9: HandleUITimeRequest
public static void HandleUITimeRequest(ref PacketReader packet, WorldClass session)
{
PacketWriter uiTime = new PacketWriter(ServerMessage.UITime);
uiTime.WriteUnixTime();
session.Send(ref uiTime);
}
示例10: HandleObjectDestroy
public static void HandleObjectDestroy(ref WorldClass session)
{
PacketWriter objectDestroy = new PacketWriter(LegacyMessage.ObjectDestroy);
objectDestroy.WriteUInt64(session.Character.Guid);
objectDestroy.WriteUInt8(0);
session.Send(objectDestroy);
}
示例11: OnConnect
public void OnConnect()
{
PacketWriter TransferInitiate = new PacketWriter(Message.TransferInitiate);
TransferInitiate.WriteCString("RLD OF WARCRAFT CONNECTION - SERVER TO CLIENT");
Send(TransferInitiate);
clientSocket.BeginReceive(DataBuffer, 0, DataBuffer.Length, SocketFlags.None, Receive, null);
}
示例12: HandleObjectDestroy
public static PacketWriter HandleObjectDestroy(ref WorldClass session, ulong guid)
{
PacketWriter objectDestroy = new PacketWriter(LegacyMessage.ObjectDestroy);
objectDestroy.WriteUInt64(guid);
objectDestroy.WriteUInt8(0);
return objectDestroy;
}
示例13: HandlePong
public static void HandlePong(ref PacketReader packet, ref WorldClass session)
{
uint sequence = packet.ReadUInt32();
uint latency = packet.ReadUInt32();
PacketWriter pong = new PacketWriter(JAMCCMessage.Pong);
pong.WriteUInt32(sequence);
session.Send(pong);
}
示例14: HandleMessageOfTheDay
public static void HandleMessageOfTheDay(ref WorldClass session)
{
PacketWriter motd = new PacketWriter(LegacyMessage.MessageOfTheDay);
motd.WriteUInt32(3);
motd.WriteCString("Arctium MoP test");
motd.WriteCString("Welcome to our MoP server test.");
motd.WriteCString("Your development team =)");
session.Send(ref motd);
}
示例15: HandleLogoutComplete
public static void HandleLogoutComplete(ref PacketReader packet, ref WorldClass session)
{
var pChar = session.Character;
ObjectMgr.SavePositionToDB(pChar);
WorldMgr.DeleteSession(pChar.Guid);
PacketWriter logoutComplete = new PacketWriter(LegacyMessage.LogoutComplete);
session.Send(logoutComplete);
}