Beispiel #1
0
        private void onLaunched(object sender, GameLaunchedEventArgs e)
        {
            this.config = this.Helper.ReadConfig <ModConfig>();

            LogProxy.SetDebug(this.config.DebugEnvironment);
            LogProxy.SetMonitor(this.Monitor);
        }
Beispiel #2
0
        public IAction GetNextAction()
        {
            // If all actions are complete, retrieve new
            if (this._beforeEachQueue.Count == 0 && this._afterEachQueue.Count == 0 && this._atLocationStartQueue.Count == 0)
            {
                this.RetrieveAtLocationStartAction();
            }

            // Retrieve new BeforeEach and AfterEach if necessary
            if (this._lastCallOrderType == CallOrder.AtLocationStart)
            {
                this._lastCallOrderType = CallOrder.AfterEach;
                this.RetrieveAfterEachActions();
            }
            if (this._lastCallOrderType == CallOrder.AfterEach && this._afterEachQueue.Count == 0)
            {
                this._lastCallOrderType = CallOrder.BeforeEach;
                this.RetrieveBeforeEachActions();
            }

            // If BeforeEach or AfterEach in queue, return dequeue.
            if (this._afterEachQueue.Count > 0)
            {
                LogProxy.Log("Brain.GetNextAction: Dequeued Action of type CallOrder.AfterEach.", true);
                this._lastCallOrderType = CallOrder.AfterEach;

                return(this._afterEachQueue.Dequeue());
            }
            else if (this._beforeEachQueue.Count > 0)
            {
                LogProxy.Log("Brain.GetNextAction: Dequeued Action of type CallOrder.BeforeEach.", true);
                this._lastCallOrderType = CallOrder.BeforeEach;

                return(this._beforeEachQueue.Dequeue());
            }

            // If items are in the AtLocationStart queue
            if (this._atLocationStartQueue.Count > 0)
            {
                LogProxy.Log("Brain.GetNextAction: Dequeued Action of type CallOrder.AtLocationStart.", true);
                this._lastCallOrderType = CallOrder.AtLocationStart;

                return(this._atLocationStartQueue.Dequeue());
            }

            // Bot is finished
            return(null);
        }
Beispiel #3
0
        /// <summary>
        /// Begins the Bot process (trigger).
        /// </summary>
        public void Start()
        {
            if (!this._targetsSet)
            {
                this.DefaultTargets();
            }
            if (!this._locationsSet)
            {
                this.DefaultLocations();
            }

            LogProxy.Info("Bot has been triggered to start");
            this.StartCallback();
            this._active = true;

            this._brain.Start(this._character.GetCurrentLocation());

            IAction action = this._brain.GetNextAction();

            LogProxy.Trace($"{action.ToString()}");
        }
Beispiel #4
0
 public void action(Character who, GameLocation where, Tile what)
 {
     LogProxy.Log("Action thing happened");
 }
Beispiel #5
0
 /// <summary>
 /// Run at the end of the process, optional override
 /// </summary>
 protected virtual void FinishCallback()
 {
     LogProxy.Trace("Bot.FinishCallback called with no override");
 }
Beispiel #6
0
 /// <summary>
 /// Run at the end of the process, optional override
 /// </summary>
 protected virtual void InterruptedCallback()
 {
     LogProxy.Trace("Bot.InterruptedCallback called with no override");
 }
Beispiel #7
0
 /// <summary>
 /// Run at the start of the process, optional override
 /// </summary>
 protected virtual void StartCallback()
 {
     LogProxy.Trace("Bot.StartCallback called with no override");
 }