• Visit Rebornbuddy
  • Actionmanager.DoActionLocation not working right

    Discussion in 'Community Developer Forum' started by Wheredidigo, Aug 26, 2014.

    1. Wheredidigo

      Wheredidigo Community Developer

      Joined:
      Dec 15, 2013
      Messages:
      417
      Likes Received:
      8
      Trophy Points:
      18
      I am trying to set up a Casting Sequence for certain spells and I believe Actionmanager.DoActionLocation is just returning true as soon as it attempts to cast the spell instead of after it actually does cast the spell.

      This bit of code works perfectly every time....(It will cast Ruin II on the current target, and then cast Fester on the target while I'm on the GCD)

      Code:
          public async Task<bool> Fester()
              {
                  if (Core.Player.IsCasting)
                  {
                      return true;
                  }
                  var auras = new List<string> { SummonerSpells.BioII.Name, SummonerSpells.Miasma.Name, SummonerSpells.Bio.Name };
                  var hasAuras = Helpers.HasAura(Core.Player.CurrentTarget, auras.ToArray(), true, 2000) &&
                                  Core.Player.HasAura(SummonerSpells.Aetherflow.Name) &&
                                  Actionmanager.CanCast(SummonerSpells.Fester.Name, Core.Player.CurrentTarget);
      
                  if (hasAuras)
                  {
                      if (await SummonerSpells.RuinII.Cast())
                      {
                          await Coroutine.Wait(3000, () => Actionmanager.CanCast(SummonerSpells.Fester.Name, Core.Player.CurrentTarget));
                          return await SummonerSpells.Fester.Cast();
                      }
                      return false;
                  }
                  return false;
              }
      
      Now, the following code does not work and is why I think DoActionLocation is just returning true as soon as it attempts the spell and doesn't wait to check that the ground spell actually fired:

      Code:
              public async Task<bool> Shadowflare()
              {
                  if (Core.Player.IsCasting)
                  {
                      return true;
                  }
                  if (!Helpers.HasAura(Core.Player, SummonerSpells.ShadowFlare.Name, true, 2000) && Actionmanager.CanCast(SummonerSpells.CrossClass.Swiftcast.Name, Core.Player))
                  {
                      if (await SummonerSpells.CrossClass.Swiftcast.Buff())
                      {
                          await Coroutine.Wait(2000, () => false);
      
                          if (await SummonerSpells.ShadowFlare.CastOnLocation())
                          {
                              await Coroutine.Wait(5000, () => Core.Player.HasAura(SummonerSpells.ShadowFlare.Name));
                              return true;
                          }
                      }
                  }
      
                  if (MovementManager.IsMoving)
                  {
                      return true;
                  }
      
                  if (!Helpers.HasAura(Core.Player, SummonerSpells.ShadowFlare.Name, true, 2000) && !Actionmanager.CanCast(SummonerSpells.CrossClass.Swiftcast.Name, Core.Player))
                  {
                      if (await SummonerSpells.ShadowFlare.CastOnLocation())
                      {
                          await Coroutine.Wait(5000, () => Core.Player.HasAura(SummonerSpells.ShadowFlare.Name) || MovementManager.IsMoving);
                          return true;
                      }
                  }
                  return false;
              }
      
      
      And here is the code for my Casting Methods:

      Code:
          public class Spell
          {
              public string Name { get; set; }
              public int Level { get; set; }
      
              #region Casting Methods
      
              public string _lastSpell;
              public string LastSpell
              {
                  get
                  {
                      if (_lastSpell == null)
                      {
                          _lastSpell = string.Empty;
                      }
                      return _lastSpell;
                  }
                  private set
                  {
                      _lastSpell = value;
                  }
              }
      
              public async Task<bool> Cast(GameObject target = null, bool onLocation = false)
              {
                  bool CastedSpell = false;
                  bool CanCast;
      
                  if (onLocation && target == null)
                      target = Core.Player.CurrentTarget;
      
                  if (target == null)
                      target = Core.Player.CurrentTarget;
      
                  CanCast = CheckCanCast(target);
      
                  if (!CanCast)
                      return false;
      
                  if (onLocation)
                  {
                      if (Actionmanager.DoActionLocation(this.Name, target.Location))
                      {
                          CastedSpell = true;
                      }
                  }
                  else
                  {
                      if (Actionmanager.DoAction(this.Name, target))
                      {
                          CastedSpell = true;
                      }
                  }
                  if (CastedSpell)
                  {
                      this.LastSpell = this.Name;
                      Logging.Write(Colors.OrangeRed, "[MoreDots] Ability: " + this.Name);
                  }
      
                  await Coroutine.Sleep(30);
      
                  return CastedSpell;
              }
      
              public async Task<bool> CastOnLocation()
              {
                  return await Cast(onLocation: true);
              }
      
              public async Task<bool> Buff()
              {
                  return await Cast(Core.Player);
              }
      
      
              #region Helpers
      
              private bool CheckCanCast(GameObject target)
              {
                  if (Core.Player.IsCasting)
                      return false;
      
                  if (!Actionmanager.CanCast(this.Name, target))
                      return false;
      
                  return true;
              }
      
              #endregion
      
              #endregion
          }
      
      Mastahg,

      Can you confirm how DoActionLocation is supposed to work and if it is just returning true as soon as it attempts to cast the spell, can you confirm if that is intended and if not, will you fix it?

      Thanks
       
    2. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,232
      Likes Received:
      364
      Trophy Points:
      83
      Try the new version there was a number that was supposed to be hex and wasnt so we werent getting the proper result.
       
    3. Wheredidigo

      Wheredidigo Community Developer

      Joined:
      Dec 15, 2013
      Messages:
      417
      Likes Received:
      8
      Trophy Points:
      18
      Seems to be working now. Thanks!
       

    Share This Page