当前位置: 首页>>代码示例>>C#>>正文


C# RealmPacketOut.WriteCString方法代码示例

本文整理汇总了C#中RealmPacketOut.WriteCString方法的典型用法代码示例。如果您正苦于以下问题:C# RealmPacketOut.WriteCString方法的具体用法?C# RealmPacketOut.WriteCString怎么用?C# RealmPacketOut.WriteCString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RealmPacketOut的用法示例。


在下文中一共展示了RealmPacketOut.WriteCString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendResult

        /// <summary>
        /// Sends result of actions connected with arenas
        /// </summary>
        /// <param name="client">the client to send to</param>
        /// <param name="commandId">command executed</param>
        /// <param name="name">name of player event has happened to</param>
        /// <param name="resultCode">The <see cref="ArenaTeamResult"/> result code</param>
        public static void SendResult(IPacketReceiver client, ArenaTeamCommandId commandId, string team, string player,
                                      ArenaTeamResult resultCode)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ARENA_TEAM_COMMAND_RESULT))
            {
                packet.WriteUInt((uint)commandId);
                packet.WriteCString(team);
                packet.WriteCString(player);
                packet.WriteUInt((uint)resultCode);

                client.Send(packet);
            }
        }
开发者ID:enjoii,项目名称:WCell,代码行数:20,代码来源:ArenaTeamHandler.cs

示例2: SendItemNameQueryResponse

		public static void SendItemNameQueryResponse(IPacketReceiver client, ItemTemplate item)
		{
			using (var outPacket = new RealmPacketOut(RealmServerOpCode.SMSG_ITEM_NAME_QUERY_RESPONSE, 4 + item.DefaultName.Length))
			{
				outPacket.WriteInt(item.Id);
				outPacket.WriteCString(item.DefaultName);

				client.Send(outPacket);
			}
		}
开发者ID:Zerant,项目名称:WCell,代码行数:10,代码来源:ItemHandler.cs

示例3: SendWhoList

		/// <summary>
		/// Sends to the specified client the Who List based on the given characters
		/// </summary>
		/// <param name="client">The client to send the list</param>
		/// <param name="characters">The list of characters that matched the Who List search</param>
		public static void SendWhoList(IPacketReceiver client, ICollection<Character> characters)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_WHO))
			{
				packet.Write(characters.Count);
				packet.Write(characters.Count);

				foreach (Character character in characters)
				{
					packet.WriteCString(character.Name);
                    packet.WriteCString(character.Guild != null ? character.Guild.Name : string.Empty); //TODO: Add Guild name here
					packet.Write(character.Level);
					packet.WriteUInt((byte)character.Class);
					packet.WriteUInt((byte)character.Race);
					packet.WriteByte(0); //New in 2.4.x
					packet.Write(character.Zone != null ? (uint)character.Zone.Id : 0);
				}
				client.Send(packet);
			}
		}
开发者ID:pallmall,项目名称:WCell,代码行数:25,代码来源:WhoHandler.cs

示例4: SendServerFirstAchievement

 //SMSG_SERVER_FIRST_ACHIEVEMENT
 public static void SendServerFirstAchievement(AchievementEntryId achievementEntryId, Character chr)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SERVER_FIRST_ACHIEVEMENT, chr.Name.Length + 1 + 8 + 4 + 4))
     {
         packet.WriteCString(chr.Name);
         packet.Write(chr.EntityId);
         packet.WriteUInt((uint)achievementEntryId);
         packet.WriteUInt(0);
         World.Broadcast(packet);
     }
 }
开发者ID:NVN,项目名称:WCell,代码行数:12,代码来源:AchievementHandler.cs

示例5: SendRequest

        public void SendRequest(TestCharacter sender, uint minLevel, uint maxLevel, string playerName, 
			string guildName, RaceMask2 raceMask, ClassMask2 classMask, List<ZoneId> zones, List<string> names)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.CMSG_WHO))
            {
                packet.WriteUInt(minLevel);
                packet.WriteUInt(maxLevel);
                packet.WriteCString(playerName);
                packet.WriteCString(guildName);
                packet.WriteUInt((uint)raceMask);
                packet.WriteUInt((uint)classMask);

                packet.WriteUInt(zones.Count);
                foreach (ZoneId zone in zones)
                    packet.WriteUInt((uint)zone);

                packet.WriteUInt(names.Count);
                foreach (string name in names)
                    packet.WriteCString(name);

                sender.FakeClient.ReceiveCMSG(packet, true);
            }
        }
开发者ID:KroneckerX,项目名称:WCell,代码行数:23,代码来源:WhoListTest.cs

示例6: SendRealmStateResponse

		public static void SendRealmStateResponse(IPacketReceiver client, uint realmNo)
		{
			//uint realmSplitState = 0;
			// realmNo = 0;
			const RealmState realmState = RealmState.Normal;
			var splitDate = "01/01/01";
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_REALM_SPLIT, 8 + 1 + splitDate.Length))
			{
				packet.WriteUInt(realmNo);
				packet.WriteUInt((uint)realmState);
				packet.WriteCString(splitDate);

				client.Send(packet);
			}
		}
开发者ID:remixod,项目名称:netServer,代码行数:15,代码来源:MiscHandler.cs

示例7: CreateArenaTeamQueryResponsePacket

        private static RealmPacketOut CreateArenaTeamQueryResponsePacket(ArenaTeam team)
		{
			var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ARENA_TEAM_QUERY_RESPONSE, 4*7+team.Name.Length+1);

            packet.WriteUInt((byte)team.Id);
            packet.WriteCString(team.Name);
            packet.WriteUInt(team.Type);

            /* TO-DO : Implement Emblem
             * packet.WriteUInt(team.Emblem.backgroundColor);
            packet.WriteUInt(team.Emblem.emblemStyle);
            packet.WriteUInt(team.Emblem.emblemColor);
            packet.WriteUInt(team.Emblem.borderStyle);
            packet.WriteUInt(team.Emblem.borderColor);
             */

            return packet;
        }
开发者ID:KroneckerX,项目名称:WCell,代码行数:18,代码来源:ArenaTeamHandler.cs

示例8: SendChatPlayerNotFoundReply

		/// <summary>
		/// Sends a message that the whisper target wasn't found.
		/// </summary>
		/// <param name="client">the client to send to</param>
		/// <param name="recipient">the name of the target player</param>
		public static void SendChatPlayerNotFoundReply(IPacketReceiver client, string recipient)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_CHAT_PLAYER_NOT_FOUND))
			{
				packet.WriteCString(recipient);
				client.Send(packet);
			}
		}
开发者ID:remixod,项目名称:netServer,代码行数:13,代码来源:ChatMgr.cs

示例9: WriteTargets

		private static void WriteTargets(RealmPacketOut packet, SpellCast cast)
		{
			var flags = cast.TargetFlags;
			if (flags == 0 || flags == SpellTargetFlags.Self)
			{
				var spell = cast.Spell;
				if (cast.Selected is Unit && !spell.IsAreaSpell &&
					(spell.Visual != 0 || spell.IsWeaponAbility))
				{
					flags = SpellTargetFlags.Unit;
				}
			}
			packet.Write((uint)flags);
			if (flags.Has(
				SpellTargetFlags.SpellTargetFlag_Dynamic_0x10000 |
				SpellTargetFlags.Corpse |
				SpellTargetFlags.Object |
				SpellTargetFlags.PvPCorpse |
				SpellTargetFlags.Unit))
			{
				if (cast.Selected == null)
				{
#if DEBUG
					log.Warn("{0} casted Spell {1} with TargetFlags {2} but with nothing Selected",
						cast.Caster, cast.Spell, flags);
#endif
					packet.Write((byte)0);
				}
				else
				{
					cast.Selected.EntityId.WritePacked(packet);
				}
			}
			// 0x1010
			if (flags.Has(SpellTargetFlags.TradeItem | SpellTargetFlags.Item))
			{
				if (cast.UsedItem != null)
				{
					cast.UsedItem.EntityId.WritePacked(packet);
				}
			}
			// 0x20
			if (flags.Has(SpellTargetFlags.SourceLocation))
			{
				if (cast.Selected != null)
				{
					cast.Selected.EntityId.WritePacked(packet);
				}
				else
				{
					packet.Write((byte)0);
				}
				packet.Write(cast.SourceLoc.X);
				packet.Write(cast.SourceLoc.Y);
				packet.Write(cast.SourceLoc.Z);
			}
			// 0x40
			if (flags.Has(SpellTargetFlags.DestinationLocation))
			{
				if (cast.Selected != null)
				{
					cast.Selected.EntityId.WritePacked(packet);
				}
				else
				{
					packet.Write((byte)0);
				}
				packet.Write(cast.TargetLoc);
			}
			// 0x2000
			if (flags.Has(SpellTargetFlags.String))
			{
				packet.WriteCString(cast.StringTarget);
			}
		}
开发者ID:pallmall,项目名称:WCell,代码行数:75,代码来源:SpellHandler.cs

示例10: SendQuestList

        /// <summary>
        /// Sends the quest giver quest list.
        /// </summary>
        /// <param name="qHolder">The quest giver.</param>
        /// <param name="list">The list.</param>
        /// <param name="chr">The character.</param>
        public static void SendQuestList(IQuestHolder qHolder, List<QuestTemplate> list, Character chr)
        {
            using (var pkt = new RealmPacketOut(new PacketId(RealmServerOpCode.SMSG_QUESTGIVER_QUEST_LIST)))
            {
                pkt.Write(qHolder.EntityId);
                if (qHolder.QuestHolderInfo != null)
                {
                    pkt.Write("Stay a while and listen..."); // TODO need to change to dynamic text, character-dependant
                    pkt.Write((uint)0); // player emote
                    pkt.Write((uint)1); // npc emote

                    var amount = Math.Min(QuestConstants.MaxQuestsPerQuestGiver, list.Count);
                    pkt.Write((byte)amount);

                    foreach (var qt in list)
                    {
                        pkt.Write(qt.Id);
                        var quest = chr.QuestLog.GetActiveQuest(qt.Id);
                        if (quest != null)
                        {
                            if (quest.CompleteStatus == QuestCompleteStatus.Completed)
                            {
                                //status = (uint)qt.GetEndStatus(qHolder.QuestHolderInfo, chr);
                                pkt.Write(4);
                            }
                            else
                            {
                                pkt.Write((uint)QuestStatus.NotCompleted);
                            }
                        }
                        else
                        {
                            var status = (uint)qt.GetAvailability(chr);
                            pkt.Write(status);
                        }
                        pkt.WriteUInt(qt.Level);
                        pkt.WriteUInt((uint)qt.Flags);
                        pkt.Write((byte)0); // 3.3.3 question/exclamation mark
                        pkt.WriteCString(qt.DefaultTitle);
                    }
                    chr.Client.Send(pkt);
                }
            }
        }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:50,代码来源:QuestHandler.cs

示例11: SendDetails

        /// <summary>
        /// Sends the quest giver quest detail.
        /// </summary>
        /// <param name="questGiver">The qg.</param>
        /// <param name="qt">The quest id.</param>
        /// <param name="chr">The client.</param>
        /// <param name="acceptable">if set to <c>true</c> [acceptable].</param>
        public static void SendDetails(IEntity questGiver, QuestTemplate qt, Character chr, bool acceptable)
        {
            var locale = chr.Locale;
            using (var pckt = new RealmPacketOut(RealmServerOpCode.SMSG_QUESTGIVER_QUEST_DETAILS))
            {
                pckt.Write(questGiver != null ? questGiver.EntityId : EntityId.Zero);

                pckt.Write(EntityId.Zero);						// unknown, wotlk, quest sharing?

                pckt.Write(qt.Id);

                pckt.WriteCString(qt.Titles.Localize(locale));
                pckt.WriteCString(qt.Details.Localize(locale));
                pckt.WriteCString(qt.Instructions.Localize(locale));


                pckt.Write((byte)(acceptable ? 1 : 0));			// doesn't work
                pckt.WriteUInt((uint)qt.Flags);
                pckt.WriteUInt(qt.SuggestedPlayers);
                pckt.Write((byte)0); // probably some pvp flag
                if (qt.Flags.HasFlag(QuestFlags.HiddenRewards))
                {
                    pckt.WriteUInt(0u);		// choice items length
                    pckt.WriteUInt(0u);		// reward items length
                    pckt.WriteUInt(0u);		// money
                    pckt.WriteUInt(0u);		// xp
                }
                else
                {
                    pckt.Write(qt.RewardChoiceItems.Length);
                    for (uint i = 0; i < qt.RewardChoiceItems.Length; i++)
                    {
                        pckt.Write((uint)qt.RewardChoiceItems[i].ItemId);
                        pckt.Write(qt.RewardChoiceItems[i].Amount);
                        var template = qt.RewardChoiceItems[i].Template;
                        if (template != null)
                        {
                            pckt.Write(template.DisplayId);
                        }
                        else
                        {
                            pckt.Write(0);
                        }
                    }

                    pckt.Write(qt.RewardItems.Length);
                    for (uint i = 0; i < qt.RewardItems.Length; i++)
                    {
                        pckt.Write((uint)qt.RewardItems[i].ItemId);
                        pckt.Write(qt.RewardItems[i].Amount);

                        var template = qt.RewardItems[i].Template;
                        if (template != null)
                        {
                            pckt.Write(template.DisplayId);
                        }
                        else
                        {
                            pckt.Write(0);
                        }
                    }

                    if (chr.Level >= RealmServerConfiguration.MaxCharacterLevel)
                    {
                        pckt.Write(qt.MoneyAtMaxLevel);
                    }
                    else
                    {
                        pckt.Write(qt.RewMoney);
                    }

                    pckt.Write(qt.CalcRewardXp(chr));						// since 3.3
                }

                pckt.Write(qt.RewHonorAddition);
                pckt.Write(qt.RewHonorMultiplier);						// since 3.3
                if (qt.RewSpell > 0)
                {
                    pckt.Write((uint)qt.RewSpell);
                }
                else
                {
                    pckt.Write((uint)qt.RewSpellCast);
                }
                pckt.Write((uint)qt.CastSpell);
                pckt.Write((uint)qt.RewardTitleId);		// since 2.4.0
                pckt.Write(qt.RewardTalents);

                // #### since 3.3
                pckt.Write(0);						// bonus arena points
                pckt.Write(0);
                for (uint i = 0; i < QuestConstants.MaxReputations; ++i)
                {
//.........这里部分代码省略.........
开发者ID:ebakkedahl,项目名称:WCell,代码行数:101,代码来源:QuestHandler.cs

示例12: SendItemQueryResponse

        public static void SendItemQueryResponse(IRealmClient client, ItemTemplate item)
        {
            var locale = client.Info.Locale;
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ITEM_QUERY_SINGLE_RESPONSE, 630))
            {
                packet.Write(item.Id);
                packet.Write((uint)item.Class);
                packet.Write((uint)item.SubClass);
                packet.Write(item.Unk0); // unknown

                packet.WriteCString(item.Names.Localize(locale));
                packet.Write((byte)0);// name2
                packet.Write((byte)0);// name3
                packet.Write((byte)0);// name4

                packet.Write(item.DisplayId);
                packet.Write((uint)item.Quality);
                packet.Write((uint)item.Flags);
                packet.Write((uint)item.Flags2);		// new 3.2.0
                packet.Write(item.BuyPrice);
                packet.Write(item.SellPrice);
                packet.Write((uint)item.InventorySlotType);
                packet.Write((uint)item.RequiredClassMask);
                packet.Write((uint)item.RequiredRaceMask);
                packet.Write(item.Level);
                packet.Write(item.RequiredLevel);
                packet.Write(item.RequiredSkill != null ? (int)item.RequiredSkill.Id : 0);
                packet.Write(item.RequiredSkillValue);
                packet.Write(item.RequiredProfession != null ? item.RequiredProfession.Id : 0);
                packet.Write(item.RequiredPvPRank);
                packet.Write(item.UnknownRank);// PVP Medal
                packet.Write(item.RequiredFaction != null ? (int)item.RequiredFaction.Id : 0);
                packet.Write((uint)item.RequiredFactionStanding);
                packet.Write(item.UniqueCount);
                packet.Write(item.MaxAmount);
                packet.Write(item.ContainerSlots);

                packet.Write(item.Mods.Length);
                for (var m = 0; m < item.Mods.Length; m++)
                {
                    packet.Write((uint)item.Mods[m].Type);
                    packet.Write(item.Mods[m].Value);
                }

                packet.Write(item.ScalingStatDistributionId);// NEW 3.0.2 ScalingStatDistribution.dbc
                packet.Write(item.ScalingStatValueFlags);// NEW 3.0.2 ScalingStatFlags

                // In 3.1 there are only 2 damages instead of 5
                for (var i = 0; i < ItemConstants.MaxDmgCount; i++)
                {
                    if(i >= item.Damages.Length)
                    {
                        packet.WriteFloat(0f);
                        packet.WriteFloat(0f);
                        packet.WriteUInt(0u);
                        continue;
                    }

                    var dmg = item.Damages[i];

                    packet.Write(dmg.Minimum);
                    packet.Write(dmg.Maximum);
                    packet.Write((uint)dmg.School);
                }

                for (var i = 0; i < ItemConstants.MaxResCount; i++)
                {
                    var res = item.Resistances[i];
                    packet.Write(res);
                }

                packet.Write(item.AttackTime);
                packet.Write((uint)item.ProjectileType);
                packet.Write(item.RangeModifier);

                for (var s = 0; s < ItemConstants.MaxSpellCount; s++)
                {
                    ItemSpell spell;
                    if(s < item.Spells.Length && (spell = item.Spells[s]) != null)
                    {
                        packet.Write((uint)spell.Id);
                        packet.Write((uint)spell.Trigger);
                        packet.Write((uint)Math.Abs(spell.Charges));
                        packet.Write(spell.Cooldown);
                        packet.Write(spell.CategoryId);
                        packet.Write(spell.CategoryCooldown);
                    }
                    else
                    {
                        packet.WriteUInt(0u);
                        packet.WriteUInt(0u);
                        packet.WriteUInt(0u);
                        packet.Write(-1);
                        packet.WriteUInt(0u);
                        packet.Write(-1);
                    }
                }

                packet.Write((uint)item.BondType);
                packet.WriteCString(item.Descriptions.Localize(locale));
//.........这里部分代码省略.........
开发者ID:Zakkgard,项目名称:WCell,代码行数:101,代码来源:ItemHandler.cs

示例13: SendNotification

		/// <summary>
		/// Flashes a message in the middle of the screen.
		/// </summary>
		public static void SendNotification(IPacketReceiver client, string msg)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_NOTIFICATION))
			{
				packet.WriteCString(msg);
				client.Send(packet);
			}
		}
开发者ID:remixod,项目名称:netServer,代码行数:11,代码来源:MiscHandler.cs

示例14: SendNameInvalid

		public static void SendNameInvalid(IPacketReceiver receiver, PetNameInvalidReason reason, string name)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PET_NAME_INVALID))
			{
				packet.Write((uint)reason);
				packet.WriteCString(name);
				packet.WriteByte(0);

				receiver.Send(packet);
			}
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:11,代码来源:PetHandler.cs

示例15: SendPetitionQueryResponse

		public static void SendPetitionQueryResponse(IPacketReceiver client, PetitionCharter charter)
		{
            string name = charter.Petition.Name;
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PETITION_QUERY_RESPONSE, 4 + 8 + name.Length + 1 + 1 + 4 * 12 + 2 + 10))
			{
                packet.WriteUInt(charter.EntityId.Low);
                packet.WriteULong(charter.Owner.EntityId.Full);
                packet.WriteCString(name);
                packet.WriteByte(0);

                var type = (uint)charter.Petition.Type;
                if(type == (uint)PetitionType.Guild)
                {
                    packet.WriteUInt(type);
                    packet.WriteUInt(type);
                    packet.WriteUInt(0);
                }
                else
                {
                    packet.WriteUInt(type-1);
                    packet.WriteUInt(type-1);
                    packet.WriteUInt(type);
                }
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUShort(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);

                for(int i = 0; i < 10; ++i)
                    packet.WriteByte(0);

                packet.WriteUInt(0);

                if(type == (uint)PetitionType.Guild)
                    packet.WriteUInt(0);
                else
                    packet.WriteUInt(1);

                client.Send(packet);
			}
		}
开发者ID:NVN,项目名称:WCell,代码行数:45,代码来源:NPCHandler.cs


注:本文中的RealmPacketOut.WriteCString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。