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


C# RealmPacketOut.WriteUShort方法代码示例

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


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

示例1: SendLearnedSpell

		public static void SendLearnedSpell(IPacketReceiver client, uint spellId)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_LEARNED_SPELL, 4))
			{
				packet.WriteUInt(spellId);
				packet.WriteUShort(0); // 3.3.3a

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

示例2: SendPartyMemberStatsInternal

        /// <summary>
        /// Sends the requested party member stats data to the client
        /// </summary>
        /// <param name="client">realm client</param>
        /// <param name="member">The character whose stats is going to be retrieved</param>
        /// <param name="flags">The stats to be retrieved from the <paramref name="member"/></param>
        private static void SendPartyMemberStatsInternal(IPacketReceiver client, GroupMember member, GroupUpdateFlags flags,
                                                         RealmServerOpCode opcode)
        {
            using (var packet = new RealmPacketOut(opcode))
            {
                if (opcode == RealmServerOpCode.SMSG_PARTY_MEMBER_STATS_FULL)
                {
                    packet.Write((byte)0); //arena something
                }

                member.WriteIdPacked(packet);
                if (!member.IsOnline)
                {
                    packet.WriteUShort((ushort)CharacterStatus.OFFLINE);
                    client.Send(packet);
                    return;
                }
                packet.Write((uint)flags);

                var chr = member.Character;
                if (flags.HasFlag(GroupUpdateFlags.Status))
                {
                    packet.Write((ushort)chr.Status);
                }
                if (flags.HasFlag(GroupUpdateFlags.Health))
                {
                    packet.Write(chr.Health);
                }
                if (flags.HasFlag(GroupUpdateFlags.MaxHealth))
                {
                    packet.Write(chr.MaxHealth);
                }
                if (flags.HasFlag(GroupUpdateFlags.PowerType))
                {
                    packet.Write((byte)chr.PowerType);
                }
                if (flags.HasFlag(GroupUpdateFlags.Power))
                {
                    packet.Write((ushort)chr.Power);
                }
                if (flags.HasFlag(GroupUpdateFlags.MaxPower))
                {
                    packet.Write((ushort)chr.MaxPower);
                }
                if (flags.HasFlag(GroupUpdateFlags.Level))
                {
                    packet.Write((ushort)chr.Level);
                }
                if (flags.HasFlag(GroupUpdateFlags.ZoneId))
                {
                    packet.Write((ushort)(chr.Zone != null ? chr.Zone.Id : ZoneId.None));
                }
                if (flags.HasFlag(GroupUpdateFlags.Position))
                {
                    packet.Write((ushort)chr.Position.X);
                    packet.Write((ushort)chr.Position.Y);
                }
                if (flags.HasFlag(GroupUpdateFlags.Auras))
                {
                    ulong auraMask = chr.AuraUpdateMask;
                    packet.Write(auraMask);
                    Aura currAura;

                    for (byte i = 0; i < AuraHandler.MaxAuras; ++i)
                    {
                        if ((auraMask & ((ulong)1 << i)) != 0)
                        {
                            currAura = chr.Auras.GetAt(i);

                            packet.Write(currAura.Spell.Id);
                            packet.Write((byte)currAura.Flags);
                        }
                    }
                }

                NPC targetPet = chr.ActivePet;

                if (targetPet == null) //no pet
                {
                    packet.Write((byte)0); //name
                    packet.Write(0UL); //auras
                    client.Send(packet);
                    return;
                }

                if (flags.HasFlag(GroupUpdateFlags.PetGuid))
                {
                    packet.Write(targetPet.EntityId);
                }

                if (flags.HasFlag(GroupUpdateFlags.PetName))
                {
                    packet.WriteCString(targetPet.Name);
                }
//.........这里部分代码省略.........
开发者ID:Stika,项目名称:WCell,代码行数:101,代码来源:GroupHandler.cs

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