• Visit Rebornbuddy
  • Pulsing Plugins with "Picker"

    Discussion in 'Archives' started by Jon310, Oct 31, 2013.

    1. Jon310

      Jon310 Member

      Joined:
      Jan 15, 2010
      Messages:
      368
      Likes Received:
      8
      Trophy Points:
      18
      Is there any way to get the "Picker" bot to pulse the plugins while it is running? I've looked over all the settings and even looked for the picker botbase, but seeing as its an internal bot, I didn't have any luck. I'd like to request at least an option to pulse plugins be added.

      That way I can get it to level gems and use pots (via plugins) when I feel like doing some things by hand.

      Thanks in advance,
      - Jon
       
    2. vwest877

      vwest877 New Member

      Joined:
      Jan 15, 2010
      Messages:
      254
      Likes Received:
      0
      Trophy Points:
      0
      What exactly IS the picker bot? And the other one thats there? I never saw any documentation regarding them, I thought maybe they were just in testing phases.
       
    3. pushedx

      pushedx Moderator Moderator Buddy Core Dev

      Joined:
      Sep 24, 2013
      Messages:
      4,252
      Likes Received:
      290
      Trophy Points:
      83
      Yes, it's possible.

      At the bottom of the class, there's a field called PulseFlags:
      Code:
      /// <summary>Which items to pulse when this bot runs.</summary>
              public PulseFlags PulseFlags
              {
                  get
                  {
                      // Bot "Pulse" event
                      // GameEvents need to be pulsed (for area changes)
                      // Entities (obviously)
                      // Do NOT need loot targeting.
                      // However, so we can enable monsters when using the map visualizer, we'll include it.
                      return PulseFlags.Bot | PulseFlags.GameEvents | PulseFlags.Entities | PulseFlags.Targeting;
                  }
              }
      
      Simply make that line:

      Code:
      return PulseFlags.Bot | PulseFlags.GameEvents | PulseFlags.Entities | PulseFlags.Plugins;
      
      and that bot will now Pulse pluigins.

      However, keep in mind that if the plugins use anything that is not being pulsed, it won't work out right. You might want to simply use

      Code:
      return PulseFlags.All;
      
      instead, but also keep in mind that if the plugin is using Grind Bot related stuff in another bot, then it probably won't work right at all.
       
    4. Jon310

      Jon310 Member

      Joined:
      Jan 15, 2010
      Messages:
      368
      Likes Received:
      8
      Trophy Points:
      18
      I appreciate the response. I have a question though. Where did you find the class file for the picker bot. The only botbase that I have in my bot folder is the InventoryStashBot.

      [edit]

      Was able to find it in the exe file. Thanks for the help, hopefully I can get this working.
       
    5. WhereIsMyMind

      WhereIsMyMind Member

      Joined:
      Oct 12, 2013
      Messages:
      848
      Likes Received:
      5
      Trophy Points:
      18
      I presume that it the part of the greater EB bot that picks up items. It fits the context of the OPs request, where they want the picker bot to pulse (triggers, fires, does its thing) along with the potsplugin (bot).

      Then in the code examples given by pushedx, the PulseFlags.Targeting; is replaced with PulseFlags.Plugins; I, again, presume, this forces EB to not take total control, since it no longer is targetting, but still allows the bot to trigger pot usage and, as OP requested, the gem upgrade plugin.

      WIMM
       
    6. Jon310

      Jon310 Member

      Joined:
      Jan 15, 2010
      Messages:
      368
      Likes Received:
      8
      Trophy Points:
      18
      I could be mistaken as well, but from the other code in the picker bot it looks to still need targeting for the loot options. Using PulseFlags.All worked out great.
      Code:
      Targeting.Loot.Targets
      The total control that EB takes looks to be from this section here:
      Code:
          /// <summary>    
          /// Whether or not this bot requires game input to happen. (This determines whether or not certain memory patches are done or not)
          /// 
          /// </summary>
          /// This bot doesn't need game input, since we'll be using raw interacts, that don't require the mouse hooks to work
          public bool RequiresGameInput
          {
            get
            {
              return false;
            }
          }
      On the plus side I have the plugins pulsing and the loot pickup working. I just need to get my pot using plugin and I'll be there. Thank you for all the help everyone.
       
    7. Apoc

      Apoc Moderator Staff Member Moderator

      Joined:
      Jan 16, 2010
      Messages:
      2,790
      Likes Received:
      94
      Trophy Points:
      48
      Currently, Picker is built into EB. The following is the source (I'll just have it packaged as an external bot in the next release, it's quite simple)

      Code:
      using System;using System.Linq;
      using System.Windows;
      
      
      using log4net;
      
      
      using Loki.Game;
      using Loki.Game.Objects;
      using Loki.TreeSharp;
      using Loki.Utilities;
      
      
      using Action = Loki.TreeSharp.Action;
      
      
      namespace Loki.Bot.Logic.Bots.Picker
      {
          /// <summary>
          /// A simple bot to pick up items matching your loot filter, as you walk over them.
          /// </summary>
          public class PickerBot : IBot
          {
              private static readonly ILog Log = Logger.GetLoggerInstanceForType();
              private readonly WaitTimer _pickupTimer = new WaitTimer(TimeSpan.FromMilliseconds(100));
              private int _originalTps;
      
      
              /// <summary>
              ///     Whether or not this bot requires game input to happen. (This determines whether or not certain memory patches are
              ///     done or not)
              /// </summary>
              /// This bot doesn't need game input, since we'll be using raw interacts, that don't require the mouse hooks to work
              public bool RequiresGameInput { get { return false; } }
      
      
              /// <summary> Gets the name of this bot. </summary>
              public string Name { get { return "Picker"; } }
      
      
              /// <summary> Gets the description of this bot. </summary>
              public string Description { get { return "A simple bot to pick up items matching your loot filter, as you walk over them!"; } }
      
      
              /// <summary> Gets the configuration window for this bot. </summary>
              public Window ConfigWindow { get { return null; } }
      
      
              /// <summary> Starts this bot. Do any initialization here. </summary>
              public void Start()
              {
                  if (Logic == null)
                  {
                      Logic = new PrioritySelector(
                          // Only run every so often, regardless of bot tick speed.
                          // This is set at 100ms (10x per second)
                          // And we're only going to be picking up items on the ground, within 5 cells (inside the "no click" dead-zone of the character)
                          new Decorator(ret => _pickupTimer.IsFinished && Targeting.Loot.Targets.Where(o => o is WorldItem).OrderBy(t => t.Distance).Count(d => d.Distance <= 5) > 0,
                              new Action(ret =>
                              {
                                  PoEObject item = Targeting.Loot.Targets.OfType<WorldItem>().OrderBy(t => t.Distance).FirstOrDefault();
      
      
                                  // Ensure we can actually pick the item up, and fit it in our inventory.
                                  // TODO: Might be worth spitting out a message that our inventory is full.
                                  if (item != null && LokiPoe.Me.Inventory.Main.CanFitItem((item as WorldItem).Item))
                                  {
                                      Log.Info("Picking up " + item.Name);
                                      item.InteractRaw(Input.ActionFlags.AutoEquip);
                                      _pickupTimer.Reset();
                                  }
                              }))
                          );
                  }
      
      
                  _originalTps = BotMain.TicksPerSecond;
                  // We don't need this running very often. 10 per sec is PLENTY.
                  BotMain.TicksPerSecond = 10;
              }
      
      
              /// <summary> Stops this bot. Do any pre-dispose cleanup here. </summary>
              public void Stop()
              {
                  // Ensure we reset this to the original TPS.
                  BotMain.TicksPerSecond = _originalTps;
              }
      
      
              /// <summary> Gets the logic for this bot. </summary>
              public Composite Logic { get; private set; }
      
      
              /// <summary>Which items to pulse when this bot runs.</summary>
              public PulseFlags PulseFlags
              {
                  get
                  {
                      // Bot "Pulse", "Start", and "Stop" events
                      // GameEvents need to be pulsed (for area changes)
                      // Entities (obviously)
                      // NEED loot targeting (for it to decide, based on filters, what items to pick up)
                      // We also want to enable targeting for monsters in the map visualizer, so targeting gets included as well.
                      // Note: Plugins are not enabled, as we do not really want them running. Optionally, auto-flasks can be enabled via a plugin
                      // in which case, the user can just add | PulseFlags.Plugins.
                      return PulseFlags.Bot | PulseFlags.GameEvents | PulseFlags.Entities | PulseFlags.Targeting;
                  }
              }
      
      
              /// <summary> Pulses the bot. Do any update logic here. </summary>
              public void Pulse()
              {
              }
      
      
              /// <summary>
              ///     Returns a <see cref="T:System.String" /> that represents the current <see cref="T:System.Object" />.
              /// </summary>
              /// <returns>
              ///     A <see cref="T:System.String" /> that represents the current <see cref="T:System.Object" />.
              /// </returns>
              public override string ToString()
              {
                  return Name;
              }
      
      
              /// <summary>
              ///     Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
              /// </summary>
              public void Dispose()
              {
              }
          }
      }
       
    8. Arden

      Arden Member

      Joined:
      Jun 20, 2012
      Messages:
      114
      Likes Received:
      0
      Trophy Points:
      16
      So is it possible currently to have EB fight, use pots and loot but the player still retains control of movement out of combat?
      I loved using DB as a Combat Bot, would like to do the same with EB as well.
       

    Share This Page