本文整理汇总了C#中Framework.Network.Packets.PacketWriter.WriteUInt8方法的典型用法代码示例。如果您正苦于以下问题:C# PacketWriter.WriteUInt8方法的具体用法?C# PacketWriter.WriteUInt8怎么用?C# PacketWriter.WriteUInt8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framework.Network.Packets.PacketWriter
的用法示例。
在下文中一共展示了PacketWriter.WriteUInt8方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: HandleUpdateObject
public static void HandleUpdateObject(ref PacketReader packet, ref WorldClass session)
{
Character character = session.Character;
PacketWriter updateObject = new PacketWriter(LegacyMessage.UpdateObject);
updateObject.WriteUInt16((ushort)character.Map);
updateObject.WriteUInt32(1); // Grml sandbox style...
updateObject.WriteUInt8(1);
updateObject.WriteGuid(character.Guid);
updateObject.WriteUInt8(4);
UpdateFlag updateFlags = UpdateFlag.Alive | UpdateFlag.Rotation | UpdateFlag.Self | UpdateFlag.Unknown4;
WorldMgr.WriteUpdateObjectMovement(ref updateObject, ref character, updateFlags);
character.WriteUpdateFields(ref updateObject);
session.Send(updateObject);
}
示例3: HandleObjectDestroy
public static PacketWriter HandleObjectDestroy(ref WorldClass session, ulong guid)
{
PacketWriter objectDestroy = new PacketWriter(LegacyMessage.ObjectDestroy);
objectDestroy.WriteUInt64(guid);
objectDestroy.WriteUInt8(0);
return objectDestroy;
}
示例4: 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);
}
示例5: HandleUpdateObjectCreate
public static void HandleUpdateObjectCreate(ref WorldClass session)
{
WorldObject character = session.Character;
PacketWriter updateObject = new PacketWriter(LegacyMessage.UpdateObject);
updateObject.WriteUInt16((ushort)character.Map);
updateObject.WriteUInt32(1);
updateObject.WriteUInt8((byte)UpdateType.CreateObject);
updateObject.WriteGuid(character.Guid);
updateObject.WriteUInt8((byte)ObjectType.Player);
UpdateFlag updateFlags = UpdateFlag.Alive | UpdateFlag.Rotation | UpdateFlag.Self;
WorldMgr.WriteUpdateObjectMovement(ref updateObject, ref character, updateFlags);
character.WriteUpdateFields(ref updateObject);
character.WriteDynamicUpdateFields(ref updateObject);
session.Send(ref updateObject);
}
示例6: HandleRealmCache
public static void HandleRealmCache(ref PacketReader packet, ref WorldClass session)
{
Character pChar = session.Character;
uint realmId = packet.ReadUInt32();
SQLResult result = DB.Realms.Select("SELECT name FROM realms WHERE id = '{0}'", WorldConfig.RealmId);
string realmName = result.Read<string>(0, "Name");
PacketWriter nameCache = new PacketWriter(LegacyMessage.RealmCache);
nameCache.WriteUInt32(realmId);
nameCache.WriteUInt8(0); // < 0 => End of packet
nameCache.WriteUInt8(1); // Unknown
nameCache.WriteCString(realmName);
nameCache.WriteCString(realmName);
session.Send(nameCache);
}
示例7: HandleNameCache
public static void HandleNameCache(ref PacketReader packet, ref WorldClass session)
{
Character pChar = session.Character;
ulong guid = packet.ReadUInt64();
uint realmId = packet.ReadUInt32();
PacketWriter nameCache = new PacketWriter(LegacyMessage.NameCache);
nameCache.WriteGuid(guid);
nameCache.WriteUInt8(0);
nameCache.WriteCString(pChar.Name);
nameCache.WriteUInt32(realmId);
nameCache.WriteUInt8(pChar.Race);
nameCache.WriteUInt8(pChar.Gender);
nameCache.WriteUInt8(pChar.Class);
nameCache.WriteUInt8(0);
session.Send(nameCache);
}
示例8: HandleAuthChallenge
public static void HandleAuthChallenge(ref PacketReader packet, ref WorldClass session)
{
PacketWriter authChallenge = new PacketWriter(ServerMessage.AuthChallenge, true);
for (int i = 0; i < 8; i++)
authChallenge.WriteUInt32(0);
authChallenge.WriteUInt32((uint)new Random(DateTime.Now.Second).Next(1, 0xFFFFFFF));
authChallenge.WriteUInt8(1);
session.Send(ref authChallenge);
}
示例9: HandleCreatureStats
public static void HandleCreatureStats(ref PacketReader packet, ref WorldClass session)
{
int id = packet.ReadInt32();
ulong guid = packet.ReadUInt64();
Creature creature = DataMgr.FindCreature(id);
if (creature != null)
{
CreatureStats stats = creature.Stats;
PacketWriter creatureStats = new PacketWriter(LegacyMessage.CreatureStats);
creatureStats.WriteInt32(stats.Id);
creatureStats.WriteCString(stats.Name);
for (int i = 0; i < 7; i++)
creatureStats.WriteCString("");
creatureStats.WriteCString(stats.SubName);
creatureStats.WriteCString("");
creatureStats.WriteCString(stats.IconName);
foreach (var v in stats.Flag)
creatureStats.WriteInt32(v);
creatureStats.WriteInt32(stats.Type);
creatureStats.WriteInt32(stats.Family);
creatureStats.WriteInt32(stats.Rank);
foreach (var v in stats.QuestKillNpcId)
creatureStats.WriteInt32(v);
foreach (var v in stats.DisplayInfoId)
creatureStats.WriteInt32(v);
creatureStats.WriteFloat(stats.HealthModifier);
creatureStats.WriteFloat(stats.PowerModifier);
creatureStats.WriteUInt8(stats.RacialLeader);
foreach (var v in stats.QuestItemId)
creatureStats.WriteInt32(v);
creatureStats.WriteInt32(stats.MovementInfoId);
creatureStats.WriteInt32(stats.ExpansionRequired);
session.Send(ref creatureStats);
}
else
Log.Message(LogType.DEBUG, "Creature (Id: {0}) not found.", id);
}
示例10: SendMessageByType
public static void SendMessageByType(ref WorldClass session, MessageType type, int language, string chatMessage)
{
PacketWriter messageChat = new PacketWriter(LegacyMessage.MessageChat);
ulong guid = session.Character.Guid;
messageChat.WriteUInt8((byte)type);
messageChat.WriteInt32(language);
messageChat.WriteUInt64(guid);
messageChat.WriteUInt32(0);
messageChat.WriteUInt64(guid);
messageChat.WriteUInt32((uint)chatMessage.Length + 1);
messageChat.WriteCString(chatMessage);
messageChat.WriteUInt16(0);
session.Send(ref messageChat);
}
示例11: HandleLogoutRequest
public static void HandleLogoutRequest(ref PacketReader packet, WorldClass session)
{
PacketWriter logoutResponse = new PacketWriter(ServerMessage.LogoutResponse);
BitPack BitPack = new BitPack(logoutResponse);
logoutResponse.WriteUInt8(0);
BitPack.Write(0);
BitPack.Flush();
session.Send(ref logoutResponse);
Task.Delay(20000).ContinueWith(_ => HandleLogoutComplete(session), (cts = new CancellationTokenSource()).Token);
session.Character.setStandState(1);
MoveHandler.HandleMoveRoot(session);
}
示例12: HandleCharDelete
public static void HandleCharDelete(ref PacketReader packet, WorldClass session)
{
byte[] guidMask = { 7, 0, 4, 1, 6, 5, 3, 2 };
byte[] guidBytes = { 6, 7, 5, 0, 4, 2, 3, 1 };
var GuidUnpacker = new BitUnpack(packet);
var guid = GuidUnpacker.GetPackedValue(guidMask, guidBytes);
PacketWriter deleteChar = new PacketWriter(ServerMessage.DeleteChar);
deleteChar.WriteUInt8(0x48);
session.Send(ref deleteChar);
DB.Characters.Execute("DELETE FROM characters WHERE guid = ?", guid);
DB.Characters.Execute("DELETE FROM character_spells WHERE guid = ?", guid);
DB.Characters.Execute("DELETE FROM character_skills WHERE guid = ?", guid);
}
示例13: HandleLogoutComplete
public static void HandleLogoutComplete(ref PacketReader packet, ref WorldClass session)
{
var pChar = session.Character;
ObjectMgr.SavePositionToDB(pChar);
PacketWriter logoutComplete = new PacketWriter(LegacyMessage.LogoutComplete);
session.Send(ref logoutComplete);
// Destroy object after logout
PacketWriter objectDestroy = new PacketWriter(LegacyMessage.ObjectDestroy);
objectDestroy.WriteUInt64(pChar.Guid);
objectDestroy.WriteUInt8(0);
WorldMgr.SendToAllInMap(pChar.Guid, objectDestroy);
WorldMgr.DeleteSession(pChar.Guid);
}
示例14: SendMessageByType
public static void SendMessageByType(ref WorldClass session, MessageType type, int language, string chatMessage, bool Broadcast = false)
{
PacketWriter messageChat = new PacketWriter(LegacyMessage.MessageChat);
ulong guid = session.Character.Guid;
messageChat.WriteUInt8((byte)type);
messageChat.WriteInt32(language);
messageChat.WriteUInt64(guid);
messageChat.WriteUInt32(0);
messageChat.WriteUInt64(guid);
messageChat.WriteUInt32((uint)chatMessage.Length + 1);
messageChat.WriteCString(chatMessage);
messageChat.WriteUInt16(0);
if (Broadcast)
{
Globals.WorldMgr.SendToInRangeCharacter(session.Character, messageChat);
session.Send(ref messageChat);
}
else
session.Send(ref messageChat);
}
示例15: HandleCharDelete
public static void HandleCharDelete(ref PacketReader packet, ref WorldClass session)
{
bool[] guidMask = new bool[8];
byte[] guidBytes = new byte[8];
BitUnpack BitUnpack = new BitUnpack(packet);
guidMask[2] = BitUnpack.GetBit();
guidMask[1] = BitUnpack.GetBit();
guidMask[5] = BitUnpack.GetBit();
guidMask[7] = BitUnpack.GetBit();
guidMask[6] = BitUnpack.GetBit();
var unknown = BitUnpack.GetBit();
guidMask[3] = BitUnpack.GetBit();
guidMask[0] = BitUnpack.GetBit();
guidMask[4] = BitUnpack.GetBit();
if (guidMask[1]) guidBytes[1] = (byte)(packet.Read<byte>() ^ 1);
if (guidMask[3]) guidBytes[3] = (byte)(packet.Read<byte>() ^ 1);
if (guidMask[4]) guidBytes[4] = (byte)(packet.Read<byte>() ^ 1);
if (guidMask[0]) guidBytes[0] = (byte)(packet.Read<byte>() ^ 1);
if (guidMask[7]) guidBytes[7] = (byte)(packet.Read<byte>() ^ 1);
if (guidMask[2]) guidBytes[2] = (byte)(packet.Read<byte>() ^ 1);
if (guidMask[5]) guidBytes[5] = (byte)(packet.Read<byte>() ^ 1);
if (guidMask[6]) guidBytes[6] = (byte)(packet.Read<byte>() ^ 1);
var guid = BitConverter.ToUInt64(guidBytes, 0);
PacketWriter deleteChar = new PacketWriter(ServerMessage.DeleteChar);
deleteChar.WriteUInt8(0x47);
session.Send(ref deleteChar);
DB.Characters.Execute("DELETE FROM characters WHERE guid = ?", guid);
DB.Characters.Execute("DELETE FROM character_spells WHERE guid = ?", guid);
DB.Characters.Execute("DELETE FROM character_skills WHERE guid = ?", guid);
}