Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
adjustments to work with 1.9.0 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
slimDebug authored Jul 16, 2022
1 parent 0b01db1 commit 8325af8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
4 changes: 2 additions & 2 deletions HuntMmrReader/HuntMmrReader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
<AssemblyVersion>1.3.0.0</AssemblyVersion>
<FileVersion>1.3.0.0</FileVersion>
<PackageReadmeFile></PackageReadmeFile>
<RepositoryUrl></RepositoryUrl>
</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion HuntMmrReader/Models/HuntPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public HuntPlayer(string? name, string? mmr, string? hadBounty,
}

public string Name { get; }

public bool HadBounty { get; }
public bool HadWellSpring { get; }
public ushort KilledByMe { get; }
Expand Down
7 changes: 5 additions & 2 deletions HuntMmrReader/Models/HuntReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ private IEnumerable<HuntTeam> GetPlayersFromDoc(XContainer doc)
var players = new List<HuntPlayer>();
XAttribute? teamMmrElement;
XAttribute? inviteTeamElement;
XAttribute? ownTeamElement;
XAttribute? skillBasedMatchMakingEnabledElement = default;
try
{
var baseTempTeamString = $"MissionBagTeam_{teamCounter.ToString(CultureInfo.InvariantCulture)}_";
teamMmrElement = GetAttributeByName(doc,
$"{baseTempTeamString}mmr");
inviteTeamElement = GetAttributeByName(doc, $"{baseTempTeamString}isinvite");
ownTeamElement = GetAttributeByName(doc, $"{baseTempTeamString}ownteam");
}
catch (Exception e)
{
Expand All @@ -159,8 +161,8 @@ private IEnumerable<HuntTeam> GetPlayersFromDoc(XContainer doc)
var tempPlayerMmr = $"{baseTempPlayerString}mmr";
var tempPlayerHadBounty = $"{baseTempPlayerString}hadbounty";
var tempPlayerHadWellSpring = $"{baseTempPlayerString}hadWellspring";
var tempPlayerKilledByMe = $"{baseTempPlayerString}killedbyme";
var tempPlayerKilledMe = $"{baseTempPlayerString}killedme";
var tempPlayerKilledByMe = $"{baseTempPlayerString}downedbyme";
var tempPlayerKilledMe = $"{baseTempPlayerString}downedme";
var tempPlayerSkillBasedMatchMakingEnabled = $"{baseTempPlayerString}skillbased";
XAttribute? nameElement;
XAttribute? mmrElement;
Expand Down Expand Up @@ -193,6 +195,7 @@ private IEnumerable<HuntTeam> GetPlayersFromDoc(XContainer doc)
}

teams.Add(new HuntTeam(teamMmrElement?.Value, (ushort) (teamCounter + 1), inviteTeamElement?.Value,
ownTeamElement?.Value,
skillBasedMatchMakingEnabledElement?.Value, players));
teamCounter++;
}
Expand Down
9 changes: 6 additions & 3 deletions HuntMmrReader/Models/HuntTeam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,29 @@ public class HuntTeam : HuntBaseEntity
private readonly List<HuntPlayer> _members;

public HuntTeam(ushort mmr, ushort id, bool inviteTeam, bool skillBasedMatchMakingEnabled,
List<HuntPlayer> teamMembers) : base(mmr, id)
List<HuntPlayer> teamMembers, bool ownTeam) : base(mmr, id)
{
_members = teamMembers;
RandomTeam = teamMembers.Count != 1 && !inviteTeam;
OwnTeam = ownTeam;
SkillBasedMatchMakingEnabled = skillBasedMatchMakingEnabled;
}

public HuntTeam(string? mmr, ushort id, string? inviteTeam, string? skillBasedMatchMakingEnabled,
public HuntTeam(string? mmr, ushort id, string? inviteTeam, string? ownTeam, string? skillBasedMatchMakingEnabled,
List<HuntPlayer> teamMembers) : base(mmr, id)
{
_members = teamMembers;
RandomTeam = !(bool.TryParse(inviteTeam, out var parsedInviteTeam) && parsedInviteTeam) &&
teamMembers.Count != 1;
OwnTeam = bool.TryParse(ownTeam, out var parsedOwnTeam) &&
parsedOwnTeam;
SkillBasedMatchMakingEnabled =
bool.TryParse(skillBasedMatchMakingEnabled, out var parsedSkillBasedMatchMakingEnabled) &&
parsedSkillBasedMatchMakingEnabled;
}

public bool OwnTeam { get; }
public bool SkillBasedMatchMakingEnabled { get; }

public bool RandomTeam { get; }

public IReadOnlyCollection<HuntPlayer> Members =>
Expand Down
15 changes: 13 additions & 2 deletions HuntMmrReader/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True">
<Expander IsExpanded="True" d:DataContext="{d:DesignInstance CollectionViewGroup}">
<Expander.Header>
<emoji:TextBlock d:DataContext="{d:DesignInstance CollectionViewGroup}">
<emoji:TextBlock>
<emoji:TextBlock.Text>
<MultiBinding
StringFormat="{}Team: {0,2} | {1,3} | Random Team: {2} | MMR: {3,4} | Skill-based Matchmaking: {4}">
Expand All @@ -130,6 +130,17 @@
</emoji:TextBlock.Text>
</emoji:TextBlock>
</Expander.Header>
<Expander.Style>
<Style TargetType="{x:Type Expander}">
<Style.Triggers>
<DataTrigger
Binding="{Binding Items[0].(models:HuntTeam.OwnTeam)}"
Value="True">
<Setter Property="Background" Value="#3F00FFFF" />
</DataTrigger>
</Style.Triggers>
</Style>
</Expander.Style>
<Expander.Content>
<ItemsPresenter />
</Expander.Content>
Expand Down

0 comments on commit 8325af8

Please sign in to comment.