public Action FindSmartAction(SmartActionName actionName, IntPtr handle, CancellationTokenSource tokenSource, params object[] @params) { if (!actionName.IsCancelable()) { throw new Exception($"Tried to recive non cancelable smart action {actionName} as a cancellable Macro."); } switch (actionName) { case SmartActionName.UpgradeGem: var key = settingsService.GetKeybinding(CommandKeybinding.TeleportToTown); return(() => actionService.UpgradeGem(handle, tokenSource, (int)@params[0], key)); default: throw new NotImplementedException(); } }
public Action FindSmartAction(SmartActionName actionName, IntPtr handle, params object[] @params) { if (actionName.IsCancelable()) { throw new Exception($"Tried to recive cancelable smart action {actionName} as a non cancellable Macro."); } switch (actionName) { case SmartActionName.AcceptGriftPopup: { var isEmpowered = (bool)@params[0]; bool clickIt = (isEmpowered && settingsService.SmartFeatureSettings.EmpowerGrifts) || (!isEmpowered && settingsService.SmartFeatureSettings.EmpowerGrifts); return(() => actionService.AcceptGriftPopup(handle, clickIt)); } case SmartActionName.OpenRiftGrift: if (settingsService.SmartFeatureSettings.IsOpenRift) { return(() => actionService.OpenRift(handle)); } else { return(() => actionService.OpenGrift(handle)); } case SmartActionName.StartGame: return(() => actionService.StartGame(handle)); case SmartActionName.Gamble: return(FindAction(ActionName.Gamble, handle)); default: return(() => logService.AddEntry(this, $"Automatic actions are not yet implemented.", LogLevel.Debug)); throw new NotImplementedException(); } }