public DynamicGossipEntry(uint id, ChatLanguage lang, params GossipStringFactory[] texts) { GossipId = id; GossipTexts = new DynamicGossipText[texts.Length]; var chance = 1f / texts.Length; for (var i = 0; i < texts.Length; i++) { GossipTexts[i] = new DynamicGossipText(texts[i], chance, lang); } }
/// <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; }
} //null terminated string message /// <inheritdoc /> public DefaultPlayerChatMessage(ChatMessageType messageType, ChatLanguage language, [NotNull] string message) : base(messageType, language) { if (message == null) { throw new ArgumentNullException(nameof(message)); } Message = message; }
/// <summary> /// Parses any incoming party or raid messages. /// </summary> /// <param name="sender">The character sending the message</param> /// <param name="type">the type of chat message indicated by the client</param> /// <param name="language">the chat language indicated by the client</param> /// <param name="packet">the actual chat message packet</param> private static void GroupParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet) { var msg = ReadMessage(packet); if (msg.Length == 0) { return; } SayGroup(sender, language, msg); }
/// <summary> /// Parses any incoming say, yell, or emote messages. /// </summary> /// <param name="type">the type of chat message indicated by the client</param> /// <param name="language">the chat language indicated by the client</param> /// <param name="packet">the actual chat message packet</param> private static void SayYellEmoteParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet) { var msg = ReadMessage(packet); if (msg.Length == 0) { return; } SayYellEmote(sender, type, language, msg, type == ChatMsgType.Yell ? YellRadius : ListeningRadius); }
public DynamicGossipEntry(uint id, ChatLanguage lang, params GossipStringFactory[] texts) { this.GossipId = id; this.GossipTexts = (GossipTextBase[])new DynamicGossipText[texts.Length]; float probability = 1f / (float)texts.Length; for (int index = 0; index < texts.Length; ++index) { this.GossipTexts[index] = (GossipTextBase) new DynamicGossipText(texts[index], probability, lang); } }
/// <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> /// Creates a chat message packet for a non-player object. /// </summary> /// <param name="type">the type of chat message</param> /// <param name="language">the language the message is in</param> /// <param name="obj">the object "saying" the message</param> /// <param name="msg">the message itself</param> /// <param name="tag">any chat tags for the object</param> /// <returns>the generated chat packet</returns> private static RealmPacketOut CreateObjectChatMessage(ChatMsgType type, ChatLanguage language, INamedEntity obj, string msg, ChatTag tag) { var packet = CreateObjectChatMessage(type, language, obj); //packet.Write(obj.EntityId); packet.WriteUIntPascalString(msg); // 30 + nameLength + msg.Length packet.Write((byte)tag); // 31 + ... return(packet); }
/// <summary> /// Sends a monster message. /// </summary> /// <param name="obj">the monster the message is being sent from</param> /// <param name="chatType">the type of message</param> /// <param name="language">the language to send the message in</param> /// <param name="message">the message to send</param> /// <param name="radius">The radius or -1 to be heard by everyone in the Map</param> public static void SendMonsterMessage(WorldObject obj, ChatMsgType chatType, ChatLanguage language, string message, float radius) { if (obj == null || !obj.IsAreaActive) { return; } using (var packetOut = CreateObjectChatMessage(chatType, language, obj, message, obj is Unit ? ((Unit)obj).ChatTag : ChatTag.None)) { obj.SendPacketToArea(packetOut, radius, true); } }
public StaticGossipEntry(uint id, ChatLanguage lang, params string[] texts) { GossipId = id; GossipTexts = new StaticGossipText[texts.Length]; var chance = 1f / texts.Length; for (var i = 0; i < texts.Length; i++) { var text = texts[i]; GossipTexts[i] = new StaticGossipText(text, chance, lang); } FinalizeDataHolder(); }
/// <summary> /// Check if a Character forgave an Ambusher /// </summary> static void CheckAmbusherRelease(IChatter chatter, string message, ChatLanguage lang, ChatMsgType chatType, IGenericChatTarget target) { if (chatter is Character) // make sures its a Character (could also be a broadcast or an IRC bot etc) { var chr = (Character)chatter; var selected = chr.Target as NPC; if (selected != null && selected.FactionId == FactionId.Friendly && // Ambusher is frienddly selected.FirstAttacker == chr && // Ambusher was tagged by Chr selected.Entry.NPCId == NPCId.WitchwingAmbusher && // Chr selected the ambusher (chatType == ChatMsgType.Say || chatType == ChatMsgType.Yell) && // Chr speaks out loud message == "I forgive thee!") // Chr says the right words { if (!selected.IsInFrontOf(chr)) { // the char was not talking towards the ambusher selected.Say("What? I couldn't hear you!"); } else { // The Killer has forgiven the Ambusher // Standup selected.StandState = StandState.Stand; // delay (because standing up takes time) selected.CallDelayed(800, obj => { if (selected.IsInWorld) // ensure that Chr and selected didn't disappear in the meantime { if (chr.IsInWorld) { selected.Yell("Thank you so much! - Now I can leave this place."); } selected.Emote(EmoteType.SimpleApplaud); selected.CallDelayed(1000, obj2 => { if (selected.IsInWorld) { // Finally die selected.Kill(); } }); } }); } } } }
public StaticGossipEntry(uint id, ChatLanguage lang, params string[] texts) { GossipId = id; GossipTexts = new StaticGossipText[texts.Length]; float probability = 1f / texts.Length; for (int index = 0; index < texts.Length; ++index) { string text = texts[index]; GossipTexts[index] = new StaticGossipText(text, probability, lang); } FinalizeDataHolder(); }
public StaticGossipEntry(uint id, ChatLanguage lang, params string[] texts) { this.GossipId = id; this.GossipTexts = (GossipTextBase[])new StaticGossipText[texts.Length]; float probability = 1f / (float)texts.Length; for (int index = 0; index < texts.Length; ++index) { string text = texts[index]; this.GossipTexts[index] = (GossipTextBase) new StaticGossipText(text, probability, lang); } this.FinalizeDataHolder(); }
public Task ReceiveWhisper(ObjectID senderId, string message, ChatLanguage language) { var chatResponse = new ChatMessageResponse() { // TODO: language support needed here Language = ChatLanguage.Universal, Message = message, MessageType = ChatMessageType.Whisper, SenderId = senderId, Tag = ChatTag.None, TargetId = State.Id, }; return(Send(chatResponse)); }
protected PlayerChatMessage(ChatMessageType messageType, ChatLanguage language) { if (!Enum.IsDefined(typeof(ChatMessageType), messageType)) { throw new ArgumentOutOfRangeException(nameof(messageType), "Value should be defined in the ChatMessageType enum."); } if (!Enum.IsDefined(typeof(ChatLanguage), language)) { throw new ArgumentOutOfRangeException(nameof(language), "Value should be defined in the ChatLanguage enum."); } _messageType = (uint)messageType; Language = language; }
} //null terminated string message /// <inheritdoc /> public WhisperPlayerChatMessage(ChatLanguage language, [NotNull] string message, [NotNull] string target) : base(ChatMessageType.CHAT_MSG_WHISPER, language) { if (target == null) { throw new ArgumentNullException(nameof(target)); } if (message == null) { throw new ArgumentNullException(nameof(message)); } Target = target; Message = message; }
} //null terminated string message /// <inheritdoc /> public ChannelPlayerChatMessage(ChatLanguage language, [NotNull] string message, [NotNull] string channelName) : base(ChatMessageType.CHAT_MSG_CHANNEL, language) { if (channelName == null) { throw new ArgumentNullException(nameof(channelName)); } if (message == null) { throw new ArgumentNullException(nameof(message)); } ChannelName = channelName; Message = message; }
public override void HandleYell(ObjectEntity objectEntity, string message, ChatLanguage language) { base.HandleYell(objectEntity, message, language); var chatResponse = new ChatMessageResponse() { Language = language, Message = message, MessageType = ChatMessageType.Yell, SenderId = objectEntity.Id, Tag = ChatTag.None, TargetId = State.Id, }; Send(chatResponse).Wait(); }
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 void SayGroup(this Character sender, ChatLanguage language, string msg) { if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character)) { return; } var group = sender.Group; if (group != null) { using (var packetOut = CreateCharChatMessage(ChatMsgType.Party, ChatLanguage.Universal, sender, sender, null, msg, sender.ChatTag)) { group.SendAll(packetOut); } } }
/// <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> /// Parses any incoming channel messages. /// </summary> /// <param name="type">the type of chat message indicated by the client</param> /// <param name="language">the chat language indicated by the client</param> /// <param name="packet">the actual chat message packet</param> private static void ChannelParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet) { var channel = packet.ReadCString(); var message = packet.ReadCString(); if (RealmCommandHandler.HandleCommand(sender, message, sender.Target as Character)) { return; } var chan = ChatChannelGroup.RetrieveChannel(sender, channel); if (chan == null) { return; } chan.SendMessage(sender, message); }
private static void AFKParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet) { var reason = packet.ReadCString(); if (type == ChatMsgType.AFK) { // flip their AFK flag sender.IsAFK = !sender.IsAFK; sender.AFKReason = (sender.IsAFK ? reason : ""); } if (type == ChatMsgType.DND) { // flip their DND flag sender.IsDND = !sender.IsDND; sender.DNDReason = (sender.IsDND ? reason : ""); } }
/// <summary> /// Parses any incoming officer message. /// </summary> /// <param name="sender">The character sending the message</param> /// <param name="type">the type of chat message indicated by the client</param> /// <param name="language">the chat language indicated by the client</param> /// <param name="packet">the actual chat message packet</param> private static void OfficerParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet) { string msg = ReadMessage(packet); if (msg.Length == 0) { return; } if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character)) { return; } /*var guild = Guild.CheckPrivs(sender, GuildCommandId.MEMBER, GuildPrivileges.GCHATSPEAK); * if (guild != null) * { * SendGuildOfficerMessage(sender, guild, msg); * }*/ }
/// <summary> /// Parses any incoming party or raid messages. /// </summary> /// <param name="sender">The character sending the message</param> /// <param name="type">the type of chat message indicated by the client</param> /// <param name="language">the chat language indicated by the client</param> /// <param name="packet">the actual chat message packet</param> private static void SubGroupParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet) { string msg = ReadMessage(packet); if (msg.Length == 0) { return; } if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character)) { return; } var group = sender.SubGroup; if (group != null) { using (var packetOut = CreateCharChatMessage(type, ChatLanguage.Universal, sender, sender, null, msg)) { group.Send(packetOut, null); } } }
public static void SayYellEmote(this Character sender, ChatMsgType type, ChatLanguage language, string msg, float radius) { if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character)) return; if (type != ChatMsgType.WhisperInform && msg.Length == 0) { return; } if (GlobalChat) { using (var packetOut = CreateCharChatMessage(type, language, sender.EntityId, sender.EntityId, null, msg, sender.ChatTag)) { foreach (var chr in World.GetAllCharacters()) { chr.Send(packetOut); } } } else { var faction = sender.FactionGroup; RealmPacketOut pckt = null, scrambledPckt = null; var scrambleDefault = ScrambleChat && sender.Role.ScrambleChat; Func<WorldObject, bool> iterator = obj => { if ((obj is Character)) { var chr = (Character)obj; if (!scrambleDefault || chr.FactionGroup == faction || !chr.Role.ScrambleChat) { if (pckt == null) { pckt = CreateCharChatMessage(type, language, sender.EntityId, sender.EntityId, null, msg, sender.ChatTag); } chr.Send(pckt); } else { if (scrambledPckt == null) { scrambledPckt = CreateCharChatMessage(type, language, sender.EntityId, sender.EntityId, null, ScrambleMessage(msg), sender.ChatTag); } chr.Send(scrambledPckt); } } return true; }; if (radius == WorldObject.BroadcastRange) { sender.NearbyObjects.Iterate(iterator); } else { sender.IterateEnvironment(radius, iterator); } if (pckt != null) { pckt.Close(); } if (scrambledPckt != null) { scrambledPckt.Close(); } } }
/// <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; }
public LanguageDescription(ChatLanguage lang, SpellId spell, SkillId skill) { Language = lang; SpellId = spell; SkillId = skill; }
/// <summary> /// Creates a chat message packet for a non-player object. /// </summary> /// <param name="type">the type of chat message</param> /// <param name="language">the language the message is in</param> /// <param name="obj">the object "saying" the message</param> /// <param name="msg">the message itself</param> /// <param name="tag">any chat tags for the object</param> /// <returns>the generated chat packet</returns> private static RealmPacketOut CreateObjectChatMessage(ChatMsgType type, ChatLanguage language, INamedEntity obj, string msg, ChatTag tag) { var packet = CreateObjectChatMessage(type, language, obj); //packet.Write(obj.EntityId); packet.WriteUIntPascalString(msg); // 30 + nameLength + msg.Length packet.Write((byte)tag); // 31 + ... return packet; }
/// <summary> /// Parses any incoming party or raid messages. /// </summary> /// <param name="sender">The character sending the message</param> /// <param name="type">the type of chat message indicated by the client</param> /// <param name="language">the chat language indicated by the client</param> /// <param name="packet">the actual chat message packet</param> private static void SubGroupParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet) { string msg = ReadMessage(packet); if (msg.Length == 0) return; if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character)) return; var group = sender.SubGroup; if (group != null) { using (var packetOut = CreateCharChatMessage(type, ChatLanguage.Universal, sender, sender, null, msg)) { group.Send(packetOut, null); } } }
/// <summary> /// Parses any incoming whispers. /// </summary> /// <param name="type">the type of chat message indicated by the client</param> /// <param name="language">the chat language indicated by the client</param> /// <param name="packet">the actual chat message packet</param> private static void WhisperParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet) { var recipient = packet.ReadCString(); var msg = ReadMessage(packet); if (msg.Length == 0) return; if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character)) return; var targetChr = World.GetCharacter(recipient, false); if (targetChr == null) { SendChatPlayerNotFoundReply(sender.Client, recipient); return; } if (targetChr.Faction.Group != sender.Faction.Group) { SendChatPlayerWrongTeamReply(sender.Client); return; } if (targetChr.IsIgnoring(sender)) { using (var packetOut = CreateCharChatMessage(ChatMsgType.Ignored, ChatLanguage.Universal, targetChr, sender, null, msg)) { sender.Send(packetOut); } } else { using (var packetOut = CreateCharChatMessage(ChatMsgType.Whisper, ChatLanguage.Universal, sender, targetChr, null, msg)) { targetChr.Send(packetOut); } } using (var packetOut = CreateCharChatMessage(ChatMsgType.MsgReply, ChatLanguage.Universal, targetChr, targetChr, null, msg, sender.ChatTag)) { sender.Send(packetOut); } // handle afk/dnd situations if (targetChr.IsAFK) { using (var packetOut = CreateCharChatMessage(ChatMsgType.AFK, ChatLanguage.Universal, targetChr, sender, null, targetChr.AFKReason, targetChr.ChatTag)) { sender.Send(packetOut); } } if (targetChr.IsDND) { using (var packetOut = CreateCharChatMessage(ChatMsgType.DND, ChatLanguage.Universal, targetChr, sender, null, string.Empty, targetChr.ChatTag)) { sender.Send(packetOut); } } }
public DynamicGossipText(GossipStringFactory stringGetter, float probability = 1f, ChatLanguage lang = ChatLanguage.Universal) : base(probability, lang) { StringGetter = stringGetter; }
protected GossipTextBase(float probability, ChatLanguage lang = ChatLanguage.Universal) { Probability = probability; Language = lang; }
/// <summary> /// Triggers a chat notification event. /// </summary> /// <param name="chatter">the person chatting</param> /// <param name="message">the chat message</param> /// <param name="language">the chat language</param> /// <param name="chatType">the type of chat</param> /// <param name="target">the target of the message (channel, whisper, etc)</param> public static void ChatNotify(IChatter chatter, string message, ChatLanguage language, ChatMsgType chatType, IGenericChatTarget target) { var chatNotify = MessageSent; if (chatNotify != null) { chatNotify(chatter, message, language, chatType, target); } }
public GossipText(string text, float probability, ChatLanguage lang) { TextMale = TextFemale = text; Probability = probability; Language = lang; }
/// <summary> /// Sends a monster message. /// </summary> /// <param name="obj">the monster the message is being sent from</param> /// <param name="chatType">the type of message</param> /// <param name="language">the language to send the message in</param> /// <param name="message">the message to send</param> /// <param name="radius">The radius or -1 to be heard by everyone in the Map</param> public static void SendMonsterMessage(WorldObject obj, ChatMsgType chatType, ChatLanguage language, string message, float radius) { if (obj == null || !obj.IsAreaActive) return; using (var packetOut = CreateObjectChatMessage(chatType, language, obj, message, obj is Unit ? ((Unit)obj).ChatTag : ChatTag.None)) { obj.SendPacketToArea(packetOut, radius, true); } }
public void SendMessage(IChatter sender, ChatLanguage language, string message) { throw new NotImplementedException(); }
/// <summary> /// Get language description by Type /// </summary> /// <param name="language">the Language type</param> /// <returns></returns> public static LanguageDescription GetLanguageDescByType(ChatLanguage language) { return ByLang.Get((uint)language); }
/// <summary> /// Parses any incoming party or raid messages. /// </summary> /// <param name="sender">The character sending the message</param> /// <param name="type">the type of chat message indicated by the client</param> /// <param name="language">the chat language indicated by the client</param> /// <param name="packet">the actual chat message packet</param> private static void GroupParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet) { var msg = ReadMessage(packet); if (msg.Length == 0) return; SayGroup(sender, language, msg); }
public static void SayGroup(this Character sender, ChatLanguage language, string msg) { if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character)) return; var group = sender.Group; if (group != null) using (var packetOut = CreateCharChatMessage(ChatMsgType.Party, ChatLanguage.Universal, sender, sender, null, msg, sender.ChatTag)) { group.SendAll(packetOut); } }
/// <summary> /// Adds the given language /// </summary> public void AddLanguage(ChatLanguage lang) { var desc = LanguageHandler.GetLanguageDescByType(lang); AddLanguage(desc); }
/// <summary> /// Parses any incoming officer message. /// </summary> /// <param name="sender">The character sending the message</param> /// <param name="type">the type of chat message indicated by the client</param> /// <param name="language">the chat language indicated by the client</param> /// <param name="packet">the actual chat message packet</param> private static void OfficerParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet) { string msg = ReadMessage(packet); if (msg.Length == 0) return; if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character)) return; var guild = Guild.CheckPrivs(sender, GuildCommandId.MEMBER, GuildPrivileges.GCHATSPEAK); if (guild != null) { SendGuildOfficerMessage(sender, guild, msg); } }
/// <summary> /// Returns whether the given language can be understood by this Character /// </summary> public bool CanSpeak(ChatLanguage language) { return KnownLanguages.Contains(language); }
/// <summary> /// Parses any incoming channel messages. /// </summary> /// <param name="type">the type of chat message indicated by the client</param> /// <param name="language">the chat language indicated by the client</param> /// <param name="packet">the actual chat message packet</param> private static void ChannelParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet) { var channel = packet.ReadCString(); var message = packet.ReadCString(); if (RealmCommandHandler.HandleCommand(sender, message, sender.Target as Character)) return; var chan = ChatChannelGroup.RetrieveChannel(sender, channel); if (chan == null) return; chan.SendMessage(sender, message); }
/// <summary>Get language description by Type</summary> /// <param name="language">the Language type</param> /// <returns></returns> public static LanguageDescription GetLanguageDescByType(ChatLanguage language) { return(ByLang.Get((uint)language)); }
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 DynamicGossipText(GossipStringFactory stringGetter, float probability = 1f, ChatLanguage lang = ChatLanguage.Universal) : base(probability, lang) { this.StringGetter = stringGetter; }
/// <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> private static RealmPacketOut CreateCharChatMessage(ChatMsgType type, ChatLanguage language, IChatter id1, IChatter id2, string target, string msg) { return CreateCharChatMessage(type, language, id1.EntityId, id2.EntityId, target, msg, id1.ChatTag); }
/// <summary> /// Parses any incoming say, yell, or emote messages. /// </summary> /// <param name="type">the type of chat message indicated by the client</param> /// <param name="language">the chat language indicated by the client</param> /// <param name="packet">the actual chat message packet</param> private static void SayYellEmoteParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet) { var msg = ReadMessage(packet); if (msg.Length == 0) return; SayYellEmote(sender, type, language, msg, type == ChatMsgType.Yell ? YellRadius : ListeningRadius); }
/// <summary> /// Sends a monster message. /// </summary> /// <param name="obj">the monster the message is being sent from</param> /// <param name="chatType">the type of message</param> /// <param name="language">the language to send the message in</param> /// <param name="message">the message to send</param> public static void SendMonsterMessage(WorldObject obj, ChatMsgType chatType, ChatLanguage language, string[] localizedMsgs) { SendMonsterMessage(obj, chatType, language, localizedMsgs, chatType == ChatMsgType.MonsterYell ? YellRadius : ListeningRadius); }
public static void SendMonsterMessage(WorldObject chatter, ChatMsgType chatType, ChatLanguage language, string[] localizedMsgs, float radius) { if (chatter == null || !chatter.IsAreaActive) return; using (var packet = CreateObjectChatMessage(chatType, language, chatter)) { chatter.IterateEnvironment(radius, obj => { if (obj is Character) { packet.WriteUIntPascalString(localizedMsgs.Localize(((Character)obj).Client.Info.Locale)); packet.Write((byte)(chatter is Unit ? ((Unit)chatter).ChatTag : ChatTag.None)); ((Character)obj).Send(packet.GetFinalizedPacket()); } return true; }); } }
public StaticGossipText(string text, float probability, ChatLanguage lang = ChatLanguage.Universal) : base(probability, lang) { TextMale = TextFemale = text; }