本文整理汇总了C#中Framework.Network.Packets.PacketReader类的典型用法代码示例。如果您正苦于以下问题:C# PacketReader类的具体用法?C# PacketReader怎么用?C# PacketReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PacketReader类属于Framework.Network.Packets命名空间,在下文中一共展示了PacketReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: HandleCliSetSpecialization
public static void HandleCliSetSpecialization(ref PacketReader packet, ref WorldClass session)
{
var pChar = session.Character;
uint specGroupId = packet.Read<uint>();
uint specId = SpecializationMgr.GetSpecIdByGroup(pChar, (byte)specGroupId);
// check if new spec is primary or secondary
if (pChar.SpecGroupCount == 1 && pChar.PrimarySpec == 0)
{
pChar.ActiveSpecGroup = 0;
pChar.PrimarySpec = (ushort)specId;
}
else
{
pChar.ActiveSpecGroup = 1;
pChar.SecondarySpec = (ushort)specId;
pChar.SpecGroupCount = (byte)(pChar.SpecGroupCount + 1);
}
SpecializationMgr.SaveSpecInfo(pChar);
SendSpecializationSpells(ref session);
HandleUpdateTalentData(ref session);
pChar.SetUpdateField<Int32>((int)PlayerFields.CurrentSpecID, (int)pChar.GetActiveSpecId());
ObjectHandler.HandleUpdateObjectValues(ref session);
Log.Message(LogType.Debug, "Character (Guid: {0}) choosed specialization {1} for spec group {2}.", pChar.Guid, pChar.GetActiveSpecId(), pChar.ActiveSpecGroup);
}
开发者ID:australopitheque,项目名称:Arctium,代码行数:31,代码来源:SpecializationHandler.cs
示例2: 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);
var res = result.Read("id", "name", "password", "expansion", "securityFlags");
PacketWriter logonChallenge = new PacketWriter();
logonChallenge.WriteUInt8((byte)ClientLink.CMD_AUTH_LOGON_CHALLENGE);
logonChallenge.WriteUInt8(0);
if (result.Count != 0)
{
account.Id = result.Read<Int32>("id");
account.Expansion = result.Read<Byte>("expansion");
account.SecurityFlags = result.Read<Byte>("securityFlags");
DB.Realms.Execute("UPDATE accounts SET ip = '{0}', language = '{1}' WHERE id = {2}", account.IP, account.Language, account.Id);
byte[] username = Encoding.UTF8.GetBytes(result.Read<String>("name").ToUpper());
byte[] password = Encoding.UTF8.GetBytes(result.Read<String>("password").ToUpper());
// WoW 5.1.0.16309 (5.1.0)
if (ClientBuild == 16309)
{
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);
}
开发者ID:concept45,项目名称:Arctium-RT,代码行数:60,代码来源:RealmClass.cs
示例3: HandleRealmData
void HandleRealmData(byte[] data)
{
using (var reader = new PacketReader(data, false))
{
ClientLink cmd = (ClientLink)reader.ReadUInt8();
switch (cmd)
{
case ClientLink.CMD_AUTH_LOGON_CHALLENGE:
case ClientLink.CMD_AUTH_RECONNECT_CHALLENGE:
HandleAuthLogonChallenge(reader);
break;
case ClientLink.CMD_AUTH_LOGON_PROOF:
case ClientLink.CMD_AUTH_RECONNECT_PROOF:
HandleAuthLogonProof(reader);
break;
case ClientLink.CMD_REALM_LIST:
HandleRealmList(reader);
break;
default:
Log.Message(LogType.NORMAL, "Received unknown ClientLink: {0}", cmd);
break;
}
}
}
开发者ID:Krogonos,项目名称:Mop-5.1.0-Core,代码行数:25,代码来源:RealmClass.cs
示例4: HandleLearnTalents
public static void HandleLearnTalents(ref PacketReader packet, ref WorldClass session)
{
var pChar = session.Character;
var talentSpells = new List<uint>();
BitUnpack BitUnpack = new BitUnpack(packet);
uint talentCount = BitUnpack.GetBits<uint>(23);
for (int i = 0; i < talentCount; i++)
{
var talentId = packet.Read<ushort>();
SpecializationMgr.AddTalent(pChar, pChar.ActiveSpecGroup, talentId, true);
talentSpells.Add(CliDB.Talent.Single(talent => talent.Id == talentId).SpellId);
}
HandleUpdateTalentData(ref session);
pChar.SetUpdateField<Int32>((int)PlayerFields.SpellCritPercentage + 0, SpecializationMgr.GetUnspentTalentRowCount(pChar), 0);
ObjectHandler.HandleUpdateObjectValues(ref session);
foreach (var talentSpell in talentSpells)
SpellHandler.HandleLearnedSpells(ref session, new List<uint>(1) { talentSpell });
Log.Message(LogType.Debug, "Character (Guid: {0}) learned {1} talents.", pChar.Guid, talentCount);
}
开发者ID:australopitheque,项目名称:Arctium,代码行数:28,代码来源:SpecializationHandler.cs
示例5: 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);
}
开发者ID:thundergod221,项目名称:Arctium,代码行数:7,代码来源:LogoutHandler.cs
示例6: HandleRequestUITime
public static void HandleRequestUITime(ref PacketReader packet, ref WorldClass session)
{
PacketWriter uiTime = new PacketWriter(LegacyMessage.UITime);
uiTime.WriteUnixTime();
session.Send(uiTime);
}
开发者ID:Gargash,项目名称:Arctium,代码行数:7,代码来源:TimeHandler.cs
示例7: HandleLearnTalents
//[Opcode(ClientMessage.LearnTalents, "16357")]
public static void HandleLearnTalents(ref PacketReader packet, ref WorldClass session)
{
var pChar = session.Character;
var talentSpells = new List<uint>();
BitUnpack BitUnpack = new BitUnpack(packet);
uint talentCount = BitUnpack.GetBits<uint>(25);
for (int i = 0; i < talentCount; i++)
{
var talentId = packet.ReadUInt16();
SpecializationMgr.AddTalent(pChar, pChar.ActiveSpecGroup, talentId, true);
talentSpells.Add(DBCStorage.TalentStorage.LookupByKey(talentId).SpellId);
}
HandleTalentUpdate(ref session);
pChar.SetUpdateField<Int32>((int)PlayerFields.SpellCritPercentage + 0, SpecializationMgr.GetUnspentTalentRowCount(pChar), 0);
ObjectHandler.HandleUpdateObjectValues(ref session);
// we need to send a single packet for every talent spell - stupid blizz
foreach (var talentSpell in talentSpells)
SpellHandler.HandleLearnedSpells(ref session, new List<uint>(1) { talentSpell });
Log.Message(LogType.DEBUG, "Character (Guid: {0}) learned {1} talents.", pChar.Guid, talentCount);
}
开发者ID:Krogonos,项目名称:Arctium,代码行数:29,代码来源:SpecializationHandler.cs
示例8: HandleCreateCharacter
public static void HandleCreateCharacter(ref PacketReader packet, WorldClass session)
{
BitUnpack BitUnpack = new BitUnpack(packet);
packet.Skip(1);
var facialHair = packet.ReadByte();
var skin = packet.ReadByte();
var race = packet.ReadByte();
var hairStyle = packet.ReadByte();
var pClass = packet.ReadByte();
var face = packet.ReadByte();
var gender = packet.ReadByte();
var hairColor = packet.ReadByte();
var nameLength = BitUnpack.GetBits<uint>(6);
var hasUnknown = BitUnpack.GetBit();
var name = Character.NormalizeName(packet.ReadString(nameLength));
if (hasUnknown)
packet.ReadUInt32();
var result = DB.Characters.Select("SELECT * from characters WHERE name = ?", name);
var createChar = new PacketWriter(ServerMessage.CreateChar);
if (result.Count != 0)
{
// Name already in use
createChar.WriteUInt8(0x32);
session.Send(ref createChar);
return;
}
result = DB.Characters.Select("SELECT map, zone, posX, posY, posZ, posO FROM character_creation_data WHERE race = ? AND class = ?", race, pClass);
if (result.Count == 0)
{
createChar.WriteUInt8(0x31);
session.Send(ref createChar);
return;
}
var map = result.Read<uint>(0, "map");
var zone = result.Read<uint>(0, "zone");
var posX = result.Read<float>(0, "posX");
var posY = result.Read<float>(0, "posY");
var posZ = result.Read<float>(0, "posZ");
var posO = result.Read<float>(0, "posO");
// Allow declined names for now
var characterFlags = CharacterFlag.Decline;
DB.Characters.Execute("INSERT INTO characters (name, accountid, realmId, race, class, gender, skin, zone, map, x, y, z, o, face, hairstyle, haircolor, facialhair, characterFlags) VALUES (" +
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
name, session.Account.Id, WorldConfig.RealmId, race, pClass, gender, skin, zone, map, posX, posY, posZ, posO, face, hairStyle, hairColor, facialHair, characterFlags);
// Success
createChar.WriteUInt8(0x2F);
session.Send(ref createChar);
}
开发者ID:Nowhereman23,项目名称:Arctium-WoW,代码行数:59,代码来源:CharacterHandler.cs
示例9: HandleUITimeRequest
public static void HandleUITimeRequest(ref PacketReader packet, WorldClass session)
{
PacketWriter uiTime = new PacketWriter(ServerMessage.UITime);
uiTime.WriteUnixTime();
session.Send(ref uiTime);
}
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:8,代码来源:TimeHandler.cs
示例10: HandleChatMessageYell
public static void HandleChatMessageYell(ref PacketReader packet, ref WorldClass session)
{
BitUnpack BitUnpack = new BitUnpack(packet);
int language = packet.ReadInt32();
uint messageLength = BitUnpack.GetBits<uint>(9);
string chatMessage = packet.ReadString(messageLength);
SendMessageByType(ref session, MessageType.ChatMessageYell, language, chatMessage);
}
开发者ID:Mogale,项目名称:Arctium,代码行数:9,代码来源:ChatHandler.cs
示例11: HandleLoadingScreenNotify
public static void HandleLoadingScreenNotify(ref PacketReader packet, WorldClass session)
{
BitUnpack BitUnpack = new BitUnpack(packet);
uint mapId = packet.Read<uint>();
bool loadingScreenState = BitUnpack.GetBit();
Log.Message(LogType.Debug, "Loading screen for map '{0}' is {1}.", mapId, loadingScreenState ? "enabled" : "disabled");
}
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:9,代码来源:MiscHandler.cs
示例12: HandleAreatrigger
public static void HandleAreatrigger(ref PacketReader packet, ref WorldClass session)
{
var pChar = session.Character;
uint triggerId = packet.ReadUInt32();
AreaTrigger areaTrigger = DBCStorage.AreaTriggerStorage[triggerId];
Log.Message(LogType.DEBUG, "Character (Guid: {0}) reached Areatrigger Id: {1}.", pChar.Guid, areaTrigger.Id);
}
开发者ID:Mogale,项目名称:Arctium,代码行数:9,代码来源:MiscHandler.cs
示例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(ref pong);
}
开发者ID:Kinivus,项目名称:Arctium,代码行数:10,代码来源:MiscHandler.cs
示例14: InvokeHandler
public static bool InvokeHandler(ref PacketReader reader, WorldClass session, ClientMessage opcode)
{
if (OpcodeHandlers.ContainsKey(opcode))
{
OpcodeHandlers[opcode].Invoke(ref reader, ref session);
return true;
}
else
return false;
}
开发者ID:Gargash,项目名称:Arctium,代码行数:10,代码来源:PacketManager.cs
示例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);
}
开发者ID:boredtodeath,项目名称:Arctium,代码行数:10,代码来源:LogoutHandler.cs
示例16: HandleObjectUpdateFailed
public static void HandleObjectUpdateFailed(ref PacketReader packet, WorldClass session)
{
byte[] guidMask = { 7, 0, 2, 3, 1, 4, 6, 5 };
byte[] guidBytes = { 1, 2, 5, 0, 3, 4, 6, 7 };
BitUnpack GuidUnpacker = new BitUnpack(packet);
ulong guid = GuidUnpacker.GetPackedValue(guidMask, guidBytes);
Log.Message(LogType.Debug, "ObjectUpdate failed for object with Guid {0}", guid);
}
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:10,代码来源:ObjectHandler.cs
示例17: HandleObjectUpdateFailed
public static void HandleObjectUpdateFailed(ref PacketReader packet, ref WorldClass session)
{
byte[] guidMask = { 6, 1, 7, 5, 0, 4, 2, 3 };
byte[] guidBytes = { 2, 3, 7, 4, 5, 1, 0, 6 };
BitUnpack GuidUnpacker = new BitUnpack(packet);
ulong guid = GuidUnpacker.GetGuid(guidMask, guidBytes);
Log.Message(LogType.DEBUG, "ObjectUpdate failed for object with Guid {0}", guid);
}
开发者ID:owner-gamers,项目名称:Arctium,代码行数:10,代码来源:ObjectHandler.cs
示例18: HandleItemItemNameQuery
public static void HandleItemItemNameQuery(ref PacketReader packet, ref WorldClass session)
{
uint itemID = packet.ReadUInt32();//this from old structure
Item pItem = Globals.ItemMgr.FindData(itemID);
if (pItem != null)
{
SendItemNameQueryResponse(session,pItem);
}
}
开发者ID:Mathias1000,项目名称:Arctium,代码行数:11,代码来源:ItemHandler.cs
示例19: HandleTalkToGossip
public static void HandleTalkToGossip(ref PacketReader packet, ref WorldClass session)
{
BitUnpack BitUnpack = new BitUnpack(packet);
byte[] guidMask = { 3, 1, 7, 4, 6, 0, 2, 5 };
byte[] guidBytes = { 0, 1, 7, 6, 5, 2, 4, 3 };
var guid = BitUnpack.GetPackedValue(guidMask, guidBytes);
var gossipData = GossipMgr.GetGossip<Creature>(SmartGuid.GetGuid(guid));
if (gossipData != null)
{
PacketWriter gossipMessage = new PacketWriter(ServerMessage.GossipMessage);
BitPack BitPack = new BitPack(gossipMessage, guid);
BitPack.WriteGuidMask(0, 1);
BitPack.Write(0, 19); // gossipData.QuestsCount
BitPack.WriteGuidMask(2);
BitPack.Write(0, 20); // gossipData.OptionsCount
// QuestsCount not supported.
// for (int i = 0; i < gossipData.QuestsCount; i++)
BitPack.WriteGuidMask(3);
// OptionsCount not supported.
// for (int i = 0; i < gossipData.OptionsCount; i++)
BitPack.WriteGuidMask(5, 4, 6, 7);
BitPack.Flush();
BitPack.WriteGuidBytes(6);
// OptionsCount not supported.
// for (int i = 0; i < gossipData.OptionsCount; i++)
BitPack.WriteGuidBytes(0);
// QuestsCount not supported.
// for (int i = 0; i < gossipData.QuestsCount; i++)
gossipMessage.WriteInt32(gossipData.Id);
BitPack.WriteGuidBytes(4, 3);
gossipMessage.WriteInt32(gossipData.FriendshipFactionID);
gossipMessage.WriteInt32(gossipData.TextID);
BitPack.WriteGuidBytes(7, 1, 5, 1);
session.Send(ref gossipMessage);
}
}
开发者ID:OakCore,项目名称:Arctium,代码行数:54,代码来源:GossipHandler.cs
示例20: HandleLogoutCancel
public static void HandleLogoutCancel(ref PacketReader packet, WorldClass session)
{
cts.Cancel();
MoveHandler.HandleMoveUnroot(session);
PacketWriter LogoutCancelAck = new PacketWriter(ServerMessage.LogoutCancelAck);
session.Send(ref LogoutCancelAck);
session.Character.setStandState(0);
}
开发者ID:mansemino,项目名称:Arctium,代码行数:11,代码来源:LogoutHandler.cs
注:本文中的Framework.Network.Packets.PacketReader类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论