本文整理汇总了C#中WowPacketParser.Misc.Guid.GetObjectType方法的典型用法代码示例。如果您正苦于以下问题:C# Guid.GetObjectType方法的具体用法?C# Guid.GetObjectType怎么用?C# Guid.GetObjectType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WowPacketParser.Misc.Guid
的用法示例。
在下文中一共展示了Guid.GetObjectType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckFilter
public static bool CheckFilter(Guid guid)
{
var result = true;
if (guid.HasEntry())
result = CheckFilter(Utilities.ObjectTypeToStore(guid.GetObjectType()), (int)guid.GetEntry());
return result;
}
示例2: ReadMovementUpdateBlock
//.........这里部分代码省略.........
{
lines.Add("Spline Duration Multiplier: " + packet.ReadSingle("Spline Duration Multiplier", index));
lines.Add("Spline Duration Multiplier Next: " + packet.ReadSingle("Spline Duration Multiplier Next", index));
lines.Add("Spline Vertical Acceleration" + packet.ReadSingle("Spline Vertical Acceleration", index));
lines.Add("Spline Start Time " + packet.ReadInt32("Spline Start Time", index));
}
var splineCount = packet.ReadInt32();
for (var i = 0; i < splineCount; i++)
lines.Add("[" + i + "] Spline Waypoint: " + packet.ReadVector3("Spline Waypoint", index, i).ToString());
if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767))
lines.Add("Spline Mode: " + packet.ReadEnum<SplineMode>("Spline Mode", TypeCode.Byte, index).ToString());
lines.Add("Spline Endpoint: " + packet.ReadVector3("Spline Endpoint", index).ToString());
}
}
else // !UpdateFlag.Living
{
if (flags.HasAnyFlag(UpdateFlag.GOPosition))
{
packet.ReadPackedGuid("GO Position GUID", index);
moveInfo.Position = packet.ReadVector3("[" + index + "] GO Position");
packet.ReadVector3("GO Transport Position", index);
moveInfo.Orientation = packet.ReadSingle("[" + index + "] GO Orientation");
packet.ReadSingle("GO Transport Orientation", index);
}
else if (flags.HasAnyFlag(UpdateFlag.StationaryObject))
{
moveInfo.Position = packet.ReadVector3();
moveInfo.Orientation = packet.ReadSingle();
packet.Writer.WriteLine("[{0}] Stationary Position: {1}, O: {2}", index, moveInfo.Position, moveInfo.Orientation);
}
}
if (ClientVersion.RemovedInVersion(ClientVersionBuild.V4_2_2_14545))
{
if (flags.HasAnyFlag(UpdateFlag.Unknown1))
packet.ReadInt32("Unk Int32", index);
if (flags.HasAnyFlag(UpdateFlag.LowGuid))
packet.ReadInt32("Low GUID", index);
}
if (flags.HasAnyFlag(UpdateFlag.AttackingTarget))
lines.Add("Target GUID: " + packet.ReadPackedGuid("Target GUID", index));
if (flags.HasAnyFlag(UpdateFlag.Transport))
lines.Add("Transport Movement Time (ms): " + packet.ReadInt32("Transport Movement Time (ms)", index));
if (flags.HasAnyFlag(UpdateFlag.Vehicle))
{
moveInfo.VehicleId = packet.ReadUInt32("[" + index + "] Vehicle ID");
lines.Add("Vehicle ID : " + moveInfo.VehicleId);
lines.Add("Vehicle Orientation: " + packet.ReadSingle("Vehicle Orientation", index));
}
if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545))
{
if (flags.HasAnyFlag(UpdateFlag.AnimKits))
{
packet.ReadInt16("Unk Int16", index);
packet.ReadInt16("Unk Int16", index);
packet.ReadInt16("Unk Int16", index);
}
}
if (flags.HasAnyFlag(UpdateFlag.GORotation))
moveInfo.Rotation = packet.ReadPackedQuaternion("GO Rotation", index);
if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545))
{
if (flags.HasAnyFlag(UpdateFlag.TransportUnkArray))
{
var count = packet.ReadByte("Count", index);
for (var i = 0; i < count; i++)
packet.ReadInt32("Unk Int32", index, count);
}
}
// Initialize fields that are not used by GOs
if (guid.GetObjectType() == ObjectType.GameObject)
{
moveInfo.VehicleId = 0;
moveInfo.WalkSpeed = 0;
moveInfo.RunSpeed = 0;
}
if (guid.HasEntry() && guid.GetObjectType() == ObjectType.Unit)
{
if (packet.SniffFileInfo.Stuffing.upObjPackets.ContainsKey(guid))
packet.SniffFileInfo.Stuffing.upObjPackets[guid].upObjPackets.Enqueue(new UpdateObjectPacket(packet.Time, packet.Number, lines));
else
packet.SniffFileInfo.Stuffing.upObjPackets.TryAdd(guid, new UpdateObjectPackets(new UpdateObjectPacket(packet.Time, packet.Number, lines)));
}
return moveInfo;
}
示例3: ReadCreateObjectBlock
private static void ReadCreateObjectBlock(ref Packet packet, Guid guid, uint map, int index)
{
var objType = packet.ReadEnum<ObjectType>("Object Type", TypeCode.Byte, index);
var moves = ReadMovementUpdateBlock(ref packet, guid, index);
var updates = ReadValuesUpdateBlock(ref packet, objType, index);
var obj = new WoWObject {Type = objType, Movement = moves, UpdateFields = updates, Map = map, Area = WorldStateHandler.CurrentAreaId, PhaseMask = (uint) MovementHandler.CurrentPhaseMask};
if (guid.HasEntry() && guid.GetObjectType() == ObjectType.Unit)
{
List<string> lines = new List<string>();
lines.Add("UpdateType: Values");
foreach (var data in updates)
lines.Add("Block Value " + UpdateFields.GetUpdateFieldName(data.Key, "UnitField") + ": " + data.Value.Int32Value + "/" + data.Value.SingleValue);
if (packet.SniffFileInfo.Stuffing.upObjPackets.ContainsKey(guid))
packet.SniffFileInfo.Stuffing.upObjPackets[guid].upObjPackets.Enqueue(new UpdateObjectPacket(packet.Time, packet.Number, lines));
else
packet.SniffFileInfo.Stuffing.upObjPackets.TryAdd(guid, new UpdateObjectPackets(new UpdateObjectPacket(packet.Time, packet.Number, lines)));
}
packet.SniffFileInfo.Stuffing.Objects.TryAdd(guid, obj);
if (guid.HasEntry() && (objType == ObjectType.Unit || objType == ObjectType.GameObject))
packet.AddSniffData(Utilities.ObjectTypeToStore(objType), (int)guid.GetEntry(), "SPAWN");
}
示例4: ReadMovementUpdateBlock
//.........这里部分代码省略.........
else if (splineFlags.HasAnyFlag(SplineFlag.FinalPoint))
packet.ReadVector3("Final Spline Coords", index);
}
packet.ReadInt32("Spline Time", index);
packet.ReadInt32("Spline Full Time", index);
packet.ReadInt32("Spline ID", index);
if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767))
{
packet.ReadSingle("Spline Duration Multiplier", index);
packet.ReadSingle("Spline Duration Multiplier Next", index);
packet.ReadSingle("Spline Vertical Acceleration", index);
packet.ReadInt32("Spline Start Time", index);
}
var splineCount = packet.ReadInt32();
for (var i = 0; i < splineCount; i++)
packet.ReadVector3("Spline Waypoint", index, i);
if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767))
packet.ReadEnum<SplineMode>("Spline Mode", TypeCode.Byte, index);
packet.ReadVector3("Spline Endpoint", index);
}
}
else // !UpdateFlag.Living
{
if (flags.HasAnyFlag(UpdateFlag.GOPosition))
{
packet.ReadPackedGuid("GO Position GUID", index);
moveInfo.Position = packet.ReadVector3("[" + index + "] GO Position");
packet.ReadVector3("GO Transport Position", index);
moveInfo.Orientation = packet.ReadSingle("[" + index + "] GO Orientation");
packet.ReadSingle("Corpse Orientation", index);
}
else if (flags.HasAnyFlag(UpdateFlag.StationaryObject))
{
moveInfo.Position = packet.ReadVector3();
moveInfo.Orientation = packet.ReadSingle();
packet.WriteLine("[{0}] Stationary Position: {1}, O: {2}", index, moveInfo.Position, moveInfo.Orientation);
}
}
if (ClientVersion.RemovedInVersion(ClientVersionBuild.V4_2_2_14545))
{
if (flags.HasAnyFlag(UpdateFlag.Unknown1))
packet.ReadUInt32("Unk Int32", index);
if (flags.HasAnyFlag(UpdateFlag.LowGuid))
packet.ReadUInt32("Low GUID", index);
}
if (flags.HasAnyFlag(UpdateFlag.AttackingTarget))
packet.ReadPackedGuid("Target GUID", index);
if (flags.HasAnyFlag(UpdateFlag.Transport))
packet.ReadUInt32("Transport unk timer", index);
if (flags.HasAnyFlag(UpdateFlag.Vehicle))
{
moveInfo.VehicleId = packet.ReadUInt32("[" + index + "] Vehicle ID");
packet.ReadSingle("Vehicle Orientation", index);
}
if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545))
{
if (flags.HasAnyFlag(UpdateFlag.AnimKits))
{
packet.ReadInt16("Unk Int16", index);
packet.ReadInt16("Unk Int16", index);
packet.ReadInt16("Unk Int16", index);
}
}
if (flags.HasAnyFlag(UpdateFlag.GORotation))
moveInfo.Rotation = packet.ReadPackedQuaternion("GO Rotation", index);
if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545))
{
if (flags.HasAnyFlag(UpdateFlag.TransportUnkArray))
{
var count = packet.ReadByte("Count", index);
for (var i = 0; i < count; i++)
packet.ReadInt32("Unk Int32", index, count);
}
}
// Initialize fields that are not used by GOs
if (guid.GetObjectType() == ObjectType.GameObject)
{
moveInfo.VehicleId = 0;
moveInfo.WalkSpeed = 0;
moveInfo.RunSpeed = 0;
}
return moveInfo;
}
示例5: HandleNpcGossip
public static void HandleNpcGossip(Packet packet)
{
var guid = new byte[8];
uint[] titleLen;
uint[] OptionTextLen;
uint[] BoxTextLen;
var menuId = packet.ReadUInt32("Menu Id");
packet.ReadUInt32("Friendship Faction");
var textId = packet.ReadUInt32("Text Id");
packet.StartBitStream(guid, 0, 1);
var AmountOfOptions = packet.ReadBits("Amount of Options", 20);
packet.StartBitStream(guid, 6, 7);
OptionTextLen = new uint[AmountOfOptions];
BoxTextLen = new uint[AmountOfOptions];
for (var i = 0; i < AmountOfOptions; ++i)
{
OptionTextLen[i] = packet.ReadBits(12);
BoxTextLen[i] = packet.ReadBits(12);
}
packet.StartBitStream(guid, 4, 3, 2);
var questgossips = packet.ReadBits("Amount of Quest gossips", 19);
titleLen = new uint[questgossips];
for (var i = 0; i < questgossips; ++i)
{
titleLen[i] = packet.ReadBits(9);
packet.ReadBit("Change Icon", i);
}
guid[5] = packet.ReadBit();
packet.ResetBitReader();
for (var i = 0; i < questgossips; i++)
{
packet.ReadEnum<QuestFlags2>("Flags 2", TypeCode.UInt32, i);
packet.ReadUInt32("Icon", i);
packet.ReadWoWString("Title", titleLen[i], i);
packet.ReadEnum<QuestFlags>("Flags", TypeCode.UInt32, i);
packet.ReadInt32("Level", i);
packet.ReadEntryWithName<UInt32>(StoreNameType.Quest, "Quest ID", i);
}
var gossip = new Gossip();
gossip.GossipOptions = new List<GossipOption>((int)AmountOfOptions);
for (var i = 0; i < AmountOfOptions; ++i)
{
var gossipOption = new GossipOption
{
RequiredMoney = packet.ReadUInt32("Required money", i),
Index = packet.ReadUInt32("Index", i),
BoxText = packet.ReadWoWString("Box Text", BoxTextLen[i], i),
Box = packet.ReadBoolean("Box", i),
OptionText = packet.ReadWoWString("Text", OptionTextLen[i], i),
OptionIcon = packet.ReadEnum<GossipOptionIcon>("Icon", TypeCode.Byte, i),
};
gossip.GossipOptions.Add(gossipOption);
}
packet.ParseBitStream(guid, 3, 4, 7, 2, 1, 6, 0, 5);
packet.WriteGuid("GUID", guid);
var GUID = new Guid(BitConverter.ToUInt64(guid, 0));
gossip.ObjectType = GUID.GetObjectType();
gossip.ObjectEntry = GUID.GetEntry();
if (Storage.Gossips.ContainsKey(Tuple.Create(menuId, textId)))
{
var oldGossipOptions = Storage.Gossips[Tuple.Create(menuId, textId)];
if (oldGossipOptions != null)
{
foreach (var gossipOptions in gossip.GossipOptions)
oldGossipOptions.Item1.GossipOptions.Add(gossipOptions);
}
}
else
Storage.Gossips.Add(Tuple.Create(menuId, textId), gossip, packet.TimeSpan);
packet.AddSniffData(StoreNameType.Gossip, (int)menuId, GUID.GetEntry().ToString(CultureInfo.InvariantCulture));
}
示例6: HandleServerChatMessage
public static void HandleServerChatMessage(Packet packet)
{
var text = new CreatureText();
var GroupGUID = new byte[8];
var GuildGUID = new byte[8];
var ReceiverGUID = new byte[8];
var SenderGUID = new byte[8];
var bit1316 = !packet.ReadBit();
packet.ReadBit("bit5269");
packet.ReadBit(); // fake bit
var hasSender = !packet.ReadBit();
packet.StartBitStream(GroupGUID, 6, 1, 7, 5, 4, 3, 2, 0);
packet.ReadBit(); // fake bit
var hasChannel = !packet.ReadBit();
packet.StartBitStream(ReceiverGUID, 1, 5, 7, 4, 2, 0, 6, 3);
packet.ReadBit("bit5268");
var hasReceiver = !packet.ReadBit();
int receiverLen = 0;
if (hasReceiver)
receiverLen = (int)packet.ReadBits(11);
packet.ReadBit(); // fake bit
packet.StartBitStream(GuildGUID, 0, 6, 1, 5, 7, 3, 4, 2);
var hasText = !packet.ReadBit();
var hasPrefix = !packet.ReadBit();
int senderName = 0;
if (hasSender)
senderName = (int)packet.ReadBits(11);
int textLen = 0;
if (hasText)
textLen = (int)packet.ReadBits(12);
var hasConstTime = !packet.ReadBit();
var hasAchi = !packet.ReadBit();
packet.ReadBit(); // fake bit
packet.StartBitStream(SenderGUID, 5, 4, 1, 0, 6, 2, 7, 3);
int channelLen = 0;
if (hasChannel)
channelLen = (int)packet.ReadBits(7);
var bit2630 = !packet.ReadBit();
if (bit2630)
packet.ReadEnum<ChatTag>("Chat Tag", 9);
var hasLang = !packet.ReadBit();
int prefixLen = 0;
if (hasPrefix)
prefixLen = (int)packet.ReadBits(5);
if (hasPrefix)
packet.ReadWoWString("Addon Message Prefix", prefixLen);
packet.ParseBitStream(GuildGUID, 3, 1, 5, 4, 6, 2, 0, 7);
packet.ParseBitStream(ReceiverGUID, 7, 4, 2, 3, 1, 5, 6, 0);
packet.ParseBitStream(SenderGUID, 5, 0, 7, 4, 3, 2, 1, 6);
packet.ParseBitStream(GroupGUID, 3, 5, 2, 6, 4, 0, 1, 7);
packet.WriteGuid("SenderGUID", SenderGUID);
packet.WriteGuid("ReceiverGUID", ReceiverGUID);
packet.WriteGuid("GroupGUID", GroupGUID);
packet.WriteGuid("GuildGUID", GuildGUID);
uint entry = 0;
var guid = new Guid(BitConverter.ToUInt64(SenderGUID, 0));
if (guid.GetObjectType() == ObjectType.Unit)
entry = guid.GetEntry();
if (hasAchi)
packet.ReadInt32("Achievement");
if (hasReceiver)
packet.ReadWoWString("Receiver Name", receiverLen);
text.Type = (ChatMessageType)packet.ReadEnum<ChatMessageType530>("Chat type", TypeCode.Byte);
if (hasText)
text.Text = packet.ReadWoWString("Text", textLen);
if (hasConstTime)
packet.ReadInt32("Constant time");
if (bit1316)
packet.ReadSingle("float1316");
if (hasChannel)
packet.ReadWoWString("Channel Name", channelLen);
if (hasSender)
{
if (entry != 0)
text.Comment = packet.ReadWoWString("Sender Name", senderName);
else
packet.ReadWoWString("Sender Name", senderName);
}
if (hasLang)
//.........这里部分代码省略.........
示例7: ReadMovementUpdateBlock
//.........这里部分代码省略.........
switch (speedType)
{
case SpeedType.Walk:
{
moveInfo.WalkSpeed = speed / 2.5f;
break;
}
case SpeedType.Run:
{
moveInfo.RunSpeed = speed / 7.0f;
break;
}
}
}
if (moveFlags.HasAnyFlag(MovementFlag.SplineEnabled))
{
var splineFlags = packet.ReadEnum<SplineFlag>("Spline Flags", TypeCode.Int32, index);
if (splineFlags.HasAnyFlag(SplineFlag.FinalTarget))
packet.ReadGuid("Final Spline Target GUID", index);
else if (splineFlags.HasAnyFlag(SplineFlag.FinalOrientation))
{
if (ClientVersion.RemovedInVersion(ClientVersionBuild.V3_0_2_9056))
packet.ReadInt32(); // not sure, orientation is incorrect in 2.4.1, this int is probably involved
packet.ReadSingle("Final Spline Orientation", index);
}
else if (splineFlags.HasAnyFlag(SplineFlag.FinalPoint))
packet.ReadVector3("Final Spline Coords", index);
packet.ReadInt32("Spline Time", index);
packet.ReadInt32("Spline Full Time", index);
packet.ReadInt32("Spline Unk Int32 1", index);
if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767))
{
packet.ReadSingle("Spline Duration Multiplier", index);
packet.ReadSingle("Spline Unit Interval", index);
packet.ReadSingle("Spline Unk Float 2", index);
packet.ReadInt32("Spline Height Time", index);
}
var splineCount = packet.ReadInt32();
for (var i = 0; i < splineCount; i++)
packet.ReadVector3("Spline Waypoint", index, i);
if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767))
packet.ReadEnum<SplineMode>("Spline Mode", TypeCode.Byte, index);
packet.ReadVector3("Spline Endpoint", index);
}
}
else // !UpdateFlag.Living
{
if (flags.HasAnyFlag(UpdateFlag.GOPosition))
{
packet.ReadPackedGuid("[" + index + "] GO Position GUID");
moveInfo.Position = packet.ReadVector3("[" + index + "] GO Position");
packet.ReadVector3("[" + index + "] GO Transport Position");
moveInfo.Orientation = packet.ReadSingle("[" + index + "] GO Orientation");
packet.ReadSingle("[" + index + "] GO Transport Orientation");
}
else if (flags.HasAnyFlag(UpdateFlag.StationaryObject))
packet.ReadVector4("[" + index + "] Stationary Position");
}
if (flags.HasAnyFlag(UpdateFlag.Unknown1))
packet.ReadInt32("[" + index + "] Unk Int32");
if (flags.HasAnyFlag(UpdateFlag.LowGuid))
packet.ReadInt32("[" + index + "] Low GUID");
if (flags.HasAnyFlag(UpdateFlag.AttackingTarget))
packet.ReadPackedGuid("[" + index + "] Target GUID");
if (flags.HasAnyFlag(UpdateFlag.Transport))
packet.ReadInt32("[" + index + "] Transport Movement Time (ms)");
if (flags.HasAnyFlag(UpdateFlag.Vehicle))
{
moveInfo.VehicleId = packet.ReadUInt32("[" + index + "] Vehicle ID");
packet.ReadSingle("[" + index + "] Vehicle Orientation");
}
if (flags.HasAnyFlag(UpdateFlag.GORotation))
packet.ReadPackedQuaternion("[" + index + "] GO Rotation");
// Initialize fields that are not used by GOs
if (guid.GetObjectType() == ObjectType.GameObject)
{
moveInfo.VehicleId = 0;
moveInfo.WalkSpeed = 0;
moveInfo.RunSpeed = 0;
}
return moveInfo;
}
示例8: HandleServerChatMessage
//.........这里部分代码省略.........
packet.StartBitStream(SenderGUID, 2, 4, 0, 6, 1, 3, 5, 7);
packet.ReadBit(); // fake bit
packet.StartBitStream(GroupGUID, 6, 0, 4, 1, 2, 3, 7, 5);
var hasPrefix = !packet.ReadBit();
var bit1494 = packet.ReadBit();
var hasRealmId = !packet.ReadBit();
var bit1490 = !packet.ReadBit();
int senderName = 0;
if (hasSender)
senderName = (int)packet.ReadBits(11);
packet.ReadBit(); // fake bit
packet.StartBitStream(ReceiverGUID, 4, 0, 6, 7, 5, 1, 3, 2);
int prefixLen = 0;
if (hasPrefix)
prefixLen = (int)packet.ReadBits(5);
var hasReceiver = !packet.ReadBit();
var bit148C = !packet.ReadBit();
int textLen = 0;
if (hasText)
textLen = (int)packet.ReadBits(12);
var hasLang = !packet.ReadBit();
int countBits148C = 0;
if (bit148C)
countBits148C = (int)packet.ReadBits(9);
packet.ReadBit(); // fake bit
int receiverLen = 0;
if (hasReceiver)
receiverLen = (int)packet.ReadBits(11);
packet.StartBitStream(GuildGUID, 0, 2, 1, 4, 6, 7, 5, 3);
var hasChannel = !packet.ReadBit();
int channelLen = 0;
if (hasChannel)
{
channelLen = (int)packet.ReadBits(7);
packet.ReadWoWString("Channel Name", channelLen);
}
if (hasSender)
text.Comment = packet.ReadWoWString("Sender Name", senderName);
packet.ParseBitStream(GroupGUID, 6, 7, 1, 2, 4, 3, 0, 5);
packet.ParseBitStream(ReceiverGUID, 0, 4, 1, 3, 5, 7, 2, 6);
text.Type = (ChatMessageType)packet.ReadEnum<ChatMessageType540>("Chat type", TypeCode.Byte);
packet.ParseBitStream(SenderGUID, 7, 6, 5, 4, 0, 2, 1, 3);
if (hasPrefix)
packet.ReadWoWString("Addon Message Prefix", prefixLen);
if (hasRealmId)
packet.ReadInt32("Realm Id");
packet.ParseBitStream(GuildGUID, 1, 0, 3, 7, 6, 5, 2, 4);
if (hasReceiver)
packet.ReadWoWString("Receiver Name", receiverLen);
if (hasAchi)
packet.ReadInt32("Achievement");
if (hasLang)
text.Language = packet.ReadEnum<Language>("Language", TypeCode.Byte);
if (hasText)
text.Text = packet.ReadWoWString("Text", textLen);
if (bit1490)
packet.ReadSingle("Float1490");
packet.WriteGuid("SenderGUID", SenderGUID);
packet.WriteGuid("ReceiverGUID", ReceiverGUID);
packet.WriteGuid("GuildGUID", GuildGUID);
packet.WriteGuid("GroupGUID", GroupGUID);
uint entry = 0;
var guid = new Guid(BitConverter.ToUInt64(SenderGUID, 0));
if (guid.GetObjectType() == ObjectType.Unit)
entry = guid.GetEntry();
if (entry != 0)
Storage.CreatureTexts.Add(entry, text, packet.TimeSpan);
}
示例9: HandleNpcGossip
public static void HandleNpcGossip(Packet packet)
{
var guid = new byte[8];
uint[] QuestTitleLength;
uint[] OptionsMessageLength;
uint[] BoxMessageLength;
guid[7] = packet.ReadBit();
guid[6] = packet.ReadBit();
guid[1] = packet.ReadBit();
var QuestsCount = packet.ReadBits("Quests Count", 19);
guid[0] = packet.ReadBit();
guid[4] = packet.ReadBit();
guid[5] = packet.ReadBit();
guid[2] = packet.ReadBit();
guid[3] = packet.ReadBit();
var OptionsCount = packet.ReadBits("Gossip Options Count", 20);
OptionsMessageLength = new uint[OptionsCount];
BoxMessageLength = new uint[OptionsCount];
for (var i = 0; i < OptionsCount; ++i)
{
BoxMessageLength[i] = packet.ReadBits(12);
OptionsMessageLength[i] = packet.ReadBits(12);
}
QuestTitleLength = new uint[QuestsCount];
for (var i = 0; i < QuestsCount; ++i)
{
packet.ReadBit("Quest Icon Change", i);
QuestTitleLength[i] = packet.ReadBits(9);
}
for (var i = 0; i < QuestsCount; i++)
{
packet.ReadEnum<QuestFlags2>("Quest Special Flags", TypeCode.UInt32, i);
packet.ReadEntryWithName<UInt32>(StoreNameType.Quest, "Quest Id", i);
packet.ReadUInt32("Quest Level", i);
packet.ReadUInt32("Quest Icon", i);
packet.ReadEnum<QuestFlags>("Quest Flags", TypeCode.UInt32, i);
packet.ReadWoWString("Quest Titles", QuestTitleLength[i], i);
}
packet.ReadXORByte(guid, 6);
var ObjectGossip = new Gossip();
ObjectGossip.GossipOptions = new List<GossipOption>((int)OptionsCount);
for (var i = 0; i < OptionsCount; ++i)
{
var gossipMenuOption = new GossipOption
{
RequiredMoney = packet.ReadUInt32("Message Box Required Money", i),
OptionText = packet.ReadWoWString("Gossip Option Text", OptionsMessageLength[i], i),
Index = packet.ReadUInt32("Gossip Option Index", i),
OptionIcon = packet.ReadEnum<GossipOptionIcon>("Gossip Option Icon", TypeCode.Byte, i),
BoxText = packet.ReadWoWString("Message Box Text", BoxMessageLength[i], i),
Box = packet.ReadBoolean("Message Box Coded", i), // True if it has a password.
};
ObjectGossip.GossipOptions.Add(gossipMenuOption);
}
packet.ReadXORByte(guid, 2);
var GossipMenuTextId = packet.ReadUInt32("Gossip Menu Text Id");
packet.ReadXORByte(guid, 1);
packet.ReadXORByte(guid, 5);
var GossipMenuId = packet.ReadUInt32("Gossip Menu Id");
packet.ReadUInt32("Friendly Faction Id");
packet.ReadXORByte(guid, 4);
packet.ReadXORByte(guid, 7);
packet.ReadXORByte(guid, 3);
packet.ReadXORByte(guid, 0);
packet.WriteGuid("Object Guid", guid);
var ObjectGuid = new Guid(BitConverter.ToUInt64(guid, 0));
ObjectGossip.ObjectEntry = ObjectGuid.GetEntry();
ObjectGossip.ObjectType = ObjectGuid.GetObjectType();
if (ObjectGuid.GetObjectType() == ObjectType.Unit)
if (Storage.Objects.ContainsKey(ObjectGuid))
((Unit)Storage.Objects[ObjectGuid].Item1).GossipId = GossipMenuId;
Storage.Gossips.Add(Tuple.Create(GossipMenuId, GossipMenuTextId), ObjectGossip, packet.TimeSpan);
packet.AddSniffData(StoreNameType.Gossip, (int)GossipMenuId, ObjectGuid.GetEntry().ToString(CultureInfo.InvariantCulture));
}