protected async void OnValidateBotScript() { await BusyAndExceptionHandling(async() => { ScriptValidation = await _scriptClient.ValidateScript(new ScriptDto { Script = BotScript.Base64Encode() }); ScriptValid = ScriptValidation.Messages.Count == 0; }); }
private async void OnDeployBot() { await BusyAndExceptionHandling(async() => { if (await _deploymentClient.Available(CurrentTeam.Name, SelectedArena.Name)) { var bot = await _botClient.CreateBot(new BotDto { Name = BotName, Script = BotScript.Base64Encode(), LocationX = 0, LocationY = 0, Orientation = OrientationDto.North, MaximumPhysicalHealth = BotPhysicalHealth, CurrentPhysicalHealth = BotPhysicalHealth, MaximumStamina = BotStamina, CurrentStamina = BotStamina, LastAttackLocationX = 0, LastAttackLocationY = 0 }); if (bot != null) { var deployment = await _deploymentClient.Deploy(new DeploymentDto { ArenaName = SelectedArena.Name, BotName = BotName, TeamName = CurrentTeam.Name }); if (deployment != null) { //BotName = ""; //BotScript = ""; //BotPhysicalHealth = 32000; //BotMentalHealth = 32000; //BotStamina = 32000; } } RefreshArenas(); } else { throw new ClientException("New deployment cannot be done. Deployment restriction applies!"); } }); }