本文整理汇总了C#中ChatLanguage类的典型用法代码示例。如果您正苦于以下问题:C# ChatLanguage类的具体用法?C# ChatLanguage怎么用?C# ChatLanguage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChatLanguage类属于命名空间,在下文中一共展示了ChatLanguage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DynamicGossipEntry
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);
}
}
示例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: ChatNotify
/// <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);
}
}
示例4: SendMonsterMessage
/// <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);
}
}
示例5: 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;
}
示例6: CreateObjectChatMessage
/// <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;
}
示例7: AFKParser
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 : "");
}
}
示例8: WhisperParser
/// <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);
}
}
}
示例9: DynamicGossipText
public DynamicGossipText(GossipStringFactory stringGetter, float probability = 1f, ChatLanguage lang = ChatLanguage.Universal)
: base(probability, lang)
{
StringGetter = stringGetter;
}
示例10: StaticGossipText
public StaticGossipText(string text, float probability, ChatLanguage lang = ChatLanguage.Universal) :
base(probability, lang)
{
TextMale = TextFemale = text;
}
示例11: StaticGossipEntry
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();
}
示例12: LanguageDescription
public LanguageDescription(ChatLanguage lang, SpellId spell, SkillId skill)
{
Language = lang;
SpellId = spell;
SkillId = skill;
}
示例13: GetLanguageDescByType
/// <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);
}
示例14: GossipText
public GossipText(string text, float probability, ChatLanguage lang)
{
TextMale = TextFemale = text;
Probability = probability;
Language = lang;
}
示例15: SubGroupParser
/// <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);
}
}
}