/// <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;
}