Aura.Channel.Skills.Life.Gathering.Prepare C# (CSharp) Метод

Prepare() публичный Метод

Prepares skill, skips right to used.
Doesn't check anything, like what you can gather with what, because at this point there's no chance for abuse.
public Prepare ( Creature creature, Skill skill, Aura.Shared.Network.Packet packet ) : bool
creature Aura.Channel.World.Entities.Creature
skill Skill
packet Aura.Shared.Network.Packet
Результат bool
		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;
		}