Example #1
0
        /// <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 (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_NPC_TEXT_UPDATE))
            {
                packet.Write(text.GossipId);
                int index1;
                for (index1 = 0; index1 < text.GossipTexts.Length; ++index1)
                {
                    GossipTextBase gossipText = text.GossipTexts[index1];
                    packet.WriteFloat(gossipText.Probability);
                    string textMale = gossipText.GetTextMale(character.GossipConversation);
                    string str      = !text.IsDynamic ? gossipText.GetTextFemale(character.GossipConversation) : textMale;
                    packet.WriteCString(textMale);
                    packet.WriteCString(str);
                    packet.Write((uint)gossipText.Language);
                    for (int index2 = 0; index2 < 3; ++index2)
                    {
                        packet.Write(0L);
                    }
                }

                for (; index1 < 8; ++index1)
                {
                    packet.WriteFloat(0);
                    packet.WriteByte(0);
                    packet.WriteByte(0);
                    packet.Fill((byte)0, 28);
                }

                character.Client.Send(packet, false);
            }
        }
Example #2
0
 /// <summary>Send Empty Group List</summary>
 protected virtual void SendEmptyUpdate(Character chr)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_GROUP_LIST))
     {
         packet.Fill(0, 24);
         chr.Client.Send(packet, false);
     }
 }
Example #3
0
        /// <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);
            }
        }
Example #4
0
        /// <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 (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_NPC_TEXT_UPDATE))
            {
                packet.Write(id);
                packet.WriteFloat(1);
                packet.WriteCString(title);
                packet.WriteCString(text);
                packet.Fill((byte)0, 28);
                for (int index = 1; index < 8; ++index)
                {
                    packet.WriteFloat(0);
                    packet.WriteByte(0);
                    packet.WriteByte(0);
                    packet.Fill((byte)0, 28);
                }

                character.Client.Send(packet, false);
            }
        }
Example #5
0
        /// <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, addEnd: false);
            }
        }
Example #6
0
        /// <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, addEnd: false);
            }
        }
Example #7
0
		/// <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);
			}
		}
Example #8
0
		/// <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);
			}
		}
Example #9
0
		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;
		}
Example #10
0
		/// <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);
			}
		}
Example #11
0
		/// <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);
			}
		}