• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Network.Packet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Aura.Shared.Network.Packet的典型用法代码示例。如果您正苦于以下问题:C# Packet类的具体用法?C# Packet怎么用?C# Packet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Packet类属于Aura.Shared.Network命名空间,在下文中一共展示了Packet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: BlacksmithingMiniGame

        /// <summary>
        /// Sends BlacksmithingMiniGame to creature's client, which starts
        /// the Blacksmithing mini-game.
        /// </summary>
        /// <remarks>
        /// The position of the dots is relative to the upper left of the
        /// field. They land exactly on those spots after "wavering" for a
        /// moment. This wavering is randomized on the client side and
        /// doesn't affect anything.
        /// 
        /// The time bar is always the same, but the time it takes to fill
        /// up changes based on the "time displacement". The lower the value,
        /// the longer it takes to fill up. Using values that are too high
        /// or too low mess up the calculations and cause confusing results.
        /// The official range seems to be between ~0.81 and ~0.98.
        /// </remarks>
        /// <param name="creature"></param>
        /// <param name="prop"></param>
        /// <param name="item"></param>
        /// <param name="dots"></param>
        /// <param name="deviation"></param>
        public static void BlacksmithingMiniGame(Creature creature, Prop prop, Item item, List<BlacksmithDot> dots, int deviation)
        {
            if (dots == null || dots.Count != 5)
                throw new ArgumentException("5 dots required.");

            var packet = new Packet(Op.BlacksmithingMiniGame, creature.EntityId);

            // Untested if this is actually the deviation/cursor size,
            // but Tailoring does something very similar. Just like with
            // Tailoring, wrong values cause failed games.
            packet.PutShort((short)deviation);

            foreach (var dot in dots)
            {
                packet.PutShort((short)dot.X);
                packet.PutShort((short)dot.Y);
                packet.PutFloat(dot.TimeDisplacement);
                packet.PutShort((short)dot.Deviation);
            }

            packet.PutLong(prop.EntityId);
            packet.PutInt(0);
            packet.PutLong(item.EntityId);
            packet.PutInt(0);

            creature.Client.Send(packet);
        }
开发者ID:,项目名称:,代码行数:48,代码来源:


示例2: Disappear

		/// <summary>
		/// Sends Disappear to creature's client.
		/// </summary>
		/// <remarks>
		/// Should this be broadcasted? What does it even do? TODO.
		/// </remarks>
		/// <param name="creature"></param>
		public static void Disappear(Creature creature)
		{
			var packet = new Packet(Op.Disappear, MabiId.Channel);
			packet.PutLong(creature.EntityId);

			creature.Client.Send(packet);
		}
开发者ID:Rai,项目名称:aura,代码行数:14,代码来源:Send.Misc.cs


示例3: DestroyExpiredItemsR

        /// <summary>
        /// Sends DestroyExpiredItemsR to creature's client.
        /// </summary>
        /// <param name="creature"></param>
        /// <param name="success"></param>
        public static void DestroyExpiredItemsR(Creature creature, bool success)
        {
            var packet = new Packet(Op.DestroyExpiredItemsR, creature.EntityId);
            packet.PutByte(success);

            creature.Client.Send(packet);
        }
开发者ID:,项目名称:,代码行数:12,代码来源:


示例4: TouchPropR

		/// <summary>
		/// Sends TouchPropR to creature's client.
		/// </summary>
		/// <param name="creature"></param>
		public static void TouchPropR(Creature creature)
		{
			var packet = new Packet(Op.TouchPropR, creature.EntityId);
			packet.PutByte(true);

			creature.Client.Send(packet);
		}
开发者ID:tkiapril,项目名称:aura,代码行数:11,代码来源:Send.Props.cs


示例5: MailsRequestR

		/// <summary>
		/// Sends MailsRequestR to creature's client.
		/// </summary>
		/// <param name="creature"></param>
		public static void MailsRequestR(Creature creature)
		{
			var packet = new Packet(Op.MailsRequestR, creature.EntityId);
			// ...

			creature.Client.Send(packet);
		}
开发者ID:Rai,项目名称:aura,代码行数:11,代码来源:Send.Misc.cs


示例6: RequestRebirthR

		/// <summary>
		/// Sends RequestRebirthR to creature's client.
		/// </summary>
		/// <param name="vehicle"></param>
		public static void RequestRebirthR(Creature creature, bool success)
		{
			var packet = new Packet(Op.RequestRebirthR, MabiId.Login);
			packet.PutByte(success);

			creature.Client.Send(packet);
		}
开发者ID:aura-project,项目名称:aura,代码行数:11,代码来源:Send.Rebirth.cs


示例7: Prepare

		/// <summary>
		/// Prepares skill, skips right to used.
		/// </summary>
		/// <remarks>
		/// Doesn't check anything, like what you can gather with what,
		/// because at this point there's no chance for abuse.
		/// </remarks>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		/// <returns></returns>
		public bool Prepare(Creature creature, Skill skill, Packet packet)
		{
			var entityId = packet.GetLong();
			var collectId = packet.GetInt();

			// You shall stop
			creature.StopMove();
			var creaturePosition = creature.GetPosition();

			// Get target (either prop or creature)
			var targetEntity = this.GetTargetEntity(creature.Region, entityId);
			if (targetEntity != null)
				creature.Temp.GatheringTargetPosition = targetEntity.GetPosition();

			// Check distance
			if (!creaturePosition.InRange(creature.Temp.GatheringTargetPosition, MaxDistance))
			{
				Send.Notice(creature, Localization.Get("Your arms are too short to reach that from here."));
				return false;
			}

			// ? (sets creatures position on the client side)
			Send.CollectAnimation(creature, entityId, collectId, creaturePosition);

			// Use
			Send.SkillUse(creature, skill.Info.Id, entityId, collectId);
			skill.State = SkillState.Used;

			return true;
		}
开发者ID:tkiapril,项目名称:aura,代码行数:41,代码来源:Gathering.cs


示例8: Prepare

		/// <summary>
		/// Prepares skill, goes straight to use to skip readying and using it.
		/// </summary>
		/// <remarks>
		/// The client will take a moment to send the Complete packet,
		/// as if it would cast the skill first.
		/// </remarks>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public bool Prepare(Creature creature, Skill skill, Packet packet)
		{
			Send.SkillUse(creature, skill.Info.Id, 0);
			skill.State = SkillState.Used;

			return true;
		}
开发者ID:aura-project,项目名称:aura,代码行数:17,代码来源:WebSpinning.cs


示例9: Complete

		/// <summary>
		/// Completes skill, dropping a cobweb.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public void Complete(Creature creature, Skill skill, Packet packet)
		{
			var cobweb = new Item(ItemId);
			cobweb.Drop(creature.Region, creature.GetPosition(), 200, creature, true);

			Send.SkillComplete(creature, skill.Info.Id);
		}
开发者ID:aura-project,项目名称:aura,代码行数:13,代码来源:WebSpinning.cs


示例10: CancelMotion

        /// <summary>
        /// Broadcasts CancelMotion in creature's region.
        /// </summary>
        /// <param name="creature"></param>
        public static void CancelMotion(Creature creature)
        {
            var cancelPacket = new Packet(Op.CancelMotion, creature.EntityId);
            cancelPacket.PutByte(0);

            creature.Region.Broadcast(cancelPacket, creature);
        }
开发者ID:,项目名称:,代码行数:11,代码来源:


示例11: ChannelDisconnectR

        /// <summary>
        /// Sends ChannelDisconnectR to client.
        /// </summary>
        /// <param name="client"></param>
        public static void ChannelDisconnectR(ChannelClient client)
        {
            var packet = new Packet(Op.DisconnectRequestR, MabiId.Channel);
            packet.PutByte(0);

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


示例12: Complete

		public void Complete(Creature creature, Skill skill, Packet packet)
		{
			var str = packet.GetString();
			var dict = new MabiDictionary(str);

			var hwEntityId = dict.GetLong("ITEMID");
			if (hwEntityId == 0)
				goto L_End;

			var hw = creature.Inventory.GetItemSafe(hwEntityId);
			if (!hw.HasTag("/large_blessing_potion/"))
				goto L_End;

			// TODO: Check loading time

			var items = creature.Inventory.GetEquipment();
			foreach (var item in items)
			{
				var blessable = (item.HasTag("/equip/") && !item.HasTag("/not_bless/"));

				if (blessable)
					item.OptionInfo.Flags |= ItemFlags.Blessed;
			}

			creature.Inventory.Decrement(hw, 1);
			Send.ItemBlessed(creature, items);

		L_End:
			Send.UseMotion(creature, 14, 0);
			Send.SkillComplete(creature, skill.Info.Id, str);
		}
开发者ID:tkiapril,项目名称:aura,代码行数:31,代码来源:BigBlessingWaterKit.cs


示例13: Complete

		/// <summary>
		/// Completes skill, warping to destination.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public void Complete(Creature creature, Skill skill, Packet packet)
		{
			var destination = (Continent)packet.GetByte();

			int regionId, x, y;
			switch (destination)
			{
				case Continent.Uladh:
					if (creature.Keywords.Has("portal_dunbarton"))
					{
						regionId = 14; x = 41598; y = 36010; // Dun
					}
					else
					{
						regionId = 1; x = 12789; y = 38399; // Tir
					}
					break;
				case Continent.Iria:
					regionId = 3001; x = 164837; y = 170144; // Qilla
					break;
				case Continent.Belvast:
					regionId = 4005; x = 41760; y = 26924; // Belvast
					break;
				default:
					Send.Notice(creature, "Unknown destination.");
					Send.SkillCancel(creature);
					return;
			}

			creature.Warp(regionId, x, y);

			Send.SkillComplete(creature, skill.Info.Id, (byte)destination);
		}
开发者ID:tkiapril,项目名称:aura,代码行数:39,代码来源:ContinentWarp.cs


示例14: BuildPacket

		protected override byte[] BuildPacket(Packet packet)
		{
			var packetSize = packet.GetSize();

			// Calculate header size
			var headerSize = 3;
			int n = packetSize;
			do { headerSize++; n >>= 7; } while (n != 0);

			// Write header
			var result = new byte[headerSize + packetSize];
			result[0] = 0x55;
			result[1] = 0x12;
			result[2] = 0x00;

			// Length
			var ptr = 3;
			n = packetSize;
			do
			{
				result[ptr++] = (byte)(n > 0x7F ? (0x80 | (n & 0xFF)) : n & 0xFF);
				n >>= 7;
			}
			while (n != 0);

			// Write packet
			packet.Build(ref result, ptr);

			return result;
		}
开发者ID:tkiapril,项目名称:aura,代码行数:30,代码来源:MsgrClient.cs


示例15: NewQuest

        /// <summary>
        ///  Sends NewQuest to creature's client.
        /// </summary>
        /// <param name="character"></param>
        /// <param name="quest"></param>
        public static void NewQuest(Creature character, Quest quest)
        {
            var packet = new Packet(Op.NewQuest, character.EntityId);
            packet.AddQuest(quest);

            character.Client.Send(packet);
        }
开发者ID:,项目名称:,代码行数:12,代码来源:


示例16: PetUnregister

		/// <summary>
		/// Sends PetUnregister to creature's client.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="pet"></param>
		public static void PetUnregister(Creature creature, Creature pet)
		{
			var packet = new Packet(Op.PetUnregister, creature.EntityId);
			packet.PutLong(pet.EntityId);

			creature.Client.Send(packet);
		}
开发者ID:tkiapril,项目名称:aura,代码行数:12,代码来源:Send.Pets.cs


示例17: PartySetActiveQuest

        /// <summary>
        /// Broadcasts PartySetActiveQuest in party.
        /// </summary>
        /// <param name="party"></param>
        /// <param name="uniqueQuestId"></param>
        public static void PartySetActiveQuest(Party party, long uniqueQuestId)
        {
            var packet = new Packet(Op.PartySetActiveQuest, 0);
            packet.PutLong(uniqueQuestId);

            party.Broadcast(packet, true);
        }
开发者ID:,项目名称:,代码行数:12,代码来源:


示例18: TelePetR

		/// <summary>
		/// Sends TelePetR to pet's client.
		/// </summary>
		/// <param name="pet"></param>
		/// <param name="success"></param>
		public static void TelePetR(Creature pet, bool success)
		{
			var packet = new Packet(Op.TelePetR, pet.EntityId);
			packet.PutByte(success);

			pet.Client.Send(packet);
		}
开发者ID:tkiapril,项目名称:aura,代码行数:12,代码来源:Send.Pets.cs


示例19: EnterRebirthR

		/// <summary>
		/// Sends EnterRebirthR to creature's client.
		/// </summary>
		/// <param name="creature"></param>
		public static void EnterRebirthR(Creature creature)
		{
			var packet = new Packet(Op.EnterRebirthR, creature.EntityId);
			packet.PutByte(0);

			creature.Client.Send(packet);
		}
开发者ID:aura-project,项目名称:aura,代码行数:11,代码来源:Send.Rebirth.cs


示例20: Internal_ServerIdentify

        /// <summary>
        /// Sends Internal.ServerIdentify to login server.
        /// </summary>
        public static void Internal_ServerIdentify()
        {
            var packet = new Packet(Op.Internal.ServerIdentify, 0);
            packet.PutString(Password.Hash(ChannelServer.Instance.Conf.Internal.Password));

            ChannelServer.Instance.LoginServer.Send(packet);
        }
开发者ID:pie3467,项目名称:aura,代码行数:10,代码来源:Send.Internal.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Network.WorldClient类代码示例发布时间:2022-05-24
下一篇:
C# Quests.Quest类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap