Ejemplo n.º 1
0
        /// <summary>
        ///     Starts the Gather routine
        /// </summary>
        /// <param name="params">RessourceList</param>
        /// <param name="autoGather">true if autogathering</param>
        public void Gather(List <int> @params, bool autoGather)
        {/* This function will be responsible for moving close to the element and harvesting if possible.
          * Loop thru the items to harvest to check weather that ressource id is present on the items and if it's harvestable.*/
            //Starting getting which element is closer to our bot
            IUsableElement element = GetClosestHarvestable(@params);

            if (element != null)
            {
                Logger.Default.Log($"Element Found. Moving to [{element.CellId}]", API.Utils.Enums.LogMessageType.Arena);
                uint          id = element.Element.Id;
                var           skillInstanceUid = element.Skills[0].SkillInstanceUid;
                ICellMovement move             = _account.Character.Map.MoveToElement(id, 1);
                if (move == null)
                {
                    move = _account.Character.Map.MoveToElement(id, 2);
                }
                move.MovementFinished += (movement, message) =>
                {
                    Logger.Default.Log($"Movement perfomed. Status[{message.Sucess}]", API.Utils.Enums.LogMessageType.Arena);
                    if (message.Sucess)
                    {
                        MovementAutoReset.Set();
                    }
                };
                move.PerformMovement();
                if (MovementAutoReset.WaitOne(Delay)) //Wait for the movement delay.
                {
                    Logger.Default.Log($"Farming the ressource.", API.Utils.Enums.LogMessageType.Arena);
                    _account.Character.Map.UseElement((int)id, skillInstanceUid); //server will reply with InteractiveUsedMessage then once done InteractiveElementUpdatedMessage
                    if (InteractiveUsedAutoReset.WaitOne(Delay))                  // if this returns true we execute Gather. else return;
                    {
                        if (_account.Character.PathManager.Launched)
                        {
                            _account.Character.PathManager.GatherManagerDoActionByPass();
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private void HandleObtainedItemWithBonusMessage(IAccount account, ObtainedItemWithBonusMessage message)
 {
     Task.Delay(250).Wait();
     InteractiveUsedAutoReset.Set();
 }