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


C# Creature.GetPosition方法代码示例

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


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

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

示例2: UseSkillOnTarget

		/// <summary>
		/// Bolt specific use code.
		/// </summary>
		/// <param name="attacker"></param>
		/// <param name="skill"></param>
		/// <param name="target"></param>
		protected override void UseSkillOnTarget(Creature attacker, Skill skill, Creature mainTarget)
		{
			// Create actions
			var aAction = new AttackerAction(CombatActionType.RangeHit, attacker, skill.Info.Id, mainTarget.EntityId);
			aAction.Set(AttackerOptions.Result);

			var cap = new CombatActionPack(attacker, skill.Info.Id, aAction);

			var targets = new List<Creature>();
			targets.Add(mainTarget);
			targets.AddRange(mainTarget.Region.GetCreaturesInRange(mainTarget.GetPosition(), SplashRange).Where(a => a != mainTarget && attacker.CanTarget(a) && attacker.CanAttack(a)));

			// Damage
			var damage = this.GetDamage(attacker, skill);

			var max = Math.Min(targets.Count, skill.Stacks);
			for (int i = 0; i < max; ++i)
			{
				var target = targets[i];
				var targetDamage = damage;

				target.StopMove();

				var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Info.Id);
				tAction.Set(TargetOptions.Result);
				tAction.Stun = TargetStun;

				// Full damage for the first target, -10% for every subsequent one.
				targetDamage -= (targetDamage * 0.1f) * i;

				// Reduce damage
				var maxDamage = damage; //Damage without Defense and Protection
				// Reduce damage
				Defense.Handle(aAction, tAction);
				SkillHelper.HandleMagicDefenseProtection(target, ref targetDamage);
				ManaShield.Handle(target, ref targetDamage, tAction, maxDamage, true);

				// Deal damage
				if (targetDamage > 0)
					target.TakeDamage(tAction.Damage = targetDamage, attacker);

				if (target == mainTarget)
					target.Aggro(attacker);

				// Death/Knockback
				this.HandleKnockBack(attacker, target, tAction);

				cap.Add(tAction);
			}

			// Override stun set by defense
			aAction.Stun = AttackerStun;

			Send.Effect(attacker, Effect.UseMagic, EffectSkillName);
			Send.SkillUseStun(attacker, skill.Info.Id, aAction.Stun, 1);

			this.BeforeHandlingPack(attacker, skill);

			cap.Handle();
		}
开发者ID:xKamuna,项目名称:aura,代码行数:66,代码来源:Lightningbolt.cs

示例3: CheckProp

		protected override bool CheckProp(Creature creature, long propEntityId)
		{
			// Milling behaves like a skill that doesn't require a prop,
			// but as we know, it does, so we'll do a static check for
			// Tir's Windmill.

			propEntityId = 0xA000010009042B;

			// Check prop
			var prop = creature.Region.GetProp(propEntityId);
			if (prop == null)
			{
				Log.Error("Milling.CheckProp: Windmill not found ({0:X16}).", propEntityId);
				Send.ServerMessage(creature, Localization.Get("Error in prop check, please report."));
				return false;
			}

			// Check range
			if (!creature.GetPosition().InRange(prop.GetPosition(), 1500))
			{
				Send.Notice(creature, Localization.Get("You are too far away."));
				return false;
			}

			// Check state
			// Sanity check, client checks this.
			if (prop.State == "off")
			{
				Send.Notice(creature, Localization.Get("The Mill isn't working."));
				return false;
			}

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

示例4: 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().GetRandomInRange(200, RandomProvider.Get()));

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

示例5: CheckProp

		protected override bool CheckProp(Creature creature, long propEntityId)
		{
			// Check existence
			var prop = (propEntityId == 0 ? null : creature.Region.GetProp(propEntityId));
			if (prop == null || !prop.HasTag("/refine/"))
			{
				Log.Warning("Refining.Prepare: Creature '{0:X16}' tried to use production skill with invalid prop.", creature.EntityId);
				return false;
			}

			// Check distance
			if (!creature.GetPosition().InRange(prop.GetPosition(), 1000))
			{
				// Don't warn, could happen due to lag.
				Send.Notice(creature, Localization.Get("You are too far away."));
				return false;
			}

			// Check state
			// Sanity check, client should handle it.
			if (prop.State != "on")
			{
				Send.Notice(creature, Localization.Get("The Waterwheel isn't working,\nand that means the Furnace won't fire."));
				return false;
			}

			return true;
		}
开发者ID:Vinna,项目名称:aura,代码行数:28,代码来源:Refining.cs

示例6: EnterDynamicRegion

		/// <summary>
		/// Sends EnterDynamicRegion to creature's client.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="warpFromRegionId"></param>
		/// <param name="warpToRegion"></param>
		public static void EnterDynamicRegion(Creature creature, int warpFromRegionId, Region warpToRegion, int x, int y)
		{
			var warpTo = warpToRegion as DynamicRegion;
			if (warpTo == null)
				throw new ArgumentException("EnterDynamicRegion requires a dynamic region.");

			var pos = creature.GetPosition();

			var packet = new Packet(Op.EnterDynamicRegion, MabiId.Broadcast);
			packet.PutLong(creature.EntityId);
			packet.PutInt(warpFromRegionId); // creature's current region or 0?

			packet.PutInt(warpToRegion.Id);
			packet.PutString(warpToRegion.Name); // dynamic region name
			packet.PutUInt(0x80000000); // bitmask? (|1 = time difference?)
			packet.PutInt(warpTo.BaseId);
			packet.PutString(warpTo.BaseName);
			packet.PutInt(200); // 100|200 (100 changes the lighting?)
			packet.PutByte(0); // 1 = next is empty?
			packet.PutString("data/world/{0}/{1}", warpTo.BaseName, warpTo.Variation);

			packet.PutByte(0);
			//if (^ true)
			//{
			//	pp.PutByte(1);
			//	pp.PutInt(3100); // some region id?
			//}
			packet.PutInt(x); // target x pos
			packet.PutInt(y); // target y pos

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

示例7: Use

		/// <summary>
		/// Uses skill, the actual usage is in Complete.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public void Use(Creature creature, Skill skill, Packet packet)
		{
			var location = packet.GetLong();
			var unkInt1 = packet.GetInt();
			var unkInt2 = packet.GetInt();

			var areaPosition = new Position(location);

			// Check range
			if (!creature.GetPosition().InRange(areaPosition, Range))
			{
				this.Cancel(creature, skill);
				Send.SkillUseSilentCancel(creature);
				Send.Notice(creature, Localization.Get("Out of range."));
				return;
			}

			// Reduce Dice
			if (creature.Inventory.RightHand != null)
				creature.Inventory.Decrement(creature.Inventory.RightHand);

			var number = (byte)(RandomProvider.Get().Next(6));

			Send.UseMotion(creature, 27, 2, false, false);
			Send.Effect(creature, Effect.Dice, 0, "process", location, number); // [200200, NA233 (2016-08-12)] New 0 int after effect id
			Send.SkillUse(creature, skill.Info.Id, location, unkInt1, unkInt2);

			skill.Stacks = 0;
		}
开发者ID:aura-project,项目名称:aura,代码行数:35,代码来源:DiceTossing.cs

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

示例9: Use

		/// <summary>
		/// Uses skill, the actual usage is in Complete.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public void Use(Creature creature, Skill skill, Packet packet)
		{
			var location = packet.GetLong();
			var unkInt1 = packet.GetInt();
			var unkInt2 = packet.GetInt();

			var areaPosition = new Position(location);

			// Check range
			if (!creature.GetPosition().InRange(areaPosition, Range))
			{
				this.Cancel(creature, skill);
				Send.SkillUseSilentCancel(creature);
				Send.Notice(creature, Localization.Get("Out of range."));
				return;
			}

			// Reduce Dice
			if (creature.Inventory.RightHand != null)
				creature.Inventory.Decrement(creature.Inventory.RightHand);

			Send.UseMotion(creature, 27, 2, false, false);
			Send.Effect(creature, Effect.Dice, "process", location, (byte)3);
			Send.SkillUse(creature, skill.Info.Id, location, unkInt1, unkInt2);

			skill.Stacks = 0;
		}
开发者ID:tkiapril,项目名称:aura,代码行数:33,代码来源:DiceTossing.cs

示例10: Prepare

		public bool Prepare(Creature creature, Skill skill, Packet packet)
		{
			var unkStr = packet.GetString();

			// Get all items on floor and remove those that are within skill range
			var items = creature.Region.GetAllItems();
			foreach (var item in items.Where(a => a.GetPosition().InRange(creature.GetPosition(), (int)skill.RankData.Var1)))
				creature.Region.RemoveItem(item);

			return false; // Silent cancel
		}
开发者ID:tkiapril,项目名称:aura,代码行数:11,代码来源:AdministrativePicking2.cs

示例11: HittingProp

		/// <summary>
		/// Broadcasts HittingProp in range of creature.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="propEntityId"></param>
		/// <param name="stunTime"></param>
		public static void HittingProp(Creature creature, long propEntityId, int stunTime)
		{
			var pos = creature.GetPosition();

			var packet = new Packet(Op.HittingProp, creature.EntityId);
			packet.PutLong(propEntityId);
			packet.PutInt(stunTime);
			packet.PutFloat(pos.X);
			packet.PutFloat(pos.Y);

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

示例12: Ready

		/// <summary>
		/// Readies skill, activates fire effect.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		/// <returns></returns>
		public bool Ready(Creature creature, Skill skill, Packet packet)
		{
			creature.Temp.FireArrow = creature.Region.GetProps(a => a.Info.Id == 203 && a.GetPosition().InRange(creature.GetPosition(), 500)).Count > 0;
			if (creature.Temp.FireArrow)
				Send.Effect(creature, Effect.FireArrow, true);

			Send.SkillReady(creature, skill.Info.Id);

			creature.Lock(Locks.Run);

			return true;
		}
开发者ID:NegativeJ,项目名称:aura,代码行数:19,代码来源:MagnumShot.cs

示例13: EnterRegion

		/// <summary>
		/// Sends EnterRegion to creature's client.
		/// </summary>
		/// <param name="creature"></param>
		public static void EnterRegion(Creature creature, int regionId, int x, int y)
		{
			var pos = creature.GetPosition();

			var packet = new Packet(Op.EnterRegion, MabiId.Channel);
			packet.PutLong(creature.EntityId);
			packet.PutByte(true); // success?
			packet.PutInt(regionId);
			packet.PutInt(x);
			packet.PutInt(y);

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

示例14: AddPartyMember

		/// <summary>
		/// Adds the referred creature's data to the referenced packet.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="packet"></param>
		public static void AddPartyMember(this Packet packet, Creature creature)
		{
			var loc = creature.GetPosition();

			packet.PutInt(creature.PartyPosition);
			packet.PutLong(creature.EntityId);
			packet.PutString(creature.Name);
			packet.PutByte(1);
			packet.PutInt(creature.Region.Id);
			packet.PutInt(loc.X);
			packet.PutInt(loc.Y);
			packet.PutByte(0);
			packet.PutInt((int)((creature.Life * 100) / creature.LifeMax));
			packet.PutInt((int)100);
		}
开发者ID:tkiapril,项目名称:aura,代码行数:20,代码来源:PartyHelper.cs

示例15: Complete

		/// <summary>
		/// Completes skill, teleporting behind target.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public void Complete(Creature creature, Skill skill, Packet packet)
		{
			var target = creature.Target;
			if (target != null)
			{
				var pos = creature.GetPosition();
				var targetPos = target.GetPosition();
				var telePos = pos.GetRelative(targetPos, DistanceToTarget);

				Send.Effect(creature, Effect.SilentMoveTeleport, (byte)2, telePos.X, telePos.Y);
				creature.Warp(creature.RegionId, telePos);
			}

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


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