private void OnPowerTreadsOrderAdding(OrderAddingEventArgs e) { try { if (!e.Process || e.IsCustom) { return; } var order = e.Order; if (order.Type != OrderType.Cast || order.Ability.Handle != this.powerTreads.Handle) { return; } if (!order.Units.Contains(this.owner)) { return; } if (!this.powerTreads.CanBeCasted()) { return; } this.powerTreads.UseAbility(); this.defaultAttribute = this.powerTreads.ActiveAttribute; e.Process = false; } catch (Exception ex) { Logger.Error(ex); } }
private bool SwitchPowerTreads(RecoveryAbility ability) { var powerTreads = (PowerTreads)this.owner.Hero.Abilities.FirstOrDefault(x => x.Id == AbilityId.item_power_treads); if (powerTreads?.CanBeCasted() != true) { return(false); } var currentAtt = powerTreads.ActiveAttribute; var requiredAtt = ability.PowerTreadsAttribute; if (requiredAtt == Attribute.Invalid || currentAtt == requiredAtt) { return(false); } if (!this.powerTreadsChanged) { this.powerTreadsAttribute = currentAtt; this.powerTreadsChanged = true; } powerTreads.UseAbility(); return(true); }
private void OnAbilityAdded(Ability9 ability) { try { if (!ability.Owner.IsMyHero || !(ability is ActiveAbility)) { return; } if (ability.Id == AbilityId.item_power_treads) { if (this.subscribed) { return; } this.powerTreads = (Core.Entities.Abilities.Items.PowerTreads)ability; this.defaultAttribute = this.powerTreads.ActiveAttribute; OrderManager.OrderAdding += this.OnPowerTreadsOrderAdding; OrderManager.OrderAdding += this.OnOrderAdding; UpdateManager.CreateIngameUpdate(112, this.OnUpdate); this.eventManager.InvokeForceBlockerResubscribe(); this.subscribed = true; } else if (ability.BaseAbility.AbilityData.GetManaCost(1) > 0 && !this.ignoredAbilities.Contains(ability.Id)) { this.intToggler.AddAbility(ability.Id); this.agiToggler.AddAbility(ability.Id, false); } } catch (Exception e) { Logger.Error(e); } }