Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Triky313 committed Jul 3, 2023
2 parents 5188301 + aada11d commit 302ba08
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 16 deletions.
7 changes: 6 additions & 1 deletion src/StatisticsAnalysisTool/Dungeon/DungeonController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,13 @@ await _mainWindowViewModel?.DungeonBindings?.TrackingDungeons
return true;
}
if (((tierFilter?.Contains(Tier.Unknown) ?? false) && x.Tier is Tier.Unknown or > Tier.T8))
{
return true;
}
return (modeFilter?.Contains(x.Mode) ?? false)
&& (tierFilter?.Contains(x.Tier) ?? false)
&& ((tierFilter?.Contains(x.Tier) ?? false))
&& (levelFilter?.Contains((ItemLevel) x.Level) ?? false);
})
.ToAsyncEnumerable()
Expand Down
42 changes: 42 additions & 0 deletions src/StatisticsAnalysisTool/Models/DungeonStatsFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public class DungeonStatsFilter : INotifyPropertyChanged
DungeonMode.Unknown
};
private bool? _isTierUnknown = true;
private bool? _isT1 = true;
private bool? _isT2 = true;
private bool? _isT3 = true;
private bool? _isT4 = true;
private bool? _isT5 = true;
private bool? _isT6 = true;
Expand All @@ -37,6 +40,9 @@ public class DungeonStatsFilter : INotifyPropertyChanged
private List<Tier> _tierFilters = new()
{
Tier.Unknown,
Tier.T1,
Tier.T2,
Tier.T3,
Tier.T4,
Tier.T5,
Tier.T6,
Expand Down Expand Up @@ -203,6 +209,39 @@ public bool? IsTierUnknown
}
}

public bool? IsT1
{
get => _isT1;
set
{
_isT1 = value;
ChangeTierFilter(Tier.T1, _isT1 ?? false);
OnPropertyChanged();
}
}

public bool? IsT2
{
get => _isT2;
set
{
_isT2 = value;
ChangeTierFilter(Tier.T2, _isT2 ?? false);
OnPropertyChanged();
}
}

public bool? IsT3
{
get => _isT3;
set
{
_isT3 = value;
ChangeTierFilter(Tier.T3, _isT3 ?? false);
OnPropertyChanged();
}
}

public bool? IsT4
{
get => _isT4;
Expand Down Expand Up @@ -424,6 +463,9 @@ private void RemoveTier(ItemLevel level)
public static string TranslationExped => LanguageController.Translation("EXPED");
public static string TranslationExpedition => LanguageController.Translation("EXPEDITION");
public static string TranslationUnknown => LanguageController.Translation("UNKNOWN");
public static string TranslationT1 => LanguageController.Translation("T1");
public static string TranslationT2 => LanguageController.Translation("T2");
public static string TranslationT3 => LanguageController.Translation("T3");
public static string TranslationT4 => LanguageController.Translation("T4");
public static string TranslationT5 => LanguageController.Translation("T5");
public static string TranslationT6 => LanguageController.Translation("T6");
Expand Down
8 changes: 5 additions & 3 deletions src/StatisticsAnalysisTool/Network/EventCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ public enum EventCodes
NewTeleportStone,
Cloak,
PartyInvitation,
PartyJoined,
PartyJoinRequest,
PartyJoined = 219, // map[0:[39 75 81 -72 -80 97 25 66 -65 -97 111 45 -59 -126 98 -43] 1:crismooo 2:55 3:13 4:0 5:WiId Card 6:7805 7:true 252:219]
PartyChangedOrder = 220, // map[0:14368 2:1 3:[-45 -35 124 14 -23 103 -41 74 -71 66 67 20 -12 60 44 -101] 4:[[-45 -35 124 14 -23 103 -41 74 -71 66 67 20 -12 60 44 -101] [-118 61 -70 72 17 -107 121 72 -102 110 20 -25 64 20 106 2]] 5:[Triky313 Bruno313] 6:[0 0] 7:[18 0] 8:[35 0] 9:[-1 -1] 10:[true true] 252:212]
PartyDisbanded = 221, // map[1:14184 252:213]
PartyPlayerJoined = 222, // map[0:11925 1:[-63 -19 39 16 26 35 -25 67 -111 60 -87 -58 -31 -100 -124 -44] 2:Mitch77 3:1 4:20 5:12 6:-1 7:true 252:214]
Expand All @@ -227,11 +228,12 @@ public enum EventCodes
PartyLootSettingChangedPlayer = 226, // map[0:14368 1:1 252:218]
PartySilverGained,
PartyPlayerUpdated = 229, // map[0:Bruno313 1:true 3:5 252:221]
PartyInvitationPlayerBusy,
PartyInvitationAnswer,
PartyJoinRequestAnswer,
PartyMarkedObjectsUpdated,
PartyOnClusterPartyJoined,
PartySetRoleFlag, // map[0:8 1:[-118 61 -70 72 17 -107 121 72 -102 110 20 -25 64 20 106 2] 252:225] (0: FlagType, 1: ObjectId)
PartyJoinRequest = 234,
PartyInviteOrJoinPlayerEquipmentInfo,
SpellCooldownUpdate,
NewHellgate,
NewHellgateExit,
Expand Down
40 changes: 40 additions & 0 deletions src/StatisticsAnalysisTool/Network/Events/PartyJoinedEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using StatisticsAnalysisTool.Common;
using System;
using System.Collections.Generic;
using System.Reflection;

namespace StatisticsAnalysisTool.Network.Events;

public class PartyJoinedEvent
{
public Guid UserGuid { get; private set; } = Guid.Empty;
public string Username { get; private set; } = string.Empty;
public string GuildName { get; private set; } = string.Empty;

public PartyJoinedEvent(Dictionary<byte, object> parameters)
{
ConsoleManager.WriteLineForNetworkHandler(GetType().Name, parameters);

try
{
if (parameters.TryGetValue(1, out object userGuid) && userGuid is Guid)
{
UserGuid = userGuid.ObjectToGuid() ?? Guid.Empty;
}

if (parameters.TryGetValue(1, out object username) && username is string usernameString && !string.IsNullOrEmpty(usernameString))
{
Username = usernameString;
}

if (parameters.TryGetValue(5, out object guildName) && guildName is string guildNameString && !string.IsNullOrEmpty(guildNameString))
{
GuildName = guildNameString;
}
}
catch (Exception e)
{
ConsoleManager.WriteLineForError(MethodBase.GetCurrentMethod()?.DeclaringType, e);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using StatisticsAnalysisTool.Enumerations;
using StatisticsAnalysisTool.Network.Events;
using StatisticsAnalysisTool.Network.Manager;
using System.Threading.Tasks;

namespace StatisticsAnalysisTool.Network.Handler;

public class PartyJoinedEventHandler : EventPacketHandler<PartyJoinedEvent>
{
private readonly TrackingController _trackingController;

public PartyJoinedEventHandler(TrackingController trackingController) : base((int) EventCodes.PartyJoined)
{
_trackingController = trackingController;
}

protected override async Task OnActionAsync(PartyJoinedEvent value)
{
_trackingController.EntityController.AddEntity(null, value.UserGuid, null, value.Username, value.GuildName, null, null, GameObjectType.Player, GameObjectSubType.LocalPlayer);
await _trackingController.EntityController.AddToPartyAsync(value.UserGuid);
}
}
15 changes: 7 additions & 8 deletions src/StatisticsAnalysisTool/Network/Manager/EntityController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Xml.Linq;

namespace StatisticsAnalysisTool.Network.Manager;

Expand Down Expand Up @@ -149,7 +147,7 @@ public async Task AddToPartyAsync(Guid guid)
_knownPartyEntities.Add(guid);
}

await SetPartyMemberUiAsync();
await UpdatePartyMemberUiAsync();
}

public async Task RemoveFromPartyAsync(Guid? guid)
Expand All @@ -164,15 +162,15 @@ public async Task RemoveFromPartyAsync(Guid? guid)
else
{
_ = _knownPartyEntities.Remove(notNullGuid);
await SetPartyMemberUiAsync();
await UpdatePartyMemberUiAsync();
}
}
}

public async Task ResetPartyMemberAsync()
{
_knownPartyEntities.Clear();
await SetPartyMemberUiAsync();
await UpdatePartyMemberUiAsync();
}

public async Task AddLocalEntityToPartyAsync()
Expand All @@ -182,7 +180,7 @@ public async Task AddLocalEntityToPartyAsync()
_knownPartyEntities.Add(member.Key);
}

await SetPartyMemberUiAsync();
await UpdatePartyMemberUiAsync();
}

public async Task SetPartyAsync(Dictionary<Guid, string> party, bool resetPartyBefore = false)
Expand All @@ -202,13 +200,14 @@ public async Task SetPartyAsync(Dictionary<Guid, string> party, bool resetPartyB
await AddToPartyAsync(member.Key);
}
}
private async Task SetPartyMemberUiAsync()

private async Task UpdatePartyMemberUiAsync()
{
await Application.Current.Dispatcher.InvokeAsync(() =>
{
_mainWindowViewModel.PartyMemberCircles.Clear();
foreach (var memberGuid in _knownPartyEntities)
foreach (var memberGuid in _knownPartyEntities.ToList())
{
var user = GetEntity(memberGuid);
Expand Down
4 changes: 2 additions & 2 deletions src/StatisticsAnalysisTool/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.21.5.*")]
[assembly: AssemblyFileVersion("5.21.5.0")]
[assembly: AssemblyVersion("5.21.6.*")]
[assembly: AssemblyFileVersion("5.21.6.0")]
3 changes: 3 additions & 0 deletions src/StatisticsAnalysisTool/Styles/DungeonStyles.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,9 @@
</DockPanel>
<DockPanel Margin="0,0,0,0" Height="30" VerticalAlignment="Top" Width="auto" HorizontalAlignment="Left">
<CheckBox Content="T?" Margin="5,0,5,0" IsChecked="{Binding IsTierUnknown}"/>
<CheckBox Content="{Binding TranslationT1, FallbackValue='T1'}" Margin="5,0,5,0" IsChecked="{Binding IsT1}"/>
<CheckBox Content="{Binding TranslationT2, FallbackValue='T2'}" Margin="5,0,5,0" IsChecked="{Binding IsT2}"/>
<CheckBox Content="{Binding TranslationT3, FallbackValue='T3'}" Margin="5,0,5,0" IsChecked="{Binding IsT3}"/>
<CheckBox Content="{Binding TranslationT4, FallbackValue='T4'}" Margin="5,0,5,0" IsChecked="{Binding IsT4}"/>
<CheckBox Content="{Binding TranslationT5, FallbackValue='T5'}" Margin="5,0,5,0" IsChecked="{Binding IsT5}"/>
<CheckBox Content="{Binding TranslationT6, FallbackValue='T6'}" Margin="5,0,5,0" IsChecked="{Binding IsT6}"/>
Expand Down
4 changes: 2 additions & 2 deletions src/StatisticsAnalysisTool/UserControls/ThanksControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<TextBlock Text="arabinos" Style="{StaticResource Thanks.TextBlock.Name.Style}" />
<TextBlock Text="Thank you for your translations into Polish." Style="{StaticResource Thanks.TextBlock.Text.Style}" />
<TextBlock />
<TextBlock Text="Ewerson" Style="{StaticResource Thanks.TextBlock.Name.Style}" />
<TextBlock Text="Ewerson (Maligors)" Style="{StaticResource Thanks.TextBlock.Name.Style}" />
<TextBlock Text="Thank you for your Brazilian translations." Style="{StaticResource Thanks.TextBlock.Text.Style}" />
<TextBlock />
<TextBlock Text="Me1onSeed" Style="{StaticResource Thanks.TextBlock.Name.Style}" />
Expand All @@ -53,4 +53,4 @@
</StackPanel>
</ScrollViewer>
</Grid>
</UserControl>
</UserControl>

0 comments on commit 302ba08

Please sign in to comment.