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


C# RealmPacketOut.WriteInt方法代码示例

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


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

示例1: 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

示例2: SendTextEmote

        // Client doesn't seem to be sending this
        //[ClientPacketHandler(RealmServerOpCode.CMSG_EMOTE)]
        //public static void HandleEmote(IRealmClient client, RealmPacketIn packet)
        //{
        //    var emote = (EmoteType)packet.ReadUInt32();

        //    if (emote != EmoteType.None)
        //    {
        //        var chr = client.ActiveCharacter;
        //        if (chr.CanMove && chr.CanInteract)
        //        {
        //            SendEmote(chr, emote);
        //        }
        //    }
        //}

        public static void SendTextEmote(WorldObject obj, TextEmote emote, INamed target)
        {
            var len = (target == null) ? 20 : target.Name.Length + 21;

            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_TEXT_EMOTE, len))
            {
                packet.Write(obj.EntityId);
                packet.WriteUInt((uint)emote);
                packet.WriteInt(-1);
                packet.WriteUIntPascalString(target != null ? target.Name : "");

                obj.SendPacketToArea(packet, true);
            }
        }
开发者ID:ebakkedahl,项目名称:WCell,代码行数:30,代码来源:EmoteHandler.cs

示例3: TestParsedSegment

        public void TestParsedSegment()
        {
            PacketDefinition def = new PacketDefinition(RealmServerOpCode.CMSG_PLAYER_AI_CHEAT, PacketSender.Client,
                new PacketSegmentStructure(SimpleType.UInt, "SpellAttributes", typeof(SpellAttributes)),
                new ListPacketSegmentStructure(SimpleType.Byte, "Members",
                    new PacketSegmentStructure(SimpleType.Guid, "MemberId"),
                    new PacketSegmentStructure(SimpleType.CString, "Name")
                ),

                new SwitchPacketSegmentStructure("Attribute Switch", "SpellAttributes",
                    new SwitchCase(ComparisonType.And, SpellAttributes.CannotBeCastInCombat,
                        new PacketSegmentStructure(SimpleType.CString, "NoCombatString")
                    ),
                    new SwitchCase(ComparisonType.And, SpellAttributes.CannotBeCastInCombat | SpellAttributes.CastableWhileMounted,
                        new PacketSegmentStructure(SimpleType.CString, "NoCombatNoDismountString")
                    )
                ),

                new SwitchPacketSegmentStructure("List Switch", "Members",
                    new SwitchCase(ComparisonType.Equal, (byte)0,
                        new PacketSegmentStructure(SimpleType.Byte, "Status", "CharacterStatus"),
                        new SwitchPacketSegmentStructure("Nested Switch", "Status",
                            new SwitchCase(ComparisonType.AndNot, CharacterStatus.OFFLINE,
                                new PacketSegmentStructure(SimpleType.UInt, "NumX")
                            )
                        )
                    ),
                    new SwitchCase(ComparisonType.GreaterThan, (byte)0,
                        new PacketSegmentStructure(SimpleType.CString, "Info")
                    )
                ),

                new StaticListPacketSegmentStructure(1, "StaticList1",
                    new PacketSegmentStructure(SimpleType.Int, "Number1")
                ),

                new StaticListPacketSegmentStructure(2, "StaticList2",
                    new PacketSegmentStructure(SimpleType.Int, "Number2")
                ),

                new PacketSegmentStructure(SimpleType.Byte, "ListLength"),

                new ListPacketSegmentStructure("SomeList3", "ListLength",
                    new PacketSegmentStructure(SimpleType.Int, "SomeListEle")
                )
            );

            def.Init();

            using (var packet = new RealmPacketOut(RealmServerOpCode.CMSG_PLAYER_AI_CHEAT))
            {
                packet.WriteUInt((uint)(SpellAttributes.CastableWhileMounted | SpellAttributes.CannotBeCastInCombat));
                packet.WriteByte(2);

                packet.Write(EntityId.Zero);
                packet.WriteCString("Member1Name");

                packet.Write(new EntityId(10));
                packet.WriteCString("Member2Name");

                packet.WriteCString("NoCombat");
                packet.WriteCString("NoCombatNoDismount");

                packet.WriteCString("lotsofinfo");

                // StaticList1
                packet.WriteInt(10);

                // StaticList2
                packet.WriteInt(20);
                packet.WriteInt(30);

                // SomeList3's length
                packet.WriteByte(2);
                // SomeList3
                packet.WriteInt(5);
                packet.WriteInt(7);

                var parsedPacket = PacketParser.Parse(packet, PacketSender.Client, def);

                Assert.AreEqual("NoCombat", parsedPacket["NoCombatString"].StringValue);
                Assert.AreEqual("NoCombatNoDismount", parsedPacket["NoCombatNoDismountString"].StringValue);

                var members = parsedPacket["Members"];
                Assert.AreEqual(EntityId.Zero, members[0]["MemberId"].EntityIdValue);
                Assert.AreEqual("Member1Name", members[0]["Name"].StringValue);
                Assert.AreEqual("Member2Name", members[1]["Name"].StringValue);
                Assert.AreEqual("lotsofinfo", parsedPacket["Info"].StringValue);
                CheckRemainder(parsedPacket);
            }

            using (var packet = new RealmPacketOut(RealmServerOpCode.CMSG_PLAYER_AI_CHEAT))
            {
                packet.WriteUInt((uint)SpellAttributes.None);
                packet.WriteByte(0);

                packet.Write((byte)CharacterStatus.ONLINE);
                packet.Write((uint)1234);

                packet.WriteInt(10);
//.........这里部分代码省略.........
开发者ID:KroneckerX,项目名称:WCell,代码行数:101,代码来源:PacketAnalyzerTest.cs

示例4: CreateAchievementData

		public static void CreateAchievementData(RealmPacketOut packet, Character chr)
		{
			foreach (AchievementRecord completedAchievement in chr.Achievements.m_completedAchievements.Values)
			{
				packet.WriteUInt((uint)completedAchievement.AchievementEntryId);
				packet.WriteDateTime(completedAchievement.CompleteDate);
			}
			packet.WriteInt(0xFFFFFFFFu);

			/*foreach (AchievementProgressRecord achievementProgressRecord in chr.Achievements.m_achivement_progress.Values)
			{

				packet.WriteUInt((uint)achievementProgressRecord.AchievementCriteriaId);
				packet.WritePackedUInt64(achievementProgressRecord.Counter);					//	amount
				chr.EntityId.WritePacked(packet);
				packet.Write(0);
				packet.WriteDateTime(DateTime.Now);				// start time?
				packet.Write(0);								// Duration
				packet.Write(0);

			}
			packet.Write(0xFFFFFFFFu);*/
		}
开发者ID:NVN,项目名称:WCell,代码行数:23,代码来源:AchievementHandler.cs

示例5: SendTimeSpeed

        public static void SendTimeSpeed(IPacketReceiver client, DateTime time, float timeSpeed)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_LOGIN_SETTIMESPEED, 8))
            {
                packet.WriteDateTime(time);
                packet.WriteFloat(timeSpeed);
                packet.WriteInt(0);				// new, unknown

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

示例6: CreateGuildRosterPacket

		private static RealmPacketOut CreateGuildRosterPacket(Guild guild, bool showOfficerNotes)
		{
			var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GUILD_ROSTER);

			packet.Write(guild.MemberCount);

			if (guild.MOTD != null)
			{
				packet.WriteCString(guild.MOTD);
			}
			else
			{
				packet.WriteByte(0);
			}

			if (guild.Info != null)
			{
				packet.WriteCString(guild.Info);
			}
			else
			{
				packet.WriteByte(0);
			}

			var guildRanks = guild.Ranks;

			packet.Write(guildRanks.Length);

			for (var i = 0; i < guildRanks.Length; i++)
			{
				var rank = guildRanks[i];

				packet.Write((uint)rank.Privileges);

				packet.Write(rank.DailyBankMoneyAllowance);

				for (var j = 0; j < GuildMgr.MAX_BANK_TABS; j++)
				{
					var tabPrivileges = rank.BankTabRights[j];
					packet.WriteInt((uint)tabPrivileges.Privileges);
					packet.WriteInt(tabPrivileges.WithdrawlAllowance);
				}
			}

			Character chr;
			foreach (var member in guild.Members.Values)
			{
				chr = member.Character;

				packet.Write(EntityId.GetPlayerId(member.Id));

				if (chr != null)
					packet.WriteByte((byte)chr.Status);
				else
					packet.WriteByte((byte)CharacterStatus.OFFLINE);

				packet.WriteCString(member.Name);
				packet.Write(member.Rank.RankIndex);

				packet.Write((byte)member.Level);
				packet.Write((byte)member.Class);
				packet.Write((byte)0);
				packet.Write(member.ZoneId);

				if (chr == null)
				{
					packet.Write((float)(DateTime.Now - member.LastLogin).TotalDays);
				}

				if (member.PublicNote != null)
					packet.WriteCString(member.PublicNote);
				else
					packet.Write((byte)0);

				if (showOfficerNotes && member.OfficerNote != null)
					packet.WriteCString(member.OfficerNote);
				else
					packet.Write((byte)0);
			}

			return packet;
		}
开发者ID:MeaNone,项目名称:WCell,代码行数:82,代码来源:GuildHandler.cs

示例7: SendGuildInformation

		/// <summary>
		/// Sends a guild information to a client
		/// </summary>
		/// <param name="client">the client to send to</param>
		/// <param name="guild">guild</param>
		public static void SendGuildInformation(IPacketReceiver client, Guild guild)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GUILD_INFO))
			{
				packet.WriteCString(guild.Name);
				packet.WriteInt((byte)guild.Created.Year);
				packet.WriteInt((byte)guild.Created.Month);
				packet.WriteInt((byte)guild.Created.Day);
				packet.WriteInt((byte)guild.MemberCount);
				packet.WriteInt((byte)guild.MemberCount); // number of accounts

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

示例8: SendItemQueryResponse

        public static void SendItemQueryResponse(RealmClient client, ItemTemplate item)
        {
            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_ITEM_QUERY_SINGLE_RESPONSE, 630))
            {
                packet.Write(item.Id);
                packet.WriteInt((int)item.ItemClass);
                packet.WriteInt((int)item.ItemSubClass);
                packet.WriteInt(-1); // unknown

                packet.WriteCString(item.Name);
                packet.WriteByte(0);// name2
                packet.WriteByte(0);// name3
                packet.WriteByte(0);// name4

                packet.WriteInt(item.DisplayId);
                packet.WriteInt((int)item.Quality);
                packet.WriteInt((int)item.Flags);
                packet.WriteInt(item.BuyPrice);
                packet.WriteInt(item.SellPrice);
                packet.WriteInt((int)item.InventorySlot);
                packet.WriteInt((int)item.RequiredClassMask);
                packet.WriteInt((int)item.RequiredRaceMask);
                packet.WriteInt(item.Level);
                packet.WriteInt(item.RequiredLevel);
                packet.WriteInt(item.RequiredSkill != null ? (int)item.RequiredSkill.Id : 0);
                packet.WriteInt(item.RequiredSkillLevel);
                packet.WriteInt(item.RequiredProfession != null ? (int)item.RequiredProfession.Id : 0);
                packet.WriteInt(item.RequiredPvPRank);
                packet.WriteInt(item.UnknownRank);// city rank?
                packet.WriteInt(item.RequiredFaction != null ? (int)item.RequiredFaction.Id : 0);
                packet.WriteInt((int)item.RequiredFactionStanding);
                packet.WriteInt(item.UniqueCount);
                packet.WriteInt(item.MaxAmount);
                packet.WriteInt(item.ContainerSlots);
               foreach (var stat in item.Mods)
                {
					packet.WriteUInt((uint)stat.Type);
                    packet.WriteInt(stat.Value);
                }

                foreach (var dmg in item.Damages)
                {
					packet.WriteFloat(dmg.Minimum);
					packet.WriteFloat(dmg.Maximum);
					packet.WriteUInt((uint)dmg.DamageSchool);
                }

                foreach (var res in item.Resistances)
                {
                    packet.WriteUInt(res);
                }

                packet.WriteUInt(item.WeaponSpeed);
				packet.WriteUInt((uint)item.ProjectileType);
                packet.WriteFloat(item.RangeModifier);

                for (int i = 0; i < 5; i++)
                {
					packet.WriteUInt(item.Spells[i].Id);
					packet.WriteUInt((int)item.Spells[i].Trigger);
					packet.WriteUInt(item.Spells[i].Charges);
                    packet.WriteInt(item.Spells[i].Cooldown);
                    packet.WriteUInt(item.Spells[i].CategoryId);
                    packet.WriteInt(item.Spells[i].CategoryCooldown);
                }

				packet.WriteUInt((int)item.BondType);
                packet.WriteCString(item.Description);

				packet.Write(item.PageTextId);
				packet.Write(item.PageCount);
				packet.Write(item.PageMaterial);
				packet.Write(item.QuestId);
				packet.Write(item.RequiredLockpickSkill);
				packet.Write(item.Material);
				packet.Write((uint)item.SheathType);
				packet.Write(item.RandomPropertyId);
				packet.Write(item.RandomSuffixId);
				packet.Write(item.BlockValue);
				packet.Write(item.SetId);
				packet.Write(item.MaxDurability);
				packet.Write((uint)item.ZoneId);
				packet.Write((uint)item.MapId);
				packet.Write((uint)item.BagFamily);
				packet.Write(item.TotemCategory);

				for (int i = 0; i < ItemTemplate.MaxSocketCount; i++)
                {
                    packet.WriteInt(item.Sockets[i].SocketColor);
                    packet.WriteInt(item.Sockets[i].Unknown);
                }
                packet.WriteInt(item.SocketBonusId);
                packet.WriteInt(item.GemProperties);
                packet.WriteInt(item.ExtendedCost);
                packet.WriteInt(item.RequiredArenaRanking);
                packet.WriteInt(item.RequiredDisenchantingLevel);
                packet.WriteFloat(item.ArmorModifier);

                client.Send(packet);
            }
//.........这里部分代码省略.........
开发者ID:KroneckerX,项目名称:WCell,代码行数:101,代码来源:Item.Handlers.cs


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