Skip to content

Commit

Permalink
rito games
Browse files Browse the repository at this point in the history
  • Loading branch information
diogotr7 committed Jul 30, 2024
1 parent 6ab856f commit 26b7187
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using Artemis.Plugins.Games.LeagueOfLegends.Module.InGameApi.DataModels.Enums;
using Artemis.Plugins.Games.LeagueOfLegends.Module.InGameApi.GameDataModels;
using Artemis.Plugins.Games.LeagueOfLegends.Module.Utils;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using SummonerSpell = Artemis.Plugins.Games.LeagueOfLegends.Module.InGameApi.DataModels.Enums.SummonerSpell;
using ChampionEnum = Artemis.Plugins.Games.LeagueOfLegends.Module.InGameApi.DataModels.Enums.Champion;
using Rune = Artemis.Plugins.Games.LeagueOfLegends.Module.InGameApi.DataModels.Enums.Rune;
Expand Down Expand Up @@ -70,30 +70,11 @@ public void Update(RootGameData rootGameData)
SpellF = ParseEnum<SummonerSpell>.TryParseOr(allPlayer.SummonerSpells.SummonerSpellTwo?.RawDisplayName, SummonerSpell.Unknown);
}

private static bool TryFindActivePlayer(RootGameData rootGameData, [NotNullWhen(returnValue: true)] out AllPlayer? allPlayer)
public static bool TryFindActivePlayer(RootGameData rootGameData, [NotNullWhen(returnValue: true)] out AllPlayer? allPlayer)
{
allPlayer = null;
allPlayer = rootGameData.AllPlayers.FirstOrDefault(p => p?.SummonerName == rootGameData?.ActivePlayer?.SummonerName);

if (string.IsNullOrWhiteSpace(rootGameData?.ActivePlayer?.SummonerName))
return false;

ReadOnlySpan<char> summonerName = rootGameData.ActivePlayer.SummonerName;

var hashIndex = summonerName.IndexOf('#');
if (hashIndex == -1)
return false;

var summonerNameWithoutHash = summonerName[..hashIndex];
foreach (var player in rootGameData.AllPlayers)
{
if (summonerNameWithoutHash.Equals(player.SummonerName, StringComparison.OrdinalIgnoreCase))
{
allPlayer = player;
return true;
}
}

return false;
return allPlayer != null;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"Icon": "league-of-legends.jpg",
"Description": "League Of Legends game and client integration",
"Author": "diogotr7",
"Version": "1.0.2",
"Version": "1.0.3",
"Main": "Artemis.Plugins.Games.LeagueOfLegends.Module.dll",
"Website": "https://artemis-rgb.com/",
"Repository": "https://github.com/Artemis-RGB/Artemis.Plugins.Games"
Expand Down

0 comments on commit 26b7187

Please sign in to comment.