本文整理汇总了C#中RealmPacketOut.Fill方法的典型用法代码示例。如果您正苦于以下问题:C# RealmPacketOut.Fill方法的具体用法?C# RealmPacketOut.Fill怎么用?C# RealmPacketOut.Fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RealmPacketOut
的用法示例。
在下文中一共展示了RealmPacketOut.Fill方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: SendEmptyUpdate
/// <summary>
/// Send Empty Group List
/// </summary>
protected virtual void SendEmptyUpdate(Character chr)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GROUP_LIST))
{
//packet.ContentLength = 24;
packet.Fill(0, 24);
chr.Client.Send(packet);
}
}
示例4: CreateGuildQueryResponsePacket
private static RealmPacketOut CreateGuildQueryResponsePacket(Guild guild)
{
var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GUILD_QUERY_RESPONSE);
packet.WriteUInt((byte)guild.Id);
packet.WriteCString(guild.Name);
var guildRanks = guild.Ranks;
if (guildRanks.Length >= GuildMgr.MAX_GUILD_RANKS)
return null;
for (int i = 0; i < guildRanks.Length; i++)
{
packet.WriteCString(guildRanks[i].Name);
}
packet.Fill(0, GuildMgr.MAX_GUILD_RANKS - guildRanks.Length);
packet.Write(guild.Tabard.EmblemStyle);
packet.Write(guild.Tabard.EmblemColor);
packet.Write(guild.Tabard.BorderStyle);
packet.Write(guild.Tabard.BorderColor);
packet.Write(guild.Tabard.BackgroundColor);
packet.Write(0); // NEW 3.0.2
return packet;
}
示例5: 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);
}
}