private bool IsAuraName(string name)
{
Log.InfoFormat("[WIMM] Auras being checked {0}.", name);
// This makes sure auras on items don't get used, since they don't have skill gems, and won't have an Aura tag.
if (!ExampleRoutineSettings.Instance.EnableAurasFromItems)
{
Log.InfoFormat("[WIMM] EnableAurasFromItems TRIGGERREEDED.");
return false;
}
var auraNames = new string[]
{
"Anger", "Clarity", "Determination", "Discipline", "Grace", "Haste", "Hatred", "Purity of Elements",
"Purity of Fire", "Purity of Ice", "Purity of Lightning", "Vitality", "Wrath"
};
Log.InfoFormat("[WIMM] Aura being checked, {0}, is in the aruaNames array? {1}", name, auraNames.Contains(name));
return auraNames.Contains(name);
}
_aurasChecked = false;
_auraSlot = 2; //who used the middle mouse :p
//xxx arua check if Auras need a casting priority
private async Task CheckAuras()
{
if (_aurasChecked == true)
{
return;
}
//Get current skill in the auraslot
Log.InfoFormat("[WIMM] Aura backing up current skill in Aura slot {0}.", _auraSlot);
var _saveSkill = LokiPoe.InGameState.SkillBarPanel.Slot2;
//check them all, cast them all. User beware.
foreach (var skill in LokiPoe.InGameState.SkillBarPanel.Skills)
{
if ((skill.SkillTags.Contains("aura") && !skill.SkillTags.Contains("vaal")) || IsAuraName(skill.Name))
{
Log.InfoFormat("[WIMM] Aura Found {0}.", skill.Name);
if (!LokiPoe.Me.HasAura(skill.Name))
{
Log.InfoFormat("[WIMM] Aura assigning skill {0} to slot {1}, if not already assigned.", skill.Name, _auraSlot);
var doCast = true;
while (skill.Slot == -1)
{
Log.InfoFormat("[WIMM] Now assigning {0} to the skillbar.", skill.Name);
var sserr = LokiPoe.InGameState.SkillBarPanel.SetSlot(_auraSlot, skill);
if (sserr != LokiPoe.InGameState.SetSlotError.None)
{
Log.ErrorFormat("[Logic] SetSlot returned {0}.", sserr);
doCast = false;
break;
}
await Coroutine.Sleep(Utility.LatencySafeValue(1000));
}
if (!doCast)
{
Log.InfoFormat("[WIMM] Aura cast failed for {0}", skill.Name);
continue; //using continue instead of return true because there could be more than one aura
}
else
{
await Coroutines.FinishCurrentAction();
await Coroutine.Sleep(Utility.LatencySafeValue(1000));
Log.InfoFormat("[WIMM] Aura casting {0}.", skill.Name);
var err1 = LokiPoe.InGameState.SkillBarPanel.Use(skill.Slot, false);
if (err1 == LokiPoe.InGameState.UseError.None)
{
Log.InfoFormat("[WIMM] Aura cast. No Problem. {0}.", skill.Name);
await Coroutine.Sleep(Utility.LatencySafeValue(250));
await Coroutines.FinishCurrentAction(false);
await Coroutine.Sleep(Utility.LatencySafeValue(1000));
continue; //using continue instead of return true because there could be more than one aura
}
Log.ErrorFormat("[Logic] Use returned {0} for {1}.", err1, skill.Name);
}
}
}
}
//returning original auraSlot skill back
Log.InfoFormat("[WIMM] Now assigning {0} to the skillbar auraslot.", _saveSkill.Name);
var assigningerr = LokiPoe.InGameState.SkillBarPanel.SetSlot(_auraSlot, _saveSkill);
if (assigningerr != LokiPoe.InGameState.SetSlotError.None)
{
Log.ErrorFormat("[Logic] SetSlot returned {0}.", assigningerr);
}
await Coroutine.Sleep(Utility.LatencySafeValue(1000));
Log.InfoFormat("[WIMM] Auras now assigned until bot restarted");
_aurasChecked = true; //so we do not have to repeat this
return;
}