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); } }
/// <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); }
/// <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; }
/// <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); } }
/// <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); }
public static void SendTextEmote(WorldObject obj, TextEmote emote, INamed target) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_TEXT_EMOTE, target == null ? 20 : target.Name.Length + 21)) { packet.Write(obj.EntityId); packet.WriteUInt((uint)emote); packet.WriteInt(-1); packet.WriteUIntPascalString(target != null ? target.Name : ""); obj.SendPacketToArea(packet, true, false, Locale.Any, new float?()); } }
public static RealmPacketOut CreateAchievementEarnedToGuild(uint achievementEntryId, Character chr) { RealmPacketOut realmPacketOut = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT); realmPacketOut.WriteByte((byte)48); realmPacketOut.WriteUInt(0U); realmPacketOut.Write((ulong)chr.EntityId); realmPacketOut.WriteUInt(5); realmPacketOut.Write((ulong)chr.EntityId); realmPacketOut.WriteUIntPascalString("|Hplayer:$N|h[$N]|h has earned the achievement $a!"); realmPacketOut.WriteByte(0); realmPacketOut.WriteUInt(achievementEntryId); return(realmPacketOut); }
// 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); } }
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; }
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); }
public static RealmPacketOut CreateAchievementEarnedToGuild(uint 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(achievementEntryId); return(packet); }
public void SendMessage(string message) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT)) { packet.Write((byte)ChatMsgType.Channel); packet.Write((uint)ChatLanguage.Common); packet.Write(EntityId.Zero); packet.WriteCString(""); packet.Write(EntityId.Zero); packet.WriteUIntPascalString(message); packet.Write((byte)ChatTag.None); // chat tag ChannelHandler.SendPacketToChannel(this, packet); } ChatMgr.ChatNotify(null, message, ChatLanguage.Common, ChatMsgType.Channel, this); }
public void SendMessage(string message) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT)) { packet.Write((byte)17); packet.Write(7U); packet.Write((ulong)EntityId.Zero); packet.WriteCString(""); packet.Write((ulong)EntityId.Zero); packet.WriteUIntPascalString(message); packet.Write((byte)0); ChannelHandler.SendPacketToChannel(this, packet); } ChatMgr.ChatNotify((IChatter)null, message, ChatLanguage.Common, ChatMsgType.Channel, (IGenericChatTarget)this); }
/// <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); } }
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; }
/// <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; }