本文整理汇总了C#中RealmPacketOut.WriteUIntPascalString方法的典型用法代码示例。如果您正苦于以下问题:C# RealmPacketOut.WriteUIntPascalString方法的具体用法?C# RealmPacketOut.WriteUIntPascalString怎么用?C# RealmPacketOut.WriteUIntPascalString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RealmPacketOut
的用法示例。
在下文中一共展示了RealmPacketOut.WriteUIntPascalString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendAreaTriggerMessage
public static void SendAreaTriggerMessage(IPacketReceiver client, string msg)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_AREA_TRIGGER_MESSAGE, (msg.Length * 2) + 4))
{
packet.WriteUIntPascalString(msg);
packet.Write((byte)0);
client.Send(packet);
}
}
示例2: CreateChatPacket
/// <summary>
/// Creates a packet
/// </summary>
public static RealmPacketOut CreateChatPacket(ChatMsgType type, ChatLanguage language, string msg, ChatTag tag)
{
var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT, 23 + msg.Length);
packet.WriteByte((byte)type); // 1
packet.WriteUInt((uint)language); // 5
packet.WriteUIntPascalString(msg); // 22 + msg.Length
packet.WriteByte((byte)tag); // 23 + msg.Length
return packet;
}
示例3: SendTextEmote
// Client doesn't seem to be sending this
//[ClientPacketHandler(RealmServerOpCode.CMSG_EMOTE)]
//public static void HandleEmote(IRealmClient client, RealmPacketIn packet)
//{
// var emote = (EmoteType)packet.ReadUInt32();
// if (emote != EmoteType.None)
// {
// var chr = client.ActiveCharacter;
// if (chr.CanMove && chr.CanInteract)
// {
// SendEmote(chr, emote);
// }
// }
//}
public static void SendTextEmote(WorldObject obj, TextEmote emote, INamed target)
{
var len = (target == null) ? 20 : target.Name.Length + 21;
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_TEXT_EMOTE, len))
{
packet.Write(obj.EntityId);
packet.WriteUInt((uint)emote);
packet.WriteInt(-1);
packet.WriteUIntPascalString(target != null ? target.Name : "");
obj.SendPacketToArea(packet, true);
}
}
示例4: CreateAchievementEarnedToGuild
public static RealmPacketOut CreateAchievementEarnedToGuild(AchievementEntryId achievementEntryId, Character chr)
{
// Must be a better way to do this.
const string msg = "|Hplayer:$N|h[$N]|h has earned the achievement $a!";
var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT);
packet.WriteByte((byte) ChatMsgType.Achievment);
packet.WriteUInt((uint) ChatLanguage.Universal);
packet.Write(chr.EntityId);
packet.WriteUInt(5);
packet.Write(chr.EntityId);
packet.WriteUIntPascalString(msg);
packet.WriteByte(0);
packet.WriteUInt((uint) achievementEntryId);
return packet;
}
示例5: SendMessage
/// <summary>
/// Sends a message to this channel.
/// </summary>
/// <param name="sender">the chatter saying the message</param>
public void SendMessage(IChatter sender, string message)
{
ChannelMember mi;
if (!Members.TryGetValue(sender.EntityId.Low, out mi))
{
ChannelHandler.SendNotOnChannelReply(sender, m_name);
return;
}
if (mi.IsMuted)
{
ChannelHandler.SendMutedReply(sender, m_name);
return;
}
bool isMod = mi.IsModerator;
if (IsModerated && !isMod)
{
ChannelHandler.SendNotOnChannelReply(sender, m_name);
return;
}
if (sender is IUser)
{
if (RealmCommandHandler.HandleCommand((IUser)sender, message, this))
return;
}
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT))
{
packet.Write((byte)ChatMsgType.Channel);
packet.Write((uint)sender.SpokenLanguage);
packet.Write(sender.EntityId);
packet.Write(0); // unknown
packet.WriteCString(Name);
packet.Write(sender.EntityId);
packet.WriteUIntPascalString(message);
packet.Write((byte)sender.ChatTag); // chat tag
if (isMod)
{
ChannelHandler.SendPacketToChannel(this, packet);
}
else
{
ChannelHandler.SendPacketToChannel(this, packet, sender.EntityId);
}
ChatMgr.ChatNotify(sender, message, sender.SpokenLanguage, ChatMsgType.Channel, this);
}
}
示例6: CreateCharChatMessage
/// <summary>
/// Creates a chat message packet for a player.
/// </summary>
/// <param name="type">the type of chat message</param>
/// <param name="language">the language the message is in</param>
/// <param name="id1">the ID of the chatter</param>
/// <param name="id2">the ID of the receiver</param>
/// <param name="target">the target or null (if its an area message)</param>
/// <param name="msg">the message itself</param>
/// <param name="tag">the chat tag of the chatter</param>
/// <returns>Might return null</returns>
private static RealmPacketOut CreateCharChatMessage(ChatMsgType type, ChatLanguage language, EntityId id1, EntityId id2,
string target, string msg, ChatTag tag)
{
var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT);
packet.Write((byte)type);
packet.Write((uint)language);
packet.Write(id1);
packet.Write(0);
if (target != null)
packet.WriteUIntPascalString(target);
packet.Write(id2);
packet.WriteUIntPascalString(msg);
packet.Write((byte)tag);
return packet;
}
示例7: CreateObjectChatMessage
private static RealmPacketOut CreateObjectChatMessage(ChatMsgType type, ChatLanguage language, INamedEntity obj)
{
var name = obj.Name;
var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT, 31 + name.Length + 50);
packet.Write((byte)type); // 1
packet.Write((uint)language); // 5
packet.Write(obj.EntityId); // 13
packet.Write(0); // 17
packet.WriteUIntPascalString(name); // 21 + nameLength
packet.Write((long)0); // 29 + nameLength
//packet.Write(obj.EntityId);
return packet;
}