public bool HasSpecialPassive(SpecialPassiveEffects specialPassive) { return(Passives.Any(x => x.SpecialPassive == specialPassive)); }
public bool HasPassive(string name) { return(Passives.Any(p => p.Name == name)); }
public async Task <bool> Execute() { try { if (ZetaDia.Me == null || ZetaDia.Me.IsDead || ZetaDia.Me.IsGhosted || ZetaDia.Me.IsInCombat || ZetaDia.Me.IsInConversation || ZetaDia.Me.IsInBossEncounter || ZetaDia.Me.LoopingAnimationEndTime != 0) { Core.Logger.Log("[Auto Skills] Cannot equip build right now"); return(false); } if (DateTime.UtcNow.Subtract(_lastSkillChange).TotalMinutes < 1) { return(false); } _lastSkillChange = DateTime.UtcNow; if (Skills != null && Skills.Any()) { await Coroutine.Sleep(250); // Only 'IsPrimary' flagged skills can be assigned to slots 0 and 1 KnownSkills = ZetaDia.Me.KnownSkills.ToList().DistinctBy(s => s.SNOPower).ToDictionary(s => s.SNOPower, v => v); Core.Hotbar.Update(); var primarySkills = Skills.Where(s => s.Key.IsPrimary).Take(2).ToList(); if (primarySkills.Any()) { for (int i = 0; i < Math.Min(primarySkills.Count, 2); i++) { var skillDefinition = primarySkills.ElementAtOrDefault(i); if (Core.Hotbar.ActiveSkills.Any(s => s.Power == skillDefinition.Key.SNOPower && (int)s.Slot == i)) { Core.Logger.Verbose("[Auto Skills] Skipping Skill (Already Equipped): {0} ({1}) - {2} in slot {3}", skillDefinition.Key.Name, (int)skillDefinition.Key.SNOPower, skillDefinition.Value.Name, i); continue; } await EquipSkill(skillDefinition, i); await Coroutine.Sleep(500); } } var otherSkills = Skills.Except(primarySkills).ToList(); if (otherSkills.Any()) { for (int i = 2; i < otherSkills.Count + 2; i++) { await EquipSkill(otherSkills.ElementAtOrDefault(i), i); await Coroutine.Sleep(500); } } } if (Passives == null || !Passives.Any()) { return(false); } var validPasives = Passives.Where(p => p.Class == ZetaDia.Me.ActorClass && Core.Player.Level >= p.RequiredLevel).ToList(); var passivePowers = validPasives.Select(p => p.SNOPower).ToList(); foreach (var passive in validPasives) { Core.Logger.Verbose("[Auto Skills] Selecting Passive: {0} {1} ({2})", passive.Name, passive.SNOPower.ToString(), (int)passive.SNOPower); } await Coroutine.Sleep(250); switch (validPasives.Count) { case 1: ZetaDia.Me.SetTraits(passivePowers[0]); break; case 2: ZetaDia.Me.SetTraits(passivePowers[0], passivePowers[1]); break; case 3: ZetaDia.Me.SetTraits(passivePowers[0], passivePowers[1], passivePowers[2]); break; case 4: ZetaDia.Me.SetTraits(passivePowers[0], passivePowers[1], passivePowers[2], passivePowers[3]); break; } await Coroutine.Sleep(2000); } catch (Exception ex) { Core.Logger.Error("[Auto Skills] Exception in Build.EquipBuild(). {0}", ex); } return(true); }