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


C# Packet.PutShort方法代码示例

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


在下文中一共展示了Packet.PutShort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: EntitiesDisappear

        /// <summary>
        /// Sends EntitiesDisappear to client, unless entities is empty.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="entities"></param>
        public static void EntitiesDisappear(ChannelClient client, IEnumerable<Entity> entities)
        {
            var count = (short)entities.Count();
            if (count < 1)
                return;

            var packet = new Packet(Op.EntitiesDisappear, MabiId.Broadcast);
            packet.PutShort(count);
            foreach (var entity in entities)
            {
                packet.PutShort((short)entity.DataType);
                packet.PutLong(entity.EntityId);
            }

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

示例3: EntrustmentChanceUpdate

		/// <summary>
		/// Sends EntrustmentChanceUpdate to creature's client.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="chance"></param>
		/// <param name="unkShort"></param>
		public static void EntrustmentChanceUpdate(Creature creature, float chance, SkillRank skillRank)
		{
			var packet = new Packet(Op.EntrustmentChanceUpdate, creature.EntityId);
			packet.PutFloat(chance);
			packet.PutShort((short)skillRank);

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

示例4: RankUp

		/// <summary>
		/// Broadcasts RankUp in range of creature.
		/// </summary>
		/// <remarks>
		/// The second parameter is the rank, but doesn't seem to be necessary.
		/// </remarks>
		/// <param name="creature"></param>
		/// <param name="skillId">Excluded if 0</param>
		public static void RankUp(Creature creature, SkillId skillId = 0)
		{
			var packet = new Packet(Op.RankUp, creature.EntityId);
			if (skillId > 0)
				packet.PutUShort((ushort)skillId);
			packet.PutShort(1); // Rank

			creature.Region.Broadcast(packet, creature);
		}
开发者ID:ripxfrostbite,项目名称:aura,代码行数:17,代码来源:Send.Skills.cs

示例5: EntitiesAppear

        /// <summary>
        /// Sends EntitiesAppear to client, unless entities is empty.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="entities"></param>
        public static void EntitiesAppear(ChannelClient client, IEnumerable<Entity> entities)
        {
            var count = (short)entities.Count();
            if (count < 1)
                return;

            var packet = new Packet(Op.EntitiesAppear, MabiId.Broadcast);
            packet.PutShort(count);
            foreach (var entity in entities)
            {
                var data = Packet.Empty().AddPublicEntityInfo(entity).Build(false);

                packet.PutShort((short)entity.DataType);
                packet.PutInt(data.Length);
                packet.PutBin(data);
            }

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

示例6: ChannelInfoRequestR

        /// <summary>
        /// Sends ChannelInfoRequestR to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="info">Negative response if null.</param>
        /// <param name="characterId"></param>
        public static void ChannelInfoRequestR(LoginClient client, ChannelInfo info, long characterId)
        {
            var packet = new Packet(Op.ChannelInfoRequestR, MabiId.Channel);
            packet.PutByte(info != null);

            if (info != null)
            {
                packet.PutString(info.ServerName);
                packet.PutString(info.Name);
                packet.PutShort(6); // Channel "Id"? (seems to be equal to channel nr)
                packet.PutString(info.Host);
                packet.PutString(info.Host);
                packet.PutShort((short)info.Port);
                packet.PutShort((short)(info.Port + 2));
                packet.PutInt(1);
                packet.PutLong(characterId);
            }

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

示例7: EntitiesAppear

		/// <summary>
		/// Sends EntitiesAppear to client, unless entities is empty.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="entities"></param>
		public static void EntitiesAppear(ChannelClient client, IEnumerable<Entity> entities)
		{
			// Count() is much faster then creating a list, speed being
			// important in this method.
			var count = (short)entities.Count();
			if (count < 1)
				return;

			var packet = new Packet(Op.EntitiesAppear, MabiId.Broadcast);
			packet.PutShort(count);
			foreach (var entity in entities)
			{
				var data = Packet.Empty().AddPublicEntityInfo(entity).Build();

				packet.PutShort((short)entity.DataType);
				packet.PutInt(data.Length);
				packet.PutBin(data);
			}

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

示例8: Effect

        /// <summary>
        /// Broadcasts Effect in range of creature.
        /// </summary>
        /// <remarks>
        /// Parameters have to be casted to the proper type, use carefully!
        /// </remarks>
        /// <param name="creature"></param>
        /// <param name="parameters"></param>
        public static void Effect(Creature creature, int effectId, params object[] parameters)
        {
            var packet = new Packet(Op.Effect, creature.EntityId);
            packet.PutInt(effectId);
            foreach (var p in parameters)
            {
                if (p is byte) packet.PutByte((byte)p);
                else if (p is bool) packet.PutByte((bool)p);
                else if (p is short) packet.PutShort((short)p);
                else if (p is int) packet.PutInt((int)p);
                else if (p is long) packet.PutLong((long)p);
                else if (p is float) packet.PutFloat((float)p);
                else if (p is string) packet.PutString((string)p);
                else
                    throw new Exception("Unsupported effect parameter: " + p.GetType());
            }

            creature.Region.Broadcast(packet, creature);
        }
开发者ID:Kuukrow,项目名称:aura,代码行数:27,代码来源:Send.Effects.cs

示例9: PlayEffect

        /// <summary>
        /// Broadcasts Effect in range of creature.
        /// </summary>
        /// <param name="creature"></param>
        /// <param name="instrument"></param>
        /// <param name="quality"></param>
        /// <param name="compressedMML"></param>
        /// <param name="rndScore"></param>
        public static void PlayEffect(Creature creature, InstrumentType instrument, PlayingQuality quality, string compressedMML, int rndScore)
        {
            var packet = new Packet(Op.Effect, creature.EntityId);
            packet.PutInt(E.PlayMusic);
            packet.PutByte(compressedMML != null); // has scroll
            if (compressedMML != null)
                packet.PutString(compressedMML);
            else
                packet.PutInt(rndScore);
            packet.PutInt(0);
            packet.PutShort(0);
            packet.PutInt(14113); // ?
            packet.PutByte((byte)quality);
            packet.PutByte((byte)instrument);
            packet.PutByte(0);
            packet.PutByte(0);
            packet.PutByte(1); // loops

            // Singing?
            //packet.PutByte(0);
            //packet.PutByte(1);

            creature.Region.Broadcast(packet, creature);
        }
开发者ID:Kuukrow,项目名称:aura,代码行数:32,代码来源:Send.Effects.cs

示例10: LevelUp

		/// <summary>
		/// Broadcasts LevelUp in range of creature.
		/// </summary>
		/// <param name="creature"></param>
		public static void LevelUp(Creature creature)
		{
			var packet = new Packet(Op.LevelUp, creature.EntityId);
			packet.PutShort(creature.Level);

			creature.Region.Broadcast(packet, creature);
		}
开发者ID:xKamuna,项目名称:aura,代码行数:11,代码来源:Send.Creature.cs

示例11: StatUpdate

		/// <summary>
		/// Sends StatUpdatePublic to creature's in range,
		/// or StatUpdatePrivate to creature's client.
		/// </summary>
		/// <remarks>
		/// In private mode this packet has simply 4 lists.
		/// - A list of stats and their (new) values.
		/// - A list of (new) regens.
		/// - A list of regens to remove (by id).
		/// - A list of regens to update, with new change and max values.
		/// (The last one is speculation.)
		/// Since it's private, it's only sent to the creature's client,
		/// and they get every stat and regen.
		/// 
		/// In public mode the same information is sent, but limited to stats
		/// like life, that's required for displaying life bars for others.
		/// It also has 3 more lists, that seem to do almost the same as the
		/// last 3 of private, regens, removing, and updating.
		/// - Some regens are sent in the first list, some in the second.
		///   (Like life vs injuries when using Rest.)
		/// - Regens that are to be removed are sent in both lists.
		/// - Updates are only sent in the first list.
		/// More research is required, to find out what the second lists
		/// actually do.
		/// </remarks>
		public static void StatUpdate(Creature creature, StatUpdateType type, ICollection<Stat> stats, ICollection<StatRegen> regens, ICollection<StatRegen> regensRemove, ICollection<StatRegen> regensUpdate)
		{
			var packet = new Packet(type == StatUpdateType.Public ? Op.StatUpdatePublic : Op.StatUpdatePrivate, creature.EntityId);
			packet.PutByte((byte)type);

			// Stats
			if (stats == null)
				packet.PutInt(0);
			else
			{
				packet.PutInt(stats.Count);
				foreach (var stat in stats)
				{
					packet.PutInt((int)stat);
					switch (stat)
					{
						case Stat.Height: packet.PutFloat(creature.Height); break;
						case Stat.Weight: packet.PutFloat(creature.Weight); break;
						case Stat.Upper: packet.PutFloat(creature.Upper); break;
						case Stat.Lower: packet.PutFloat(creature.Lower); break;

						case Stat.CombatPower: packet.PutFloat(creature.CombatPower); break;
						case Stat.Level: packet.PutShort(creature.Level); break;
						case Stat.AbilityPoints: packet.PutShort(creature.AbilityPoints); break;
						case Stat.Experience: packet.PutLong(AuraData.ExpDb.CalculateRemaining(creature.Level, creature.Exp) * 1000); break;

						case Stat.Life: packet.PutFloat(creature.Life); break;
						case Stat.LifeMax: packet.PutFloat(creature.LifeMaxBaseTotal); break;
						case Stat.LifeMaxMod: packet.PutFloat(creature.StatMods.Get(Stat.LifeMaxMod)); break;
						case Stat.LifeInjured: packet.PutFloat(creature.LifeInjured); break;
						case Stat.LifeMaxFoodMod: packet.PutFloat(creature.LifeFoodMod); break;
						case Stat.Mana: packet.PutFloat(creature.Mana); break;
						case Stat.ManaMax: packet.PutFloat(creature.ManaMaxBaseTotal); break;
						case Stat.ManaMaxMod: packet.PutFloat(creature.StatMods.Get(Stat.ManaMaxMod)); break;
						case Stat.ManaMaxFoodMod: packet.PutFloat(creature.ManaFoodMod); break;
						case Stat.Stamina: packet.PutFloat(creature.Stamina); break;
						case Stat.Hunger: packet.PutFloat(creature.StaminaHunger); break;
						case Stat.StaminaMax: packet.PutFloat(creature.StaminaMaxBaseTotal); break;
						case Stat.StaminaMaxMod: packet.PutFloat(creature.StatMods.Get(Stat.StaminaMaxMod)); break;
						case Stat.StaminaMaxFoodMod: packet.PutFloat(creature.StaminaFoodMod); break;

						case Stat.StrMod: packet.PutFloat(creature.StatMods.Get(Stat.StrMod)); break;
						case Stat.DexMod: packet.PutFloat(creature.StatMods.Get(Stat.DexMod)); break;
						case Stat.IntMod: packet.PutFloat(creature.StatMods.Get(Stat.IntMod)); break;
						case Stat.LuckMod: packet.PutFloat(creature.StatMods.Get(Stat.LuckMod)); break;
						case Stat.WillMod: packet.PutFloat(creature.StatMods.Get(Stat.WillMod)); break;
						case Stat.Str: packet.PutFloat(creature.StrBaseTotal); break;
						case Stat.Int: packet.PutFloat(creature.IntBaseTotal); break;
						case Stat.Dex: packet.PutFloat(creature.DexBaseTotal); break;
						case Stat.Will: packet.PutFloat(creature.WillBaseTotal); break;
						case Stat.Luck: packet.PutFloat(creature.LuckBaseTotal); break;
						case Stat.StrFoodMod: packet.PutFloat(creature.StrFoodMod); break;
						case Stat.DexFoodMod: packet.PutFloat(creature.DexFoodMod); break;
						case Stat.IntFoodMod: packet.PutFloat(creature.IntFoodMod); break;
						case Stat.LuckFoodMod: packet.PutFloat(creature.LuckFoodMod); break;
						case Stat.WillFoodMod: packet.PutFloat(creature.WillFoodMod); break;

						case Stat.DefenseBase: packet.PutShort((short)creature.DefenseBase); break;
						case Stat.ProtectionBase: packet.PutFloat(creature.ProtectionBase); break;
						case Stat.DefenseBaseMod: packet.PutShort((short)(creature.DefenseBaseModClient); break; //Since client already updates Defense, remove the STR defense from showing if combat renewal is off.
						case Stat.ProtectionBaseMod: packet.PutFloat(creature.ProtectionBaseMod); break;
						case Stat.DefenseMod: packet.PutShort((short)creature.DefenseMod); break;
						case Stat.ProtectionMod: packet.PutFloat(creature.ProtectionMod); break;

						case Stat.BalanceBase: packet.PutShort((short)(creature.BalanceBase)); break;
						case Stat.BalanceBaseMod: packet.PutShort((short)(creature.BalanceBaseMod)); break;

						case Stat.RightBalanceMod: packet.PutShort((short)creature.RightBalanceMod); break;
						case Stat.LeftBalanceMod: packet.PutShort((short)creature.LeftBalanceMod); break;

						case Stat.CriticalBase: packet.PutFloat(creature.CriticalBase); break;
						case Stat.CriticalBaseMod: packet.PutFloat(creature.CriticalBaseMod); break;

						case Stat.RightCriticalMod: packet.PutFloat(creature.RightCriticalMod); break;
						case Stat.LeftCriticalMod: packet.PutFloat(creature.LeftCriticalMod); break;
//.........这里部分代码省略.........
开发者ID:xKamuna,项目名称:aura,代码行数:101,代码来源:Send.Creature.cs

示例12: CombatSetAimR

		/// <summary>
		/// Sends CombatSetAimR to creature's client.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="targetEntityId">Set 0 for negative response.</param>
		/// <param name="skillId"></param>
		/// <param name="unkByte"></param>
		public static void CombatSetAimR(Creature creature, long targetEntityId, SkillId skillId, byte unkByte)
		{
			var packet = new Packet(Op.CombatSetAimR, creature.EntityId);
			packet.PutByte(targetEntityId != 0);
			if (targetEntityId != 0)
			{
				packet.PutLong(targetEntityId);
				packet.PutShort((short)skillId);
				packet.PutByte(unkByte);
			}

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

示例13: VisualChat

		/// <summary>
		/// Broadcasts VisualChat to creatures in range.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="url"></param>
		/// <param name="width"></param>
		/// <param name="height"></param>
		public static void VisualChat(Creature creature, string url, short width, short height)
		{
			var packet = new Packet(Op.VisualChat, creature.EntityId);
			packet.PutString(creature.Name);
			packet.PutString(url);
			packet.PutShort(width);
			packet.PutShort(height);
			packet.PutByte(0);

			creature.Region.Broadcast(packet, creature);
		}
开发者ID:ripxfrostbite,项目名称:aura,代码行数:18,代码来源:Send.Messages.cs

示例14: AgeUpEffect

		/// <summary>
		/// Sends AgeUpEffect to creature's client.
		/// </summary>
		/// <remarks>
		/// Notice + Light effect.
		/// Effect is only played for ages 1~25.
		/// </remarks>
		/// <param name="creature"></param>
		/// <param name="age"></param>
		public static void AgeUpEffect(Creature creature, short age)
		{
			var packet = new Packet(Op.AgeUpEffect, creature.EntityId);
			packet.PutShort(age);

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

示例15: DeadFeather

		/// <summary>
		/// Broadcasts DeadFeather in range of creature.
		/// </summary>
		/// <param name="creature"></param>
		public static void DeadFeather(Creature creature)
		{
			var bits = (int)creature.DeadMenu.Options;
			var flags = new List<int>();
			flags.Add(0);

			// Break down options bit by bit, and add them to flags if set.
			for (var i = 1; bits != 0; ++i, bits >>= 1)
			{
				if ((bits & 1) != 0)
					flags.Add(i);
			}

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

			packet.PutShort((short)flags.Count);
			foreach (var flag in flags)
				packet.PutInt(flag);

			packet.PutByte(0);

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


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