Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Triky313 committed Nov 30, 2024
2 parents 7815946 + 7c35e98 commit 055341a
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/StatisticsAnalysisTool/Dungeon/DungeonController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,12 @@ await Application.Current.Dispatcher.InvokeAsync(() =>
{
return;
}

var uniqueItemName = ItemController.GetUniqueNameByIndex(discoveredItem.ItemIndex);
if (uniqueItemName.Contains("SILVERBAG"))
{
return;
}

dun.Loot.Add(new Loot()
{
Expand Down
13 changes: 13 additions & 0 deletions src/StatisticsAnalysisTool/Localization/localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -37378,6 +37378,19 @@
"seg": "Total chest value"
}
]
},
{
"tuid": "TOTAL_WEIGHT",
"tuv": [
{
"lang": "de-DE",
"seg": "Gesamtgewicht"
},
{
"lang": "en-US",
"seg": "Total weight"
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,5 @@ public class MainWindowTranslation
public static string CurrentRepairCosts => LocalizationController.Translation("CURRENT_REPAIR_COSTS");
public static string ShowTotalAvgPricesOnItem => LocalizationController.Translation("SHOW_TOTAL_AVG_PRICES_ON_ITEM");
public static string TotalChestValue => LocalizationController.Translation("TOTAL_CHEST_VALUE");
public static string TotalWeight => LocalizationController.Translation("TOTAL_WEIGHT");
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System;
using Serilog;
using StatisticsAnalysisTool.Common;
using StatisticsAnalysisTool.Enumerations;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using Serilog;
using StatisticsAnalysisTool.Common;

namespace StatisticsAnalysisTool.Network.PacketProviders;

Expand All @@ -17,7 +18,7 @@ public class SocketsPacketProvider : PacketProvider
private readonly List<IPAddress> _gateways = new();
private byte[] _byteData = new byte[65000];
private bool _stopReceiving;

public SocketsPacketProvider(IPhotonReceiver photonReceiver)
{
_photonReceiver = photonReceiver ?? throw new ArgumentNullException(nameof(photonReceiver));
Expand Down Expand Up @@ -86,6 +87,27 @@ private void OnReceive(IAsyncResult ar)
Socket socket = (Socket) ar.AsyncState;
socket?.EndReceive(ar);

try
{
int bytesReceived = socket?.EndReceive(ar) ?? 0;
if (bytesReceived <= 0)
{
ConsoleManager.WriteLineForMessage(MethodBase.GetCurrentMethod()?.DeclaringType, "No data received.", ConsoleColorType.ErrorColor);
return;
}
}
catch (SocketException ex)
{
ConsoleManager.WriteLineForError(MethodBase.GetCurrentMethod()?.DeclaringType, ex);
return;
}
catch (ObjectDisposedException ex)
{
ConsoleManager.WriteLineForError(MethodBase.GetCurrentMethod()?.DeclaringType, ex);
return;
}


using (MemoryStream buffer = new MemoryStream(_byteData))
{
using BinaryReader read = new BinaryReader(buffer);
Expand Down Expand Up @@ -137,7 +159,7 @@ private void OnReceive(IAsyncResult ar)
socket?.BeginReceive(_byteData, 0, _byteData.Length, SocketFlags.None, OnReceive, socket);
}
}

private static bool IsSocketActive(Socket socket)
{
bool part1 = socket.Poll(1000, SelectMode.SelectRead);
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("7.8.1.*")]
[assembly: AssemblyFileVersion("7.8.1.0")]
[assembly: AssemblyVersion("7.8.2.*")]
[assembly: AssemblyFileVersion("7.8.2.0")]
2 changes: 2 additions & 0 deletions src/StatisticsAnalysisTool/StorageHistory/ContainerItem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using System.Windows.Media.Media3D;
using StatisticsAnalysisTool.Common;
using StatisticsAnalysisTool.Models;
using StatisticsAnalysisTool.ViewModels;
Expand Down Expand Up @@ -44,4 +45,5 @@ public Visibility AveragePricesDisplayedOnItemVisibility
public Item Item => ItemController.GetItemByIndex(ItemIndex);

public double TotalAvgEstMarketValue => Quantity * Item?.AverageEstMarketValue ?? 0;
public double TotalWeight => Quantity * ItemController.GetWeight(Item?.FullItemInformation);
}
14 changes: 14 additions & 0 deletions src/StatisticsAnalysisTool/StorageHistory/VaultBindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using System.Windows;
using System.Windows.Data;
using StatisticsAnalysisTool.Enumerations;
using StatisticsAnalysisTool.Common;
using System.Windows.Media.Media3D;

namespace StatisticsAnalysisTool.StorageHistory;

Expand All @@ -26,6 +28,7 @@ public class VaultBindings : BaseViewModel
private string _searchText;
private bool _isAveragePricesDisplayedOnItem;
private double _totalContainerValue;
private double _totalWeight;

public VaultBindings()
{
Expand Down Expand Up @@ -98,6 +101,7 @@ public VaultContainer VaultContainerSelected
}));

TotalContainerValue = VaultContainerContent.Sum(x => x.TotalAvgEstMarketValue);
TotalWeight = VaultContainerContent.Sum(x => x.TotalWeight);
LastUpdate = _vaultContainerSelected?.LastUpdate ?? new DateTime(0);
LastUpdateVisibility = _vaultContainerSelected?.LastUpdate.Ticks <= 1 ? Visibility.Hidden : Visibility.Visible;
OnPropertyChanged();
Expand Down Expand Up @@ -166,6 +170,16 @@ public double TotalContainerValue
}
}

public double TotalWeight
{
get => _totalWeight;
set
{
_totalWeight = value;
OnPropertyChanged();
}
}

public string SearchText
{
get => _searchText;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
<TextBlock Text="{Binding VaultBindings.TotalContainerValue, StringFormat='{}{0:N0}', ConverterCulture={x:Static gl:CultureInfo.CurrentCulture}}"
FontSize="16" Margin="2,0,0,10" Padding="0" Foreground="{StaticResource SolidColorBrush.Text.1}" />

<TextBlock Style="{StaticResource Text.Title.1}" Text="{Binding Translation.TotalWeight, FallbackValue=TOTAL__WEIGHT}"
Margin="0,0,0,0" TextWrapping="Wrap" MaxWidth="190" />
<TextBlock Text="{Binding VaultBindings.TotalWeight, StringFormat='{}{0:N0}', ConverterCulture={x:Static gl:CultureInfo.CurrentCulture}}"
FontSize="16" Margin="2,0,0,10" Padding="0" Foreground="{StaticResource SolidColorBrush.Text.1}" />

<TextBlock Style="{StaticResource Text.Title.1}" Text="{Binding Translation.CurrentRepairCosts, FallbackValue=CURRENT__REPAIR__COSTS}"
Margin="0,0,0,0" TextWrapping="Wrap" MaxWidth="190" />
<TextBlock Text="{Binding VaultBindings.VaultContainerSelected.RepairCosts, StringFormat='{}{0:N0}', ConverterCulture={x:Static gl:CultureInfo.CurrentCulture}}"
Expand Down

0 comments on commit 055341a

Please sign in to comment.