public ISerializableBotTask GetSetModuleActiveTask(ShipFit.ModuleType type, bool shouldBeActive) { switch (type) { case ShipFit.ModuleType.Weapon: var weaponGroup = Fit.GetWeapon(); if (!weaponGroup.UiModule.IsReloading(bot)) { return(weaponGroup.EnsureActive(bot, shouldBeActive)); } break; case ShipFit.ModuleType.Hardener: case ShipFit.ModuleType.ShieldBooster: case ShipFit.ModuleType.MWD: case ShipFit.ModuleType.Etc: return(Fit.GetAllByType(type).Select(m => m.EnsureActive(bot, shouldBeActive)) .FirstOrDefault(t => t != null)); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } return(null); }
public ISerializableBotTask GetReloadTask() { var weaponGroup = Fit.GetWeapon(); if (!weaponGroup.UiModule.IsReloading(bot)) { bool shouldReload = int.Parse(weaponGroup.UiModule.ModuleButtonQuantity) != 20; if (shouldReload) { return(weaponGroup.UiModule.ClickMenuEntryByRegexPattern(bot, "Reload all")); } } return(null); }