本文整理汇总了C#中RealmPacketOut.WriteFloat方法的典型用法代码示例。如果您正苦于以下问题:C# RealmPacketOut.WriteFloat方法的具体用法?C# RealmPacketOut.WriteFloat怎么用?C# RealmPacketOut.WriteFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RealmPacketOut
的用法示例。
在下文中一共展示了RealmPacketOut.WriteFloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleAuctionListPendingSales
public static void HandleAuctionListPendingSales(IRealmClient client, RealmPacketIn packet)
{
var chr = client.ActiveCharacter;
var auctioneerId = packet.ReadEntityId();
var auctioneer = chr.Map.GetObject(auctioneerId) as NPC;
var count = 1u;
using (var packetOut = new RealmPacketOut(RealmServerOpCode.SMSG_AUCTION_LIST_PENDING_SALES, 14 * (int)count))
{
packetOut.Write(count);
for (var i = 0; i < count; ++i)
{
packetOut.Write("");
packetOut.Write("");
packetOut.WriteUInt(0);
packetOut.WriteUInt(0);
packetOut.WriteFloat(0f);
client.Send(packetOut);
}
}
}
示例2: SendSpellGo
/// <summary>
/// Sent after spell start. Triggers the casting animation
/// </summary>
public static void SendSpellGo(ObjectBase caster2, SpellCast cast,
ICollection<WorldObject> hitTargets, ICollection<CastMiss> missedTargets)
{
// TODO: Dynamic packet length?
if (!cast.IsCasting)
{
return;
}
//int len = 200;
int len = 24 + (hitTargets != null ? hitTargets.Count * 8 : 0) + (missedTargets != null ? missedTargets.Count * 10 : 0);
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELL_GO, len))
{
//caster1.EntityId.WritePacked(packet);
cast.Caster.EntityId.WritePacked(packet);
caster2.EntityId.WritePacked(packet);
packet.Write(cast.Id);
packet.Write(cast.Spell.Id);
var castGoFlags = cast.GoFlags;
packet.Write((int)castGoFlags);
//packet.Write(Util.Utility.GetEpochTime());
packet.Write(Utility.GetEpochTime());
//packet.Write(cast.CastDelay);
packet.WriteByte(hitTargets != null ? hitTargets.Count : 0);
if (hitTargets != null)
{
foreach (var target in hitTargets)
{
packet.Write(target.EntityId);
if (target is Character)
{
SendCastSuccess(cast.Caster, cast.Spell.Id, target as Character);
}
}
}
packet.WriteByte(missedTargets != null ? missedTargets.Count : 0);
if (missedTargets != null)
{
foreach (var miss in missedTargets)
{
packet.Write(miss.Target.EntityId);
packet.Write((byte)miss.Reason);
if (miss.Reason == CastMissReason.Reflect)
{
packet.Write((byte)0);// relfectreason
}
}
}
WriteTargets(packet, cast);
if ((castGoFlags & CastFlags.Flag_0x800) != 0)
{
packet.Write(0);
}
if ((castGoFlags & CastFlags.Flag_0x200000) != 0)
{
byte b1 = 0;
byte b2 = 0;
packet.Write(b1);
packet.Write(b2);
for (int i = 0; i < 6; i++)
{
byte mask = (byte)(1 << i);
if ((mask & b1) != 0)
{
if (!((mask & b2) != 0))
{
packet.WriteByte(0);
}
}
}
}
if ((castGoFlags & CastFlags.Flag_0x20000) != 0)
{
packet.WriteFloat(0);
packet.Write(0);
}
if ((cast.StartFlags & CastFlags.Ranged) != 0)
{
WriteAmmoInfo(cast, packet);
}
if ((castGoFlags & CastFlags.Flag_0x80000) != 0)
{
packet.Write(0);
//.........这里部分代码省略.........
示例3: SendCorpseMapQueryResponse
public static void SendCorpseMapQueryResponse(IRealmClient client)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE, 16))
{
for (var i = 0; i < 4; i++)
packet.WriteFloat(0.0f); // unk
client.Send(packet);
}
}
示例4: SendTimeSpeed
public static void SendTimeSpeed(IPacketReceiver client, DateTime time, float timeSpeed)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_LOGIN_SETTIMESPEED, 8))
{
packet.WriteDateTime(time);
packet.WriteFloat(timeSpeed);
packet.WriteInt(0); // new, unknown
client.Send(packet);
}
}
示例5: SendVerifyWorld
/// <summary>
/// Sends SMSG_LOGIN_VERIFY_WORLD (first ingame packet, sends char-location: Seems unnecessary?)
/// </summary>
/// <param name="chr"></param>
public static void SendVerifyWorld(Character chr)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_LOGIN_VERIFY_WORLD, 20))
{
packet.Write((int)chr.Map.Id);
packet.Write(chr.Position);
packet.WriteFloat(chr.Orientation);
chr.Client.Send(packet);
}
}
示例6: 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);
}
}
示例7: SendSpellGo
/// <summary>
/// Sent after spell start. Triggers the casting animation.
/// </summary>
public static void SendSpellGo(IEntity caster2, SpellCast cast,
ICollection<WorldObject> hitTargets, ICollection<MissedTarget> missedTargets, byte previousRuneMask)
{
if (cast.CasterObject != null && !cast.CasterObject.IsAreaActive) return;
// TODO: Dynamic packet length?
if (!cast.IsCasting)
{
return;
}
//int len = 200;
int len = 24 + (hitTargets != null ? hitTargets.Count * 8 : 0) + (missedTargets != null ? missedTargets.Count * 10 : 0);
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELL_GO, len))
{
//caster1.EntityId.WritePacked(packet);
cast.CasterReference.EntityId.WritePacked(packet);
caster2.EntityId.WritePacked(packet);
packet.Write(cast.Id);
packet.Write(cast.Spell.Id);
var castGoFlags = cast.GoFlags;
packet.Write((int)castGoFlags);
//packet.Write(Util.Utility.GetEpochTime());
packet.Write(Utility.GetEpochTime());
//packet.Write(cast.CastDelay);
packet.WriteByte(hitTargets != null ? hitTargets.Count : 0);
if (hitTargets != null && cast.CasterObject != null)
{
foreach (var target in hitTargets)
{
packet.Write(target.EntityId);
if (target is Character)
{
SendCastSuccess(cast.CasterObject, cast.Spell.Id, target as Character);
}
}
}
packet.WriteByte(missedTargets != null ? missedTargets.Count : 0);
if (missedTargets != null)
{
foreach (var miss in missedTargets)
{
packet.Write(miss.Target.EntityId);
packet.Write((byte)miss.Reason);
if (miss.Reason == CastMissReason.Reflect)
{
packet.Write((byte)0);// relfectreason
}
}
}
WriteTargets(packet, cast);
// runes
if (castGoFlags.HasFlag(CastFlags.RunicPowerGain))
{
packet.Write(0);
}
if (castGoFlags.HasFlag(CastFlags.RuneCooldownList))
{
var chr = cast.CasterChar;
var newRuneMask = chr.PlayerSpells.Runes.GetActiveRuneMask();
packet.Write(previousRuneMask);
packet.Write(newRuneMask);
for (int i = 0; i < SpellConstants.MaxRuneCount; i++)
{
var mask = (byte)(1 << i);
if ((mask & previousRuneMask) != 0)
{
if ((mask & newRuneMask) == 0)
{
packet.WriteByte(0);
}
}
}
}
if (castGoFlags.HasFlag(CastFlags.Flag_0x20000))
{
packet.WriteFloat(0);
packet.Write(0);
}
if (cast.StartFlags.HasFlag(CastFlags.Ranged))
{
WriteAmmoInfo(cast, packet);
}
//.........这里部分代码省略.........
示例8: SendNPCTextUpdate
/// <summary>
/// Sends a npc text update to the character
/// </summary>
/// <param name="character">recieving character</param>
/// <param name="text">class holding all info about text</param>
public static void SendNPCTextUpdate(Character character, IGossipEntry text)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_NPC_TEXT_UPDATE))
{
packet.Write(text.GossipId);
var i = 0;
for (; i < text.GossipEntries.Length; i++)
{
var entry = text.GossipEntries[i];
packet.WriteFloat(entry.Probability);
var isMaleTextEmpty = string.IsNullOrEmpty(entry.TextMale);
var isFemaleTextEmpty = string.IsNullOrEmpty(entry.TextFemale);
if (isMaleTextEmpty && isFemaleTextEmpty)
{
packet.WriteCString(" ");
packet.WriteCString(" ");
}
else if (isMaleTextEmpty)
{
packet.WriteCString(entry.TextFemale);
packet.WriteCString(entry.TextFemale);
}
else if (isFemaleTextEmpty)
{
packet.WriteCString(entry.TextMale);
packet.WriteCString(entry.TextMale);
}
else
{
packet.WriteCString(entry.TextMale);
packet.WriteCString(entry.TextFemale);
}
packet.Write((uint)entry.Language);
for (int emoteIndex = 0; emoteIndex < 3; emoteIndex++)
{
// TODO: Emotes
//packet.Write((uint)entry.Emotes[emoteIndex]);
//packet.Write(entry.EmoteDelays[emoteIndex]);
packet.Write(0L);
}
}
for (; i < 8; i++)
{
packet.WriteFloat(0);
packet.WriteByte(0);
packet.WriteByte(0);
packet.Fill(0, 4 * 7);
}
character.Client.Send(packet);
}
}
示例9: SendNPCTextUpdateSimple
/// <summary>
/// Sends a simple npc text update to the character
/// </summary>
/// <param name="character">recieving character</param>
/// <param name="id">id of text to update</param>
/// <param name="title">gossip window's title</param>
/// <param name="text">gossip window's text</param>
public static void SendNPCTextUpdateSimple(Character character, uint id, string title, string text)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_NPC_TEXT_UPDATE))
{
packet.Write(id);
packet.WriteFloat(1);
packet.WriteCString(title);
packet.WriteCString(text);
packet.Fill(0, 4 * 7);
for (var i = 1; i < 8; i++)
{
packet.WriteFloat(0);
packet.WriteByte(0);
packet.WriteByte(0);
packet.Fill(0, 4 * 7);
}
character.Client.Send(packet);
}
}
示例10: SendNPCTextUpdate
/// <summary>
/// Sends a npc text update to the character
/// </summary>
/// <param name="character">recieving character</param>
/// <param name="text">class holding all info about text</param>
public static void SendNPCTextUpdate(Character character, IGossipEntry text)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_NPC_TEXT_UPDATE))
{
packet.Write(text.GossipId);
var i = 0;
for (; i < text.GossipTexts.Length; i++)
{
var entry = text.GossipTexts[i];
packet.WriteFloat(entry.Probability);
var maleText = entry.GetTextMale(character.GossipConversation);
string femaleText;
if (text.IsDynamic)
{
// generated dynamically anyway
femaleText = maleText;
}
else
{
femaleText = entry.GetTextFemale(character.GossipConversation);
}
packet.WriteCString(maleText);
packet.WriteCString(femaleText);
packet.Write((uint)entry.Language);
for (int emoteIndex = 0; emoteIndex < 3; emoteIndex++)
{
// TODO: Emotes
//packet.Write((uint)entry.Emotes[emoteIndex]);
//packet.Write(entry.EmoteDelays[emoteIndex]);
packet.Write(0L);
}
}
for (; i < 8; i++)
{
packet.WriteFloat(0);
packet.WriteByte(0);
packet.WriteByte(0);
packet.Fill(0, 4 * 7);
}
character.Client.Send(packet);
}
}
示例11: CreateArenaTeamRosterResponsePacket
private static RealmPacketOut CreateArenaTeamRosterResponsePacket(ArenaTeam team)
{
var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ARENA_TEAM_ROSTER, 100);
packet.WriteUInt(team.Id);
packet.WriteByte(0);
packet.WriteUInt(team.MemberCount);
packet.WriteUInt(team.Type);
foreach (var member in team.Members.Values)
{
packet.WriteULong(member.Character.EntityId.Full);
var pl = World.GetCharacter(member.Character.EntityId.Low);
packet.WriteByte((pl != null) ? 1 : 0);
packet.WriteCString(member.Character.Name);
packet.WriteByte((team.Leader == member) ? 0 : 1);
packet.WriteByte((pl != null) ? pl.Level : 0);
packet.WriteUInt((uint)member.Class);
packet.WriteUInt(member.GamesWeek);
packet.WriteUInt(member.WinsWeek);
packet.WriteUInt(member.GamesSeason);
packet.WriteUInt(member.WinsSeason);
packet.WriteUInt(member.PersonalRating);
packet.WriteFloat(0.0f);
packet.WriteFloat(0.0f);
}
return packet;
}
示例12: SendPing
/// <summary>
/// Sends ping to the group, except pinger
/// </summary>
/// <param name="pinger">The group member who pingged the minimap</param>
/// <param name="x">x coordinate of ping</param>
/// <param name="y">y coordinate of ping</param>
public virtual void SendPing(GroupMember pinger, float x, float y)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_MINIMAP_PING))
{
packet.Write(EntityId.GetPlayerId(pinger.Id));
packet.WriteFloat(x);
packet.WriteFloat(y);
SendAll(packet, pinger);
}
}
示例13: SendItemQueryResponse
public static void SendItemQueryResponse(RealmClient client, ItemTemplate item)
{
using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_ITEM_QUERY_SINGLE_RESPONSE, 630))
{
packet.Write(item.Id);
packet.WriteInt((int)item.ItemClass);
packet.WriteInt((int)item.ItemSubClass);
packet.WriteInt(-1); // unknown
packet.WriteCString(item.Name);
packet.WriteByte(0);// name2
packet.WriteByte(0);// name3
packet.WriteByte(0);// name4
packet.WriteInt(item.DisplayId);
packet.WriteInt((int)item.Quality);
packet.WriteInt((int)item.Flags);
packet.WriteInt(item.BuyPrice);
packet.WriteInt(item.SellPrice);
packet.WriteInt((int)item.InventorySlot);
packet.WriteInt((int)item.RequiredClassMask);
packet.WriteInt((int)item.RequiredRaceMask);
packet.WriteInt(item.Level);
packet.WriteInt(item.RequiredLevel);
packet.WriteInt(item.RequiredSkill != null ? (int)item.RequiredSkill.Id : 0);
packet.WriteInt(item.RequiredSkillLevel);
packet.WriteInt(item.RequiredProfession != null ? (int)item.RequiredProfession.Id : 0);
packet.WriteInt(item.RequiredPvPRank);
packet.WriteInt(item.UnknownRank);// city rank?
packet.WriteInt(item.RequiredFaction != null ? (int)item.RequiredFaction.Id : 0);
packet.WriteInt((int)item.RequiredFactionStanding);
packet.WriteInt(item.UniqueCount);
packet.WriteInt(item.MaxAmount);
packet.WriteInt(item.ContainerSlots);
foreach (var stat in item.Mods)
{
packet.WriteUInt((uint)stat.Type);
packet.WriteInt(stat.Value);
}
foreach (var dmg in item.Damages)
{
packet.WriteFloat(dmg.Minimum);
packet.WriteFloat(dmg.Maximum);
packet.WriteUInt((uint)dmg.DamageSchool);
}
foreach (var res in item.Resistances)
{
packet.WriteUInt(res);
}
packet.WriteUInt(item.WeaponSpeed);
packet.WriteUInt((uint)item.ProjectileType);
packet.WriteFloat(item.RangeModifier);
for (int i = 0; i < 5; i++)
{
packet.WriteUInt(item.Spells[i].Id);
packet.WriteUInt((int)item.Spells[i].Trigger);
packet.WriteUInt(item.Spells[i].Charges);
packet.WriteInt(item.Spells[i].Cooldown);
packet.WriteUInt(item.Spells[i].CategoryId);
packet.WriteInt(item.Spells[i].CategoryCooldown);
}
packet.WriteUInt((int)item.BondType);
packet.WriteCString(item.Description);
packet.Write(item.PageTextId);
packet.Write(item.PageCount);
packet.Write(item.PageMaterial);
packet.Write(item.QuestId);
packet.Write(item.RequiredLockpickSkill);
packet.Write(item.Material);
packet.Write((uint)item.SheathType);
packet.Write(item.RandomPropertyId);
packet.Write(item.RandomSuffixId);
packet.Write(item.BlockValue);
packet.Write(item.SetId);
packet.Write(item.MaxDurability);
packet.Write((uint)item.ZoneId);
packet.Write((uint)item.MapId);
packet.Write((uint)item.BagFamily);
packet.Write(item.TotemCategory);
for (int i = 0; i < ItemTemplate.MaxSocketCount; i++)
{
packet.WriteInt(item.Sockets[i].SocketColor);
packet.WriteInt(item.Sockets[i].Unknown);
}
packet.WriteInt(item.SocketBonusId);
packet.WriteInt(item.GemProperties);
packet.WriteInt(item.ExtendedCost);
packet.WriteInt(item.RequiredArenaRanking);
packet.WriteInt(item.RequiredDisenchantingLevel);
packet.WriteFloat(item.ArmorModifier);
client.Send(packet);
}
//.........这里部分代码省略.........
示例14: SendItemQueryResponse
public static void SendItemQueryResponse(IRealmClient client, ItemTemplate item)
{
var locale = client.Info.Locale;
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ITEM_QUERY_SINGLE_RESPONSE, 630))
{
packet.Write(item.Id);
packet.Write((uint)item.Class);
packet.Write((uint)item.SubClass);
packet.Write(item.Unk0); // unknown
packet.WriteCString(item.Names.Localize(locale));
packet.Write((byte)0);// name2
packet.Write((byte)0);// name3
packet.Write((byte)0);// name4
packet.Write(item.DisplayId);
packet.Write((uint)item.Quality);
packet.Write((uint)item.Flags);
packet.Write((uint)item.Flags2); // new 3.2.0
packet.Write(item.BuyPrice);
packet.Write(item.SellPrice);
packet.Write((uint)item.InventorySlotType);
packet.Write((uint)item.RequiredClassMask);
packet.Write((uint)item.RequiredRaceMask);
packet.Write(item.Level);
packet.Write(item.RequiredLevel);
packet.Write(item.RequiredSkill != null ? (int)item.RequiredSkill.Id : 0);
packet.Write(item.RequiredSkillValue);
packet.Write(item.RequiredProfession != null ? item.RequiredProfession.Id : 0);
packet.Write(item.RequiredPvPRank);
packet.Write(item.UnknownRank);// PVP Medal
packet.Write(item.RequiredFaction != null ? (int)item.RequiredFaction.Id : 0);
packet.Write((uint)item.RequiredFactionStanding);
packet.Write(item.UniqueCount);
packet.Write(item.MaxAmount);
packet.Write(item.ContainerSlots);
packet.Write(item.Mods.Length);
for (var m = 0; m < item.Mods.Length; m++)
{
packet.Write((uint)item.Mods[m].Type);
packet.Write(item.Mods[m].Value);
}
packet.Write(item.ScalingStatDistributionId);// NEW 3.0.2 ScalingStatDistribution.dbc
packet.Write(item.ScalingStatValueFlags);// NEW 3.0.2 ScalingStatFlags
// In 3.1 there are only 2 damages instead of 5
for (var i = 0; i < ItemConstants.MaxDmgCount; i++)
{
if(i >= item.Damages.Length)
{
packet.WriteFloat(0f);
packet.WriteFloat(0f);
packet.WriteUInt(0u);
continue;
}
var dmg = item.Damages[i];
packet.Write(dmg.Minimum);
packet.Write(dmg.Maximum);
packet.Write((uint)dmg.School);
}
for (var i = 0; i < ItemConstants.MaxResCount; i++)
{
var res = item.Resistances[i];
packet.Write(res);
}
packet.Write(item.AttackTime);
packet.Write((uint)item.ProjectileType);
packet.Write(item.RangeModifier);
for (var s = 0; s < ItemConstants.MaxSpellCount; s++)
{
ItemSpell spell;
if(s < item.Spells.Length && (spell = item.Spells[s]) != null)
{
packet.Write((uint)spell.Id);
packet.Write((uint)spell.Trigger);
packet.Write((uint)Math.Abs(spell.Charges));
packet.Write(spell.Cooldown);
packet.Write(spell.CategoryId);
packet.Write(spell.CategoryCooldown);
}
else
{
packet.WriteUInt(0u);
packet.WriteUInt(0u);
packet.WriteUInt(0u);
packet.Write(-1);
packet.WriteUInt(0u);
packet.Write(-1);
}
}
packet.Write((uint)item.BondType);
packet.WriteCString(item.Descriptions.Localize(locale));
//.........这里部分代码省略.........
示例15: SendMeleeDamage
/// <param name="swingFlag">usually 1</param>
/// <returns>The actual damage (all resistances subtracted)</returns>
public static uint SendMeleeDamage(WorldObject attacker, WorldObject target, DamageType type, HitInfo hitInfo,
uint totalAmount, uint absorbed, uint resisted, uint blocked, VictimState victimState)
{
uint amount = totalAmount - blocked - absorbed - resisted;
using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_ATTACKERSTATEUPDATE, 70)) {
packet.WriteUInt((uint)hitInfo);
attacker.EntityId.WritePacked(packet);
target.EntityId.WritePacked(packet);
packet.WriteUInt(totalAmount);
packet.WriteByte(1);
packet.WriteByte((uint)type);
packet.WriteFloat(amount);
packet.WriteUInt(amount);
packet.WriteUInt(absorbed);
packet.WriteUInt(resisted);
packet.WriteUInt((uint)victimState);
packet.Write(absorbed == 0 ? 0 : -1);
packet.WriteUInt(0);
packet.WriteUInt(blocked);
target.PushPacketToSurroundingArea(packet, true, false);
}
return amount;
}