• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • [Plugin] InstantCurrencyPickup

    Discussion in 'Archives' started by flexus, Nov 9, 2013.

    1. flexus

      flexus Community Developer

      Joined:
      Jun 13, 2012
      Messages:
      95
      Likes Received:
      1
      Trophy Points:
      8
    2. Razerface

      Razerface New Member

      Joined:
      Oct 29, 2013
      Messages:
      12
      Likes Received:
      0
      Trophy Points:
      0
    3. flexus

      flexus Community Developer

      Joined:
      Jun 13, 2012
      Messages:
      95
      Likes Received:
      1
      Trophy Points:
      8
      You're welcome :)
       
    4. flexus

      flexus Community Developer

      Joined:
      Jun 13, 2012
      Messages:
      95
      Likes Received:
      1
      Trophy Points:
      8
      updated and fixed a bug where he would spam the debug
       
    5. Arden

      Arden Member

      Joined:
      Jun 20, 2012
      Messages:
      114
      Likes Received:
      0
      Trophy Points:
      16
      This is awesome Flexus, thank you.
      Any way we could get a second plugin to pick up all uniques in the same manner?

      I took a look at the plugin and realized it appears very simple to change it to pick up Uniques so I edited the plugin. Seems to be working as far as I can tell.

      View attachment InstantUniquesPickup.zip

      Flexus, please feel free to make the necessary changes to your own plugin for this functionality, if you want.
       
    6. flexus

      flexus Community Developer

      Joined:
      Jun 13, 2012
      Messages:
      95
      Likes Received:
      1
      Trophy Points:
      8
      Yep it is really simple.
      I will edit mine and add more things so you can configure it.
      Will probably upload it in a few hours I'm at work now :)

      Sent from my GT-I9100 using TheBuddyForum mobile app
       
    7. Bossqwerty

      Bossqwerty New Member

      Joined:
      Jan 15, 2010
      Messages:
      85
      Likes Received:
      0
      Trophy Points:
      0
      If you guys could make it so this applies to ALL items that pass your filter, even chests. I think I'd be in love.
       
    8. flexus

      flexus Community Developer

      Joined:
      Jun 13, 2012
      Messages:
      95
      Likes Received:
      1
      Trophy Points:
      8
      If you do it with everything you'll getting problems.
      I've tried it with a few things and sometimes the char stucks. I won't recommend to do that!

      Sent from my GT-I9100 using TheBuddyForum mobile app
       
    9. AlfredoSauce

      AlfredoSauce New Member

      Joined:
      Nov 6, 2013
      Messages:
      63
      Likes Received:
      1
      Trophy Points:
      0
      Awesome, TY! Can't wait to use it.
       
    10. SHJordan

      SHJordan Member

      Joined:
      Oct 20, 2012
      Messages:
      636
      Likes Received:
      1
      Trophy Points:
      18
      Any chance to add rares as well?
       
    11. voidstack

      voidstack New Member

      Joined:
      Nov 19, 2013
      Messages:
      1
      Likes Received:
      0
      Trophy Points:
      0
      I modified this wonderful plugin for myself a couple of days ago, might as well share it. This is still flexus code, I take no credit for it since all I did was change "currency" to "rare" in a few places.
      (flexus just let me know if you wan't me to remove this)


      //void

      Modified InstantCurrencyPickup.cs:
      Code:
      using System;
      using System.Collections.Generic;
      using System.Globalization;
      using System.Linq;
      using System.Text;
      
      using log4net;
      
      using Loki.Bot;
      using Loki.Game;
      using Loki.Game.Objects;
      using Loki.TreeSharp;
      using Loki.Utilities;
      using Loki.Utilities.Plugins;
      using Loki.Game.Objects.Items;
      
      using Action = Loki.TreeSharp.Action;
      
      namespace BotGui.Plugins
      {
          public class InstantCurrencyPickup : IPlugin
          {
              #region Implementation of IEquatable<IPlugin>
      
              /// <summary>
              ///     Indicates whether the current object is equal to another object of the same type.
              /// </summary>
              /// <returns>
              ///     true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.
              /// </returns>
              /// <param name="other">An object to compare with this object.</param>
              public bool Equals(IPlugin other)
              {
                  return Name.Equals(other.Name);
              }
      
              #endregion
      
              #region Implementation of IPlugin
      
              public string Author { get { return "flexus"; } }
              public Version Version { get { return new Version(0, 1, 0, 3); } }
              public string Name { get { return "InstantCurrencyPickup"; } }
              public string Description { get { return "Pickup Currency & Rare immediately after finished fight with the actual mob"; } }
      
              public void OnInitialize() { }
              public void OnStop() { }
              public void OnShutdown() { }
              public void OnEnabled() { }
              public void OnDisabled() { }
              public void OnConfig() { }
              public void OnStart()
              {
                  GlobalSettings globalSettings = new GlobalSettings();
                  globalSettings.ReloadPluginsOnFileChange = true;
                  Log.Debug("ReloadPluginOnFileChange: " + globalSettings.ReloadPluginsOnFileChange);
              }
      
              #endregion
      
              private static readonly ILog Log = Logger.GetLoggerInstanceForType();
              private int currencyId = 0;
      		private int rareId = 0;
      
              private void PickUpCurrency()
              {
                  if (Targeting.Loot.Targets.OfType<WorldItem>().Where(a => a.Item.Rarity.ToString() == "Currency").OrderBy(t => t.Distance).Count(d => d.Distance <= 20) > 0)
                  {
                      PoEObject currency = Targeting.Loot.Targets.OfType<WorldItem>().Where(a => a.Item.Rarity.ToString() == "Currency").OrderBy(t => t.Distance).FirstOrDefault();
      
                      if (currency != null && LokiPoe.Me.Inventory.Main.CanFitItem((currency as WorldItem).Item))
                      {
                          if (currencyId != currency.ID)
                          {
                              currencyId = currency.ID;
                              Log.Info("InstantCurrencyPickup: " + currency.Name);
                          }
                          currency.InteractRaw(Input.ActionFlags.AutoEquip);
                      }
                  }
              }
      		
      		private void PickUpRare()
              {
                  if (Targeting.Loot.Targets.OfType<WorldItem>().Where(a => a.Item.Rarity.ToString() == "Rare").OrderBy(t => t.Distance).Count(d => d.Distance <= 20) > 0)
                  {
                      PoEObject rare = Targeting.Loot.Targets.OfType<WorldItem>().Where(a => a.Item.Rarity.ToString() == "Rare").OrderBy(t => t.Distance).FirstOrDefault();
      
                      if (rare != null && LokiPoe.Me.Inventory.Main.CanFitItem((rare as WorldItem).Item))
                      {
                          if (rareId != rare.ID)
                          {
                              rareId = rare.ID;
                              Log.Info("InstantRarePickup: " + rare.Name);
                          }
                          rare.InteractRaw(Input.ActionFlags.AutoEquip);
                      }
                  }
              }
      
              public void OnPulse()
              {
                  PickUpCurrency();
      			PickUpRare();
              }
          }
      }
      

      InstantRarePickup.cs:
      Code:
      using System;
      using System.Collections.Generic;
      using System.Globalization;
      using System.Linq;
      using System.Text;
      
      using log4net;
      
      using Loki.Bot;
      using Loki.Game;
      using Loki.Game.Objects;
      using Loki.TreeSharp;
      using Loki.Utilities;
      using Loki.Utilities.Plugins;
      using Loki.Game.Objects.Items;
      
      using Action = Loki.TreeSharp.Action;
      
      namespace BotGui.Plugins
      {
          public class InstantRarePickup : IPlugin
          {
              #region Implementation of IEquatable<IPlugin>
      
              /// <summary>
              ///     Indicates whether the current object is equal to another object of the same type.
              /// </summary>
              /// <returns>
              ///     true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.
              /// </returns>
              /// <param name="other">An object to compare with this object.</param>
              public bool Equals(IPlugin other)
              {
                  return Name.Equals(other.Name);
              }
      
              #endregion
      
              #region Implementation of IPlugin
      
              public string Author { get { return "flexus"; } }
              public Version Version { get { return new Version(0, 1, 0, 3); } }
              public string Name { get { return "InstantRarePickup"; } }
              public string Description { get { return "Pickup Rare immediately after finished fight with the actual mob"; } }
      
              public void OnInitialize() { }
              public void OnStop() { }
              public void OnShutdown() { }
              public void OnEnabled() { }
              public void OnDisabled() { }
              public void OnConfig() { }
              public void OnStart()
              {
                  GlobalSettings globalSettings = new GlobalSettings();
                  globalSettings.ReloadPluginsOnFileChange = true;
                  Log.Debug("ReloadPluginOnFileChange: " + globalSettings.ReloadPluginsOnFileChange);
              }
      
              #endregion
      
              private static readonly ILog Log = Logger.GetLoggerInstanceForType();
      		private int rareId = 0;
      		
      		private void PickUpRare()
              {
                  if (Targeting.Loot.Targets.OfType<WorldItem>().Where(a => a.Item.Rarity.ToString() == "Rare").OrderBy(t => t.Distance).Count(d => d.Distance <= 20) > 0)
                  {
                      PoEObject rare = Targeting.Loot.Targets.OfType<WorldItem>().Where(a => a.Item.Rarity.ToString() == "Rare").OrderBy(t => t.Distance).FirstOrDefault();
      
                      if (rare != null && LokiPoe.Me.Inventory.Main.CanFitItem((rare as WorldItem).Item))
                      {
                          if (rareId != rare.ID)
                          {
                              rareId = rare.ID;
                              Log.Info("InstantRarePickup: " + rare.Name);
                          }
                          rare.InteractRaw(Input.ActionFlags.AutoEquip);
                      }
                  }
              }
      
              public void OnPulse()
              {
      			PickUpRare();
              }
          }
      }
      
       
    12. flexus

      flexus Community Developer

      Joined:
      Jun 13, 2012
      Messages:
      95
      Likes Received:
      1
      Trophy Points:
      8
      Hey no problem, i made an update to mine also, made the plugin faster and less cpu consuming.
      i will add rare items too :)
       

    Share This Page