本文整理汇总了C#中EntityId.WritePacked方法的典型用法代码示例。如果您正苦于以下问题:C# EntityId.WritePacked方法的具体用法?C# EntityId.WritePacked怎么用?C# EntityId.WritePacked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityId
的用法示例。
在下文中一共展示了EntityId.WritePacked方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendSetSpellMissilePosition
public static void SendSetSpellMissilePosition(IPacketReceiver client, EntityId casterId, byte castCount, Vector3 position)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SET_PROJECTILE_POSITION, 21))
{
casterId.WritePacked(packet);
packet.WriteByte(castCount);
packet.WriteFloat(position.X);
packet.WriteFloat(position.Y);
packet.WriteFloat(position.Z);
client.Send(packet);
}
}
示例2: SendMagicDamage
/// <summary>
/// Any spell and ranged damage
/// </summary>
/// <param name="totalAmount">Total amount</param>
/// <returns>The actual amount, with all mali subtracted</returns>
public static void SendMagicDamage(EntityId caster, WorldObject target, uint spellId, uint amount, DamageType type,
uint absorbed, uint resisted, uint blocked, bool critical)
{
/*if (victimState == VICTIMSTATE.DEFLECT) // resist
return MagicResist(target,submitter,spellId);*/
// TODO: Magic miss, ranged dodge, etc.
using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELLNONMELEEDAMAGELOG, 40)) {
target.EntityId.WritePacked(packet);
caster.WritePacked(packet);
packet.Write(spellId);
packet.WriteUInt(amount);
packet.WriteByte((byte)type);
packet.WriteUInt(absorbed);
packet.WriteUInt(resisted);
packet.WriteByte(type == DamageType.Physical ? 1 : 0); // pyshical damage?
packet.WriteByte(0);
packet.WriteUInt(blocked);
packet.WriteByte(critical ? 7 : 6);
packet.Write(0);
target.PushPacketToSurroundingArea(packet, true, false);
}
}