• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • AutoFlask 2.0

    Discussion in 'Archives' started by naut, Oct 12, 2014.

    1. tozededao

      tozededao Community Developer

      Joined:
      Jan 15, 2010
      Messages:
      1,225
      Likes Received:
      5
      Trophy Points:
      38
      I don't know why it isn't working for me, I must be doing something really wrong. I want the bot to use a Ruby Flask when I'm below 89% Life and it never uses them.

      http://i.imgur.com/kXev34e.png

      Autoflask settings
      Code:
      {
        "UseFrozenFlasks": false,
        "UseBleedingFlasks": true,
        "UseShockedFlasks": false,
        "UseBurningFlasks": false,
        "HpFlaskCooldownMs": 250,
        "GraniteFlaskCooldownMs": 5000,
        "JadeFlaskCooldownMs": 5000,
        "DiamondFlaskCooldownMs": 3500,
        "AtziriFlaskCooldownMs": 3500,
        "LaviangasFlaskCooldownMs": 7000,
        "TopazFlaskCooldownMs": 3500,
        "RubyFlaskCooldownMs": 3500,
        "RarityFlaskCooldownMs": 5000,
        "QuicksilverFlaskCooldownMs": 5000,
        "MpFlaskCooldownMs": 250,
        "FrozenFlaskCooldownMs": 250,
        "BleedingFlaskCooldownMs": 250,
        "ShockedFlaskCooldownMs": 250,
        "BurningFlaskCooldownMs": 250,
        "HpFlaskPercentTrigger": 25,
        "RarityFlaskPercentTrigger": 15,
        "QuicksilverFlaskDistanceTrigger": 40,
        "GraniteFlaskHealthPercentTrigger": 75,
        "GraniteFlaskESPercentTrigger": 50,
        "JadeFlaskHealthPercentTrigger": 75,
        "JadeFlaskESPercentTrigger": 50,
        "TopazFlaskHealthPercentTrigger": 75,
        "TopazFlaskESPercentTrigger": 75,
        "RubyFlaskHealthPercentTrigger": 89,
        "RubyFlaskESPercentTrigger": 0,
        "DiamondFlaskPercentTrigger": 90,
        "AtziriFlaskHealthPercentTrigger": 75,
        "AtziriFlaskESPercentTrigger": 50,
        "MpFlaskPercentTrigger": 0,
        "LaviangasFlaskPercentTrigger": 0
      }
      
       
    2. buddyfu

      buddyfu New Member

      Joined:
      Aug 27, 2014
      Messages:
      24
      Likes Received:
      0
      Trophy Points:
      0
      Are you ignited?
      I just read the plugin's code and I see that Ruby Flask will only trigger when the player is ignited.
      If you want to use Ruby Flasks while not ignited, go to the line 230 of AutoFlask.cs (open it in a text editor like Notepad++).

      Replace
      Code:
      	    // Ruby	
                  // Life
                  if (LokiPoe.Me.IsIgnited)
                  {
                      if (LokiPoe.Me.HealthPercent < AutoFlaskSettings.Instance.RubyFlaskHealthPercentTrigger && AutoFlaskSettings.Instance.RubyFlaskHealthPercentTrigger != 0)
      				{
      					if (FlaskHelper(_rubyFlaskCd, AutoFlaskSettings.Instance.RubyFlaskCooldownMs, RubyFlasks))
      					{
      						return;
      					}
      				}
                  }
      
      by
      Code:
      	    // Ruby	
                  // Life
                      if (LokiPoe.Me.HealthPercent < AutoFlaskSettings.Instance.RubyFlaskHealthPercentTrigger && AutoFlaskSettings.Instance.RubyFlaskHealthPercentTrigger != 0)
      				{
      					if (FlaskHelper(_rubyFlaskCd, AutoFlaskSettings.Instance.RubyFlaskCooldownMs, RubyFlasks))
      					{
      						return;
      					}
      				}
      
       
    3. tozededao

      tozededao Community Developer

      Joined:
      Jan 15, 2010
      Messages:
      1,225
      Likes Received:
      5
      Trophy Points:
      38
      You're right I thought AutoFlask used it when below the threshold OR ignited, but its AND, should have gone to sleep long ago, anyway thanks a lot for noticiting and for the edit!!
       
    4. buddyfu

      buddyfu New Member

      Joined:
      Aug 27, 2014
      Messages:
      24
      Likes Received:
      0
      Trophy Points:
      0
      Just for sharing, I find this lifeflask order (line 648 in AutoFlask.cs) to be much more effective than the default one.

      Code:
      public static IEnumerable<Item> LifeFlasks
              {
                  get
                  {
                      var inv = LokiPoe.InGameState.QuickFlaskPanel.Flasks;
                      return from item in inv
                          let flask = item as Flask
                          where flask != null && flask.Rarity != Rarity.Unique && flask.HealthRecover > 0 && flask.CanUse
                          orderby flask.CurrentCharges descending
                          select item;
                  }
              }
      
      I always use the flask with the most charges. It spreads the usage of flasks over all my flasks and gives me much more flask uptime, as all flasks regain charges when monsters die.
       
    5. judge001

      judge001 Member

      Joined:
      Mar 25, 2012
      Messages:
      97
      Likes Received:
      1
      Trophy Points:
      8
      Thank you for sharing this!
       
    6. mrVendetta

      mrVendetta New Member

      Joined:
      Dec 28, 2014
      Messages:
      2
      Likes Received:
      0
      Trophy Points:
      1
      great work!
       
    7. Darox

      Darox Member

      Joined:
      Nov 7, 2014
      Messages:
      353
      Likes Received:
      2
      Trophy Points:
      18

      Thanks I changed mine for the same, This is important for RF builds as the ruby flask gives more life regen than just the health pot :D. One question for this is can you set it so like below 80% use health pot below 70% use ruby/other pot even if a health pot was just used? So you can have both effects at same time. I see the delay but is that between all potions or just that type of potion?

      The like i want a short window between flasks, so its not the exact same time. but a few seconds on those flasks because they last longer.
       
      Last edited: Dec 31, 2014
    8. doomnezau

      doomnezau Member

      Joined:
      Sep 29, 2013
      Messages:
      73
      Likes Received:
      0
      Trophy Points:
      6
      How can i made that when i'm low hp (35%) it uses insta flasks? and never use them before only when is the real need or if others flasks are empty? i run a 3 hp flasks build and 2 of them i plan to be insta at 35% low hp and one to be the normal flask.
       
    9. buddyfu

      buddyfu New Member

      Joined:
      Aug 27, 2014
      Messages:
      24
      Likes Received:
      0
      Trophy Points:
      0
      The plugin should be able to do that by default.

      Replace (line 648 of AutoFlask.cs)
      Code:
      /// <summary>           Life Flasks           </summary>
              public static IEnumerable<Item> LifeFlasks
              {
                  get
                  {
                      var inv = LokiPoe.InGameState.QuickFlaskPanel.Flasks;
                      return from item in inv
                          let flask = item as Flask
                          where flask != null && flask.Rarity != Rarity.Unique && flask.HealthRecover > 0 && flask.CanUse
                          orderby flask.CurrentCharges descending
                          select item;
                  }
              }
      
      by
      Code:
      /// <summary>           Duration Flasks           </summary>
              public static IEnumerable<Item> DurationLifeFlasks
              {
                  get
                  {
                      var inv = LokiPoe.InGameState.QuickFlaskPanel.Flasks;
                      return from item in inv
                             let flask = item as Flask
                             where flask != null && flask.Rarity != Rarity.Unique && flask.HealthRecover > 0 && flask.CanUse && !flask.IsInstantRecovery
                             orderby flask.CurrentCharges descending
                             select item;
                  }
              }
      
              /// <summary>           Instant Flasks           </summary>
              public static IEnumerable<Item> InstantLifeFlasks
              {
                  get
                  {
                      var inv = LokiPoe.InGameState.QuickFlaskPanel.Flasks;
                      return from item in inv
                             let flask = item as Flask
                             where flask != null && flask.Rarity != Rarity.Unique && flask.HealthRecover > 0 && flask.CanUse && flask.IsInstantRecovery
                             orderby flask.CurrentCharges descending
                             select item;
                  }
              }
      
      And also replace (line 114 of AutoFlask.cs)
      Code:
      // Life
                  if (LokiPoe.Me.HealthPercent < AutoFlaskSettings.Instance.HpFlaskPercentTrigger &&
                      !LokiPoe.Me.IsUsingHealthFlask)
                  {
                      if (FlaskHelper(_lifeFlaskCd, AutoFlaskSettings.Instance.HpFlaskCooldownMs, LifeFlasks))
                      {
                          return;
                      }
                  }
      
      by
      Code:
      // Instant Life
                  if (LokiPoe.Me.HealthPercent < 35)
                  {
                      if (FlaskHelper(_lifeFlaskCd, 200, InstantLifeFlasks))
                      {
                          return;
                      }
                  }
      
                  // Duration Life
                  if (LokiPoe.Me.HealthPercent < AutoFlaskSettings.Instance.HpFlaskPercentTrigger &&
                      !LokiPoe.Me.IsUsingHealthFlask)
                  {
                      if (FlaskHelper(_lifeFlaskCd, AutoFlaskSettings.Instance.HpFlaskCooldownMs, DurationLifeFlasks))
                      {
                          return;
                      }
                  }
      
      I hardcoded it so that it uses instant flasks when the HP is below 35% and it uses them at 200ms intervals. If you want to change those values, you need to do it directly in the code. The UI settings will only work for flasks with a duration.
       
    10. doomnezau

      doomnezau Member

      Joined:
      Sep 29, 2013
      Messages:
      73
      Likes Received:
      0
      Trophy Points:
      6
      Thank you !!
       
    11. chlopiec

      chlopiec Member

      Joined:
      Jun 29, 2014
      Messages:
      60
      Likes Received:
      1
      Trophy Points:
      6
      Nevermind.....
       
    12. toNyx

      toNyx Well-Known Member

      Joined:
      Oct 29, 2011
      Messages:
      3,770
      Likes Received:
      35
      Trophy Points:
      48
      I still think IsIgnited shouldn't be the upperpriority bracket in the conditions. something is terribly wrong in the setup.

      If someone is interested in a deeper logic setup and wanna help naut modify it/configure it, I'll just LEAVE THIS HERE

      I'm too lazy to modify it for the new builds. I made an advanced flask user months ago, It was way more understandable/customizable than this one tho.

      Well, have fun ;) If I find the motivation to do it, I may take the time to port it in the new build.

      I hate using WPF integration as it is now, that's probably why I didn't migrate it already. xD
       
    13. spliffermaster

      spliffermaster Community Developer

      Joined:
      Mar 10, 2014
      Messages:
      56
      Likes Received:
      2
      Trophy Points:
      8
      RarityFlask improvement

      Someone asked for Rarity Flask support for all monster by rarity.

      I change the following lines

      Code:
      // Rarity
      			var Piety = LokiPoe.ObjectManager.GetObjectByName<Monster>("Piety");
                  var Doms = LokiPoe.ObjectManager.GetObjectByName<Monster>("Dominus, Ascendant");	
      			var Dom = LokiPoe.ObjectManager.GetObjectByName<Monster>("Dominus, High Templar");
                  if (Piety != null)
      				{
      					if (!Piety.IsDead && (Piety.HealthPercent < AutoFlaskSettings.Instance.RarityFlaskPercentTrigger))
      					{
      						if (FlaskHelper(_rarityFlaskCd, AutoFlaskSettings.Instance.RarityFlaskCooldownMs, RarityFlasks))
      						{
      							// ReSharper disable once RedundantJumpStatement
      							return;
      						}
      					}
      				}
      			if (Doms != null)
      				{
      					if (!Doms.IsDead && (Doms.HealthPercent < AutoFlaskSettings.Instance.RarityFlaskPercentTrigger))
      					{
      						if (FlaskHelper(_rarityFlaskCd, AutoFlaskSettings.Instance.RarityFlaskCooldownMs, RarityFlasks))
      						{
      							// ReSharper disable once RedundantJumpStatement
      							return;
      						}
      					}
      				}	
      
      to

      Code:
      	// Rarity
                  var CullableMonsters = LokiPoe.ObjectManager.GetObjectsByType<Monster>()
                                          .Where(
                                                  m =>
                                                      m.IsHostile && // hostile monster
                                                      !m.IsDead && // not dead
                                                      m.Rarity == Rarity.Unique && // rarity of the monster
                                                      m.HealthPercent < AutoFlaskSettings.Instance.RarityFlaskPercentTrigger &&
                                                      ExilePather.PathDistance(LokiPoe.Me.Position, m.Position) < 30); // path distance
      
                  if (CullableMonsters.Any())
                  {
                      if (FlaskHelper(_rarityFlaskCd, AutoFlaskSettings.Instance.RarityFlaskCooldownMs, RarityFlasks))
                      {
                          foreach (Monster m in CullableMonsters)
                          {
                              Log.WarnFormat("[AutFlask] Found cullable monster {0} with {1} percent of health and {2} away",
                                  m.Name, m.HealthPercent, m.Distance);
                          }
                          return;
                      }
                  }
      
                  var Piety = LokiPoe.ObjectManager.GetObjectByName<Monster>("Piety");
                  var Doms = LokiPoe.ObjectManager.GetObjectByName<Monster>("Dominus, Ascendant");	
                  var Dom = LokiPoe.ObjectManager.GetObjectByName<Monster>("Dominus, High Templar");
      
      also set the mana and life flask to ignore the "Divination Distillate" flask by setting the query right

      for mana flask
      Code:
      /// <summary>           Mana Flasks           </summary>
              public static IEnumerable<Item> ManaFlasks
              {
                  get
                  {
                      var inv = LokiPoe.InGameState.QuickFlaskPanel.Flasks;
                      return from item in inv
                          let flask = item as Flask
                          where flask != null && flask.Rarity != Rarity.Unique && flask.ManaRecover > 0 && flask.CanUse && flask.FullName != "Divination Distillate"
                          orderby flask.IsInstantRecovery ? flask.ManaRecover : flask.ManaRecoveredPerSecond descending
                          select item;
                  }
              }
      
      and life flask
      Code:
      /// <summary>           Life Flasks           </summary>
              public static IEnumerable<Item> LifeFlasks
              {
                  get
                  {
                      var inv = LokiPoe.InGameState.QuickFlaskPanel.Flasks;
                      return from item in inv
                          let flask = item as Flask
                          where flask != null && flask.Rarity != Rarity.Unique && flask.HealthRecover > 0 && flask.CanUse && flask.FullName != "Divination Distillate"
                          orderby flask.IsInstantRecovery ? flask.HealthRecover : flask.HealthRecoveredPerSecond descending
                          select item;
                  }
              }
      
      This is working for my Arc CullingStrike MFWitch. It might need some settings options, where I would say it needs a new plugin with some logic in it.
      For example i want to wait to use the flask when the bot encounters a rare mob, but a unique mob is nearby but not in distance of my Arc. And a lot of more stuff like that.
      Also I want to set the distance, what I have not done here, because it would change the settings layout. And this would work without changing anything else then these lines of code.

      If you want to cull rare (and or magic) mobs aswell, use this line instead of the above mentioned:

      Code:
      (m.Rarity == Rarity.Unique || m.Rarity == Rarity.Rare || m.Rarity == Rarity.Magic) && // rarity of the monster
      

      cheers
       
      Last edited: Jan 4, 2015
    14. toNyx

      toNyx Well-Known Member

      Joined:
      Oct 29, 2011
      Messages:
      3,770
      Likes Received:
      35
      Trophy Points:
      48
      Thank god I love linq and "clean code" :) many thanks for this, it'll probably be helpful for some nerdz around there :)
       
    15. masterashh

      masterashh New Member

      Joined:
      Mar 15, 2014
      Messages:
      65
      Likes Received:
      0
      Trophy Points:
      0
      Hi spliffermaster. Where I put the last two codes? (mana flask and life flask). I need change some code for this code?
      Thanks!
       
    16. spliffermaster

      spliffermaster Community Developer

      Joined:
      Mar 10, 2014
      Messages:
      56
      Likes Received:
      2
      Trophy Points:
      8
      Hi masterashh

      At the bottom of the AutoFlask.cs file. There are the Flask Type Declaration which you can exchange with the one's mentioned.
      For Life it would be Line 647 (from the originally, unchanged AutoFlask.cs file) and for Mana it is Line 661 (from the originally, unchanged AutoFlask.cs file). The Line number might change when you change something in the code above these lines.
      But you can not miss then by just scrolling down the file.

      You can just replace the code from ///<summary> to the end of the declaration. Quite easy.. ;)
       
    17. masterashh

      masterashh New Member

      Joined:
      Mar 15, 2014
      Messages:
      65
      Likes Received:
      0
      Trophy Points:
      0
      Thank you man! Sorry for the stupid question hahaha. Nice work! Change my world! :D
       
    18. spliffermaster

      spliffermaster Community Developer

      Joined:
      Mar 10, 2014
      Messages:
      56
      Likes Received:
      2
      Trophy Points:
      8
      There are no stupid questions, just stupid answers.. keep farming and gl ;)
       
    19. sortep

      sortep Member

      Joined:
      Dec 20, 2014
      Messages:
      66
      Likes Received:
      0
      Trophy Points:
      6

      so i'm curious has this been implemented into the autoflask 2.0 or do i need to ask spliff for a DL link to get this added? because i dont see it in the autoflash at all as of yet.
       
    20. spliffermaster

      spliffermaster Community Developer

      Joined:
      Mar 10, 2014
      Messages:
      56
      Likes Received:
      2
      Trophy Points:
      8
      I did just fix it in my own code. I don't think someone has implemented that (yet) in the zip.
      So you have to quick fix this by yourself. I am at work at the moment and don't have access to my private stuff. So I can't send you a copy right now. Be back home in 4-5 hours.

      You are lucky I am in a meeting I should not attend and bored as hell.

      Replace this file with the original AutoFlask.cs (not tested AT ALL). If it doesn't work, wait till i get back or someone else can help you.
      This is "culling" Rare and Unique monsters.

      View attachment AutoFlask.cs
       
      Last edited: Jan 6, 2015

    Share This Page