本文整理汇总了C#中Packet.ReadSingle方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.ReadSingle方法的具体用法?C# Packet.ReadSingle怎么用?C# Packet.ReadSingle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet.ReadSingle方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GameobjectQueryResponse
public static void GameobjectQueryResponse(Packet packet)
{
GameObject go = new GameObject();
var entry = packet.ReadEntryKey("Entry");
go.Entry = entry.Key;
if (entry.Value)
return;
go.Type = packet.ReadEnum<GameObjectType>("Type");
go.DisplayID = packet.ReadInt32("Display ID");
for (var i = 0; i < 4; i++)
go.Name[i] = packet.ReadCString("Name " + i);
go.IconName = packet.ReadCString("Icon Name");
go.CastCaption = packet.ReadCString("Cast Caption");
go.UnkString = packet.ReadCString("Unk String");
for (var i = 0; i < 32; i++)
go.Data[i] = packet.ReadInt32("Data " + i);
go.Size = packet.ReadSingle("Size");
for (var i = 0; i < 6; i++)
go.QuestItems[i] = packet.ReadInt32("Quest Item " + i);
go.Exp = packet.ReadInt32("Expansion ID");
GameObjectStorage.GetSingleton().Add(go);
}
示例2: HandleGameObjectQueryResponse
public static void HandleGameObjectQueryResponse(Packet packet)
{
var entry = packet.ReadEntry();
Console.WriteLine("Entry: " + entry.Key);
if (entry.Value)
return;
var unkInt = packet.ReadInt32();
Console.WriteLine("unkInt: " + unkInt);
var type = (GameObjectType)packet.ReadInt32();
Console.WriteLine("Type: " + type);
var dispId = packet.ReadInt32();
Console.WriteLine("Display ID: " + dispId);
var name = new string[4];
for (var i = 0; i < 4; i++)
{
name[i] = packet.ReadCString();
Console.WriteLine("Name " + i + ": " + name[i]);
}
var iconName = packet.ReadCString();
Console.WriteLine("Icon Name: " + iconName);
var castCaption = packet.ReadCString();
Console.WriteLine("Cast Caption: " + castCaption);
var unkStr = packet.ReadCString();
Console.WriteLine("Unk String: " + unkStr);
var data = new int[32];
for (var i = 0; i < 32; i++)
{
data[i] = packet.ReadInt32();
Console.WriteLine("Data " + i + ": " + data[i]);
}
var size = packet.ReadSingle();
Console.WriteLine("Size: " + size);
var qItemCount = packet.ReadByte();
Console.WriteLine("Quest Item Count: " + qItemCount);
var qItem = new int[qItemCount];
for (var i = 0; i < qItemCount; i++)
{
qItem[i] = packet.ReadInt32();
Console.WriteLine("Quest Item " + i + ": " + qItem[i]);
}
var expansion = packet.ReadInt32();
Console.WriteLine("Expansion: " + expansion);
SQLOutput.SQLOutput.WriteData(SQLOutput.SQLOutput.GameObjects.GetCommand(entry.Key, type, dispId, name[0], iconName,
castCaption, unkStr, data, size, qItem));
}
示例3: HandleCreatureQueryResponse
public static void HandleCreatureQueryResponse(Packet packet)
{
Creature c = new Creature();
var entry = packet.ReadEntryKey("Entry");
if (entry.Value)
return;
c.Entry = entry.Key;
for (var i = 0; i < 4; i++)
c.Name[i] = packet.ReadCString("Name " + i);
for (var i = 0; i < 4; i++)
c.Name[i] = packet.ReadCString("Unk string " + i);
c.SubName = packet.ReadCString("Sub Name");
c.IconName = packet.ReadCString("Icon Name");
c.TypeFlags = packet.ReadEnum<CreatureTypeFlag>("Type Flags");
c.Type = packet.ReadEnum<CreatureType>("Type");
c.Family = packet.ReadEnum<CreatureFamily>("Family");
int val = packet.ReadInt32("Unk int");
c.Rank = packet.ReadEnum<CreatureRank>("Rank");
c.KillCredit1 = packet.ReadInt32("Kill Credit 1");
c.KillCredit2 = packet.ReadInt32("Kill Credit 2");
for (var i = 0; i < 4; i++)
c.DisplayIDs[i] = packet.ReadInt32("Display ID " + i);
c.HealthModifier = packet.ReadSingle("Health Modifier");
c.ManaModifier = packet.ReadSingle("Mana Modifier");
c.RacialLeader = packet.ReadBoolean("Racial Leader");
for (var i = 0; i < 6; i++)
c.QuestItems[i] = packet.ReadInt32("Quest Item " + i);
c.MovementID = packet.ReadInt32("Movement ID");
c.Exp = packet.ReadInt32("Expansion ID");
CreatureStorage.GetSingleton().Add(c);
}
示例4: ReadMovementUpdateBlock
public static MovementInfo ReadMovementUpdateBlock(Packet packet, Guid guid)
{
var moveInfo = new MovementInfo();
var flags = packet.ReadEnum<UpdateFlag>("Update Flags");
if (flags.HasFlag(UpdateFlag.Living))
{
moveInfo = MovementHandler.ReadMovementInfo(packet, guid);
var moveFlags = moveInfo.Flags;
for (var i = 0; i < 9; i++)
{
var j = (SpeedType)i;
var speed = packet.ReadSingle();
Console.WriteLine(j + " Speed: " + speed);
switch (j)
{
case SpeedType.Walk:
{
moveInfo.WalkSpeed = speed / 2.5f;
break;
}
case SpeedType.Run:
{
moveInfo.RunSpeed = speed / 7.0f;
break;
}
}
}
if (moveFlags.HasFlag(MoveFlag.SplineEnabled))
{
var splineFlags = packet.ReadEnum<SplineFlag>("Spline Flags");
if (splineFlags.HasFlag(SplineFlag.FinalPoint))
packet.ReadVector3("Final Spline Coords");
if (splineFlags.HasFlag(SplineFlag.FinalTarget))
packet.ReadGuid("Final Spline Target GUID");
if (splineFlags.HasFlag(SplineFlag.FinalOrientation))
packet.ReadSingle("Final Spline Orientation");
packet.ReadInt32("Spline Time");
packet.ReadInt32("Spline Full Time");
packet.ReadInt32("Spline Unk Int32 1");
packet.ReadSingle("Spline Duration Multiplier");
packet.ReadSingle("Spline Unit Interval");
packet.ReadSingle("Spline Unk Float 2");
packet.ReadInt32("Spline Height Time");
var splineCount = packet.ReadInt32("Spline Count");
for (var i = 0; i < splineCount; i++)
packet.ReadVector3("Spline Waypoint " + i);
packet.ReadEnum<SplineMode>("Spline Mode");
packet.ReadVector3("Spline Endpoint");
}
}
else
{
if (flags.HasFlag(UpdateFlag.GOPosition))
{
packet.ReadPackedGuid("GO Position GUID");
var gopos = packet.ReadVector3("GO Position");
packet.ReadVector3("GO Transport Position");
var goFacing = packet.ReadSingle("GO Orientation");
moveInfo.Position = gopos;
moveInfo.Orientation = goFacing;
packet.ReadSingle("GO Transport Orientation");
}
else if (flags.HasFlag(UpdateFlag.StationaryObject))
packet.ReadVector4("Stationary Position");
}
if (flags.HasFlag(UpdateFlag.LowGuid))
packet.ReadInt32("Low GUID");
if (flags.HasFlag(UpdateFlag.AttackingTarget))
packet.ReadPackedGuid("Target GUID");
if (flags.HasFlag(UpdateFlag.Transport))
packet.ReadInt32("Transport Creation Time");
if (flags.HasFlag(UpdateFlag.Vehicle))
{
packet.ReadInt32("Vehicle ID");
packet.ReadSingle("Vehicle Orientation");
}
if (flags.HasFlag(UpdateFlag.GORotation))
packet.ReadPackedQuaternion("GO Rotation");
if (flags.HasFlag(UpdateFlag.Unknown2))
{
packet.ReadInt16("Unk Int16 1");
packet.ReadInt16("Unk Int16 2");
packet.ReadInt16("Unk Int16 3");
//.........这里部分代码省略.........
示例5: HandleQuestQueryResponse
public static void HandleQuestQueryResponse(Packet packet)
{
Quest q = new Quest();
q.Entry = packet.ReadInt32("Entry");
q.Method = packet.ReadEnum<QuestMethod>("Method");
q.Level = packet.ReadInt32("Level");
q.MinLevel = packet.ReadInt32("MinLevel");
var sort = packet.ReadInt32();
if (sort >= 0)
Console.WriteLine("Zone: {0}", sort);
else
Console.WriteLine("Sort: {0}", (QuestSort)(-sort));
q.ZoneOrSort = sort;
q.Type = packet.ReadEnum<QuestType>("Type");
q.SuggestedPlayers = packet.ReadInt32("SuggestedPlayers");
q.RepObjectiveFaction1 = packet.ReadInt32("RepObjFaction1");
q.RepObjectiveValue1 = packet.ReadInt32("RepObjValue1");
q.RepObjectiveFaction2 = packet.ReadInt32("RepObjFaction2");
q.RepObjectiveValue2 = packet.ReadInt32("RepObjValue2");
q.NextQuestID = packet.ReadInt32("NextQuestID");
q.XPID = packet.ReadInt32("XPID");
q.RewardMoney = packet.ReadInt32("Money");
q.RewardMoneyAtMaxLevel = packet.ReadInt32("MoneyAtMaxLevel");
q.Spell = packet.ReadInt32("Spell");
q.SpellCast = packet.ReadInt32("SpellCast");
q.Honor = packet.ReadInt32("Honor");
q.HonorMultiplier = packet.ReadSingle("Honor (2)");
q.SourceItemID = packet.ReadInt32("Source Item ID");
q.Flags = packet.ReadEnum<QuestFlag>("Flags");
q.Unk = packet.ReadInt32("Unk");
q.RewardTitleID = packet.ReadInt32("RewardTitleID");
q.PlayersSlain = packet.ReadInt32("PlayersSlain");
q.RewardTalentPoints = packet.ReadInt32("RewardTalentPoints");
q.RewardArenaPoints = packet.ReadInt32("RewardArenaPoints");
q.RewardSkillLineID = packet.ReadInt32("RewardSkillLineID");
q.RewardSkillPoints = packet.ReadInt32("RewardSkillPoints");
q.RewardFactionMask = packet.ReadInt32("RewardFactionMask");
q.QuestGiverPortraitID = packet.ReadInt32("QuestGiverPortraitID");
q.QuestTurnInPortraitID = packet.ReadInt32("QuestTurnInPortraitID");
for (int i = 0; i < 4; i++)
{
q.RewardItem[i] = packet.ReadInt32("RewardItem[" + i + "]");
q.RewardItemCount[i] = packet.ReadInt32("RewardItemCount[" + i + "]");
}
for (int i = 0; i < 6; i++)
{
q.RewardItemChoice[i] = packet.ReadInt32("RewardItemChoice[" + i + "]");
q.RewardItemChoiceCount[i] = packet.ReadInt32("RewardItemChoiceCount[" + i + "]");
}
for (int i = 0; i < 5; i++)
q.RewardRepFactionID[i] = packet.ReadInt32("RewardRepFactionID[" + i + "]");
for (int i = 0; i < 5; i++)
q.RewardRepValueID[i] = packet.ReadInt32("RewardRepValueID[" + i + "]");
for (int i = 0; i < 5; i++)
q.RewardRepValue[i] = packet.ReadInt32("RewardRepValue[" + i + "]");
q.PointMapID = packet.ReadInt32("PointMapID");
q.PointX = packet.ReadSingle("PointX");
q.PointY = packet.ReadSingle("PointY");
q.PointOption = packet.ReadInt32("PointOption");
q.Title = packet.ReadCString("Title");
q.ObjectiveText = packet.ReadCString("ObjectiveText");
q.Description = packet.ReadCString("Description");
q.EndText = packet.ReadCString("EndText");
q.CompletionText = packet.ReadCString("CompletionText");
for (int i = 0; i < 4; i++)
{
q.RequiredCreatureOrGOID[i] = packet.ReadInt32("RequiredCreatureOrGOID[" + i + "]");
q.RequiredCreatureOrGOCount[i] = packet.ReadInt32("RequiredCreatureOrGOCount[" + i + "]");
q.ItemDropIntermediateID[i] = packet.ReadInt32("ItemDropIntermediateID[" + i + "]");
q.ItemDropIntermediateCount[i] = packet.ReadInt32("ItemDropIntermediateCount[" + i + "]");
}
for (int i = 0; i < 6; i++)
{
q.RequiredItemID[i] = packet.ReadInt32("RequiredItemID[" + i + "]");
q.RequiredItemCount[i] = packet.ReadInt32("RequiredItemCount[" + i + "]");
}
q.CriteriaSpellID = packet.ReadInt32("CriteriaSpellID");
for (int i = 0; i < 4; i++)
q.ObjectiveTexts[i] = packet.ReadCString("ObjectiveTexts[" + i + "]");
for (int i = 0; i < 4; i++)
{
q.RewardCurrencyID[i] = packet.ReadInt32("RewardCurrencyID[" + i + "]");
q.RewardCurrencyValue[i] = packet.ReadInt32("RewardCurrencyValue[" + i + "]");
}
for (int i = 0; i < 4; i++)
{
q.RequiredCurrencyID[i] = packet.ReadInt32("RequiredCurrencyID[" + i + "]");
q.RequiredCurrencyValue[i] = packet.ReadInt32("RequiredCurrencyValue[" + i + "]");
}
q.QuestGiverPortraitText = packet.ReadCString("QuestGiverPortraitText");
q.QuestGiverPortraitUnk = packet.ReadCString("QuestGiverPortraitUnk");
q.QuestTurnInPortraitText = packet.ReadCString("QuestTurnInPortraitText");
q.QuestTurnInPortraitUnk = packet.ReadCString("QuestTurnInPortrainUnk");
q.SoundField1 = packet.ReadInt32("Sound field 1");
q.SoundField2 = packet.ReadInt32("Sound field 2");
QuestStorage.GetSingleton().Add(q);
}
示例6: HandleMove
public override void HandleMove(Packet packet)
{
base.HandleMove(packet);
Acceleration = packet.ReadSingle();
Steering = packet.ReadSingle();
TurretDirection = packet.ReadSingle();
var vehFlags = packet.ReadUInteger();
var firing = packet.ReadBoolean();
var target = packet.ReadPadding(2).ReadTFID();
var targetObj = GetMap().GetObject(target);
if (targetObj != null)
SetTargetObject(targetObj);
}
示例7: ParseMonsterMovePackets
public static void ParseMonsterMovePackets(Packet packet)
{
var guid = packet.ReadPackedGuid("GUID");
if (packet.GetOpcode() == (ushort)Opcode.SMSG_MONSTER_MOVE_TRANSPORT)
{
packet.ReadPackedGuid("Transport GUID");
packet.ReadByte("Transport Seat");
}
packet.ReadBoolean("Unk Boolean");
var pos = packet.ReadVector3("Position");
packet.ReadInt32("Move Ticks");
var type = packet.ReadEnum<SplineType>("Spline Type");
switch (type)
{
case SplineType.FacingSpot:
{
packet.ReadVector3("Facing Spot");
break;
}
case SplineType.FacingTarget:
{
packet.ReadGuid("Facing GUID");
break;
}
case SplineType.FacingAngle:
{
packet.ReadSingle("Facing Angle");
break;
}
case SplineType.Stop:
{
return;
}
}
var flags = packet.ReadEnum<SplineFlag>("Spline Flags");
if (flags.HasFlag(SplineFlag.Unknown3)) {
packet.ReadEnum<MoveAnimationState>("Animation State");
packet.ReadInt32("Unk Int32 1");
}
packet.ReadInt32("Move Time");
if (flags.HasFlag(SplineFlag.Trajectory)) {
packet.ReadSingle("Unk Single");
packet.ReadInt32("Unk Int32 2");
}
var waypoints = packet.ReadInt32("Waypoints");
var newpos = packet.ReadVector3("Waypoint 0");
if (flags.HasFlag(SplineFlag.Flying) || flags.HasFlag(SplineFlag.CatmullRom)) {
for (var i = 0; i < waypoints - 1; i++) {
packet.ReadVector3("Waypoint " + (i + 1));
}
}
else {
var mid = new Vector3();
mid.X = (pos.X + newpos.X) * 0.5f;
mid.Y = (pos.Y + newpos.Y) * 0.5f;
mid.Z = (pos.Z + newpos.Z) * 0.5f;
for (var i = 0; i < waypoints - 1; i++) {
var vec = packet.ReadPackedVector3();
vec.X += mid.X;
vec.Y += mid.Y;
vec.Z += mid.Z;
Console.WriteLine("Waypoint " + (i + 1) + ": " + vec);
}
}
}
示例8: ReadMovementInfo
public static MovementInfo ReadMovementInfo(Packet packet, Guid guid)
{
bool HaveTransportData = false,
HaveTransportTime2 = false,
HaveTransportTime3 = false,
HavePitch = false,
HaveFallData = false,
HaveFallDirection = false,
HaveSplineElevation = false,
UnknownBool = false;
var info = new MovementInfo();
info.Flags = packet.ReadEnum<MoveFlag>("Movement Flags", 30);
var flags2 = packet.ReadEnum<MoveFlagExtra>("Extra Movement Flags", 12);
if (HaveTransportData = packet.ReadBit())
{
HaveTransportTime2 = packet.ReadBit();
HaveTransportTime3 = packet.ReadBit();
}
HavePitch = packet.ReadBit();
if (HaveFallData = packet.ReadBit())
HaveFallDirection = packet.ReadBit();
HaveSplineElevation = packet.ReadBit();
UnknownBool = packet.ReadBit();
packet.ReadGuid("GUID");
packet.ReadInt32("Time");
var pos = packet.ReadVector4("Position");
info.Position = new Vector3(pos.X, pos.Y, pos.Z);
info.Orientation = pos.O;
if (HaveTransportData)//info.Flags.HasFlag(MoveFlag.OnTransport))
{
packet.ReadGuid("Transport GUID");
packet.ReadVector4("Transport Position");
packet.ReadByte("Transport Seat");
packet.ReadInt32("Transport Time");
if (HaveTransportTime2)//flags2.HasFlag(MoveFlagExtra.InterpolatedPlayerMovement))
packet.ReadInt32("Transport Time 2");
if (HaveTransportTime3)
packet.ReadInt32("Transport Time 3");
}
if (HavePitch)//info.Flags.HasAnyFlag(MoveFlag.Swimming | MoveFlag.Flying) ||
//flags2.HasFlag(MoveFlagExtra.AlwaysAllowPitching))
packet.ReadSingle("Swim Pitch");
if (HaveFallData) // info.Flags.HasFlag(MoveFlag.Falling)
{
packet.ReadInt32("Fall Time");
packet.ReadSingle("Jump Velocity");
if (HaveFallDirection)
{
packet.ReadSingle("Jump Sin");
packet.ReadSingle("Jump Cos");
packet.ReadSingle("Jump XY Speed");
}
}
if (HaveSplineElevation) //info.Flags.HasFlag(MoveFlag.SplineElevation))
packet.ReadSingle("Spline Elevation");
return info;
}
示例9: ReadMovementInfo
public static MovementInfo ReadMovementInfo(Packet packet, Guid guid)
{
var info = new MovementInfo();
info.Flags = packet.ReadEnum<MoveFlag>("Movement Flags");
var flags2 = packet.ReadEnum<MoveFlagExtra>("Extra Movement Flags");
packet.ReadInt32("Time");
var pos = packet.ReadVector4("Position");
info.Position = new Vector3(pos.X, pos.Y, pos.Z);
info.Orientation = pos.O;
if (info.Flags.HasFlag(MoveFlag.OnTransport))
{
packet.ReadPackedGuid("Transport GUID");
packet.ReadVector4("Transport Position");
packet.ReadInt32("Transport Time");
packet.ReadByte("Transport Seat");
if (flags2.HasFlag(MoveFlagExtra.InterpolatedPlayerMovement))
packet.ReadInt32("Transport Time 2");
}
if (info.Flags.HasAnyFlag(MoveFlag.Swimming | MoveFlag.Flying) ||
flags2.HasFlag(MoveFlagExtra.AlwaysAllowPitching))
packet.ReadSingle("Swim Pitch");
packet.ReadInt32("Fall Time");
if (info.Flags.HasFlag(MoveFlag.Falling))
{
packet.ReadSingle("Jump Velocity");
packet.ReadSingle("Jump Sin");
packet.ReadSingle("Jump Cos");
packet.ReadSingle("Jump XY Speed");
}
if (info.Flags.HasFlag(MoveFlag.SplineElevation))
packet.ReadSingle("Spline Elevation");
return info;
}
示例10: HandleMove
public virtual void HandleMove(Packet packet)
{
var fidObject = packet.ReadPadding(4).ReadTFID();
Debug.Assert(fidObject == GetTFID(), "A TFID nem egyezik?");
Position = new Vector3(packet.ReadSingle(), packet.ReadSingle(), packet.ReadSingle());
Velocity = new Vector3(packet.ReadSingle(), packet.ReadSingle(), packet.ReadSingle());
Rotation = new Vector4(packet.ReadSingle(), packet.ReadSingle(), packet.ReadSingle(), packet.ReadSingle());
AngularVelocity = new Vector3(packet.ReadSingle(), packet.ReadSingle(), packet.ReadSingle());
Console.WriteLine("Pos: {0} | {1} | {2} ", Position.X, Position.Y, Position.Z);
Console.WriteLine("Rot: {0} | {1} | {2} | {3}", Rotation.X, Rotation.Y, Rotation.Z, Rotation.W);
var absolute = packet.ReadBoolean();
var tarLoc = new Vector3(packet.ReadPadding(3).ReadSingle(), packet.ReadSingle(), packet.ReadSingle());
packet.ReadPadding(4);
//if (GhostObject != null)
//GhostObject.SetMaskBits(2UL);
}