public override void Enable() { DisplayName = "Valheim"; DisplayIcon = "Valheim.svg"; DefaultPriorityCategory = ModulePriorityCategory.Application; ActivationRequirements.Add(new ProcessActivationRequirement("valheim")); _webServerService.AddJsonEndPoint <PlayerData>(this, "player", p => { DataModel.Player = p; }); _webServerService.AddJsonEndPoint <Enviroment>(this, "environment", e => { DataModel.Environment = e; }); _webServerService.AddStringEndPoint(this, "teleport", _ => { DataModel.Teleport.Trigger(); }); _webServerService.AddJsonEndPoint <SkillLevelUpEventArgs>(this, "levelUp", e => { DataModel.SkillLevelUp.Trigger(e); }); _webServerService.AddStringEndPoint(this, "forsakenActivated", _ => { DataModel.ForsakenActivated.Trigger(); }); }
/// <summary> /// Evaluates the activation requirements following the <see cref="ActivationRequirementMode" /> and returns the result /// </summary> /// <returns>The evaluated result of the activation requirements</returns> public bool EvaluateActivationRequirements() { if (!ActivationRequirements.Any()) { return(true); } if (ActivationRequirementMode == ActivationRequirementType.All) { return(ActivationRequirements.All(r => r.Evaluate())); } if (ActivationRequirementMode == ActivationRequirementType.Any) { return(ActivationRequirements.Any(r => r.Evaluate())); } return(false); }
public override void Enable() { DisplayName = "League Of Legends"; DisplayIcon = "LeagueOfLegendsIcon.svg"; DefaultPriorityCategory = ModulePriorityCategory.Application; ActivationRequirements.Add(new ProcessActivationRequirement("League Of Legends")); //mock live game api //ActivationRequirements.Add(new ProcessActivationRequirement("node")); httpClientHandler = new HttpClientHandler { //we need this to not make the user install Riot's certificate on their computer ServerCertificateCustomValidationCallback = (_, __, ___, ____) => true }; httpClient = new HttpClient(httpClientHandler); httpClient.Timeout = TimeSpan.FromMilliseconds(80); UpdateDuringActivationOverride = false; DataModel.Player.colorDictionary = _colors.Value; AddTimedUpdate(TimeSpan.FromMilliseconds(100), UpdateData); }