本文整理汇总了C#中RealmPacketIn.ReadFloat方法的典型用法代码示例。如果您正苦于以下问题:C# RealmPacketIn.ReadFloat方法的具体用法?C# RealmPacketIn.ReadFloat怎么用?C# RealmPacketIn.ReadFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RealmPacketIn
的用法示例。
在下文中一共展示了RealmPacketIn.ReadFloat方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleCreateTicketPacket
public static void HandleCreateTicketPacket(IRealmClient client, RealmPacketIn packet)
{
var chr = client.ActiveCharacter;
if (chr.Ticket == null)
{
var map = (MapId)packet.ReadUInt32();
var x = packet.ReadFloat();
var y = packet.ReadFloat();
var z = packet.ReadFloat();
var msg = packet.ReadCString();
var type = (TicketType)packet.ReadUInt32(); // prev. unk0
var unk1 = packet.ReadByte(); // unk1, 1
var unk2 = packet.ReadUInt32(); // unk2, 0
var unk3 = packet.ReadUInt32(); // unk3, 0
var ticket = new Ticket(chr, msg, type);
TicketMgr.Instance.AddTicket(ticket);
chr.Ticket = ticket;
SendCreateResponse(client, TicketInfoResponse.Saved);
}
else
{
SendCreateResponse(client, TicketInfoResponse.Fail);
}
}
示例2: HandleReportLagTicket
public static void HandleReportLagTicket(IRealmClient client, RealmPacketIn packet)
{
var type = (TicketReportLagType)packet.ReadUInt32();
var unk0 = packet.ReadUInt32(); // Seems to be always 0
var posX = packet.ReadFloat();
var posY = packet.ReadFloat();
var posZ = packet.ReadFloat();
}
示例3: HandleMoveSetRawPosition
public static void HandleMoveSetRawPosition(IRealmClient client, RealmPacketIn packet)
{
var pos = packet.ReadVector3();
float orientation = packet.ReadFloat();
var region = client.ActiveCharacter.Region;
if (region != null)
{
client.ActiveCharacter.TeleportTo(region, ref pos);
}
}
示例4: HandleWorldTeleport
public static void HandleWorldTeleport(IRealmClient client, RealmPacketIn packet)
{
uint time = packet.ReadUInt32();
MapId mapId = (MapId)packet.ReadUInt32();
var pos = packet.ReadVector3();
float orientation = packet.ReadFloat(); // in client specified as degrees
var region = World.GetRegion(mapId);
if (region != null)
{
client.ActiveCharacter.TeleportTo(region, ref pos);
}
}
示例5: MinimapPing
public static void MinimapPing(IRealmClient client, RealmPacketIn packet)
{
var x = packet.ReadFloat();
var y = packet.ReadFloat();
var member = client.ActiveCharacter.GroupMember;
if (member == null)
return;
member.Group.SendPing(member, x, y);
}
示例6: HandleBuyItem
public static void HandleBuyItem(IRealmClient client, RealmPacketIn packet)
{
var vendorId = packet.ReadEntityId();
var itemEntryId = packet.ReadUInt32();
//var slot = packet.ReadUInt32(); // slot in the vendor list
packet.ReadFloat(); // unknown float
//var count = packet.ReadUInt32();
var amount = packet.ReadInt32();
var chr = client.ActiveCharacter;
var vendor = chr.Region.GetObject(vendorId) as NPC;
if (vendor != null && vendor.IsVendor)
{
vendor.VendorEntry.BuyItem(chr, itemEntryId, chr.Inventory, amount, BaseInventory.INVALID_SLOT);
}
}
示例7: Start
/// <summary>
/// This starts a spell-cast, requested by the client.
/// The client submits where or what the user selected in the packet.
/// </summary>
internal SpellFailedReason Start(Spell spell, RealmPacketIn packet, byte castId, byte unkFlags, uint glyphSlot = (uint)0)
{
IsPlayerCast = true;
//var stopwatch = Stopwatch.StartNew();
if (IsCasting)
{
if (!IsChanneling)
{
SpellHandler.SendCastFailed(Client, castId, spell, SpellFailedReason.SpellInProgress);
return SpellFailedReason.SpellInProgress;
}
else
{
Cancel(SpellFailedReason.DontReport);
}
}
GlyphSlot = glyphSlot;
Map = CasterObject.Map;
Phase = CasterObject.Phase;
IsCasting = true;
Spell = spell;
Id = castId;
//byte unkFlag = packet.ReadByte();
// TODO: Corpse flags
//(targetFlags & SpellCastTargetFlags.Corpse) != 0 ||
// (targetFlags & SpellCastTargetFlags.ReleasedCorpse) != 0) {
// read the target-information, sent with the Spell
WorldObject selected = null;
bool targetFound = false;
TargetFlags = (SpellTargetFlags)packet.ReadUInt32();
// 0x0
if (TargetFlags == SpellTargetFlags.Self)
{
targetFound = true;
TargetLoc = CasterObject.Position;
selected = CasterObject;
}
// 0x18A02
if (TargetFlags.HasAnyFlag(
SpellTargetFlags.SpellTargetFlag_Dynamic_0x10000 |
SpellTargetFlags.Corpse |
SpellTargetFlags.Object |
SpellTargetFlags.PvPCorpse |
SpellTargetFlags.Unit))
{
// The user selected an Object
var uid = packet.ReadPackedEntityId();
selected = Map.GetObject(uid);
if (selected == null || !CasterObject.CanSee(selected))
{
Cancel(SpellFailedReason.BadTargets);
return SpellFailedReason.BadTargets;
}
targetFound = true;
TargetLoc = selected.Position;
}
// 0x1010
if (CasterObject is Character && TargetFlags.HasAnyFlag(SpellTargetFlags.TradeItem | SpellTargetFlags.Item))
{
var uid = packet.ReadPackedEntityId();
TargetItem = ((Character)CasterObject).Inventory.GetItem(uid);
if (TargetItem == null || !TargetItem.CanBeUsed)
{
Cancel(SpellFailedReason.ItemGone);
return SpellFailedReason.ItemGone;
}
}
// 0x20
if (TargetFlags.HasAnyFlag(SpellTargetFlags.SourceLocation))
{
Map.GetObject(packet.ReadPackedEntityId()); // since 3.2.0
//SourceLoc = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
}
SourceLoc = CasterObject.Position;
// 0x40
if (TargetFlags.HasAnyFlag(SpellTargetFlags.DestinationLocation))
{
selected = Map.GetObject(packet.ReadPackedEntityId());
TargetLoc = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
//Console.WriteLine("SpellCast.Start - DestLoc {0}", TargetLoc);
targetFound = true;
}
// 0x2000
//.........这里部分代码省略.........
示例8: ReadTargetInfoFromPacket
private SpellFailedReason ReadTargetInfoFromPacket(RealmPacketIn packet)
{
TargetFlags = (SpellTargetFlags)packet.ReadUInt32();
// TODO: Corpse flags
if (TargetFlags == SpellTargetFlags.Self)
{
SelectedTarget = CasterObject;
TargetLoc = SelectedTarget.Position;
return SpellFailedReason.Ok;
}
if (TargetFlags.HasAnyFlag(SpellTargetFlags.WorldObject))
{
var entityId = packet.ReadPackedEntityId();
SelectedTarget = Map.GetObject(entityId);
if (SelectedTarget == null || !CasterObject.CanSee(SelectedTarget))
{
Cancel(SpellFailedReason.BadTargets);
return SpellFailedReason.BadTargets;
}
TargetLoc = SelectedTarget.Position;
}
if (CasterObject is Character && TargetFlags.HasAnyFlag(SpellTargetFlags.AnyItem))
{
var entityId = packet.ReadPackedEntityId();
TargetItem = CasterChar.Inventory.GetItem(entityId);
if (TargetItem == null || !TargetItem.CanBeUsed)
{
Cancel(SpellFailedReason.ItemGone);
return SpellFailedReason.ItemGone;
}
}
if (TargetFlags.HasAnyFlag(SpellTargetFlags.SourceLocation))
{
Map.GetObject(packet.ReadPackedEntityId()); // since 3.2.0
//SourceLoc = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
}
SourceLoc = CasterObject.Position;
if (TargetFlags.HasAnyFlag(SpellTargetFlags.DestinationLocation))
{
SelectedTarget = Map.GetObject(packet.ReadPackedEntityId());
TargetLoc = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
}
if (TargetFlags.HasAnyFlag(SpellTargetFlags.String))
{
StringTarget = packet.ReadCString();
}
return SpellFailedReason.Ok;
}