Skip to content

Commit

Permalink
Merge branch 'StorageHistory' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Triky313 committed Aug 12, 2024
2 parents 464daf6 + 78587cd commit b36e82d
Show file tree
Hide file tree
Showing 27 changed files with 457 additions and 182 deletions.
4 changes: 2 additions & 2 deletions src/StatisticsAnalysisTool/Cluster/ClusterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ public void SetAndResetValues(ClusterInfo currentCluster)
_trackingController.CombatController.ResetDamageMeterByClusterChange();
_trackingController.StatisticController.SetKillsDeathsValues();
_trackingController.VaultController.ResetDiscoveredItems();
_trackingController.VaultController.ResetVaultContainer();
_trackingController.VaultController.ResetCurrentVaultInfo();
_trackingController.VaultController.ResetInternalVaultContainer();
_trackingController.VaultController.ResetCurrentInternalVault();
_trackingController.TreasureController.RemoveTemporaryTreasures();
_trackingController.TreasureController.UpdateLootedChestsDashboardUi();
_trackingController.LootController.ResetLocalPlayerDiscoveredLoot();
Expand Down
14 changes: 0 additions & 14 deletions src/StatisticsAnalysisTool/Models/NetworkModel/ContainerItem.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ public ItemContainerObject(long? objectId, Guid privateContainerGuid, Guid conta
public Guid PrivateContainerGuid { get; set; }
public Guid ContainerGuid { get; set; }
public List<long> SlotItemIds { get; set; }
public double RepairCosts { get; set; }
}
36 changes: 0 additions & 36 deletions src/StatisticsAnalysisTool/Models/NetworkModel/Vault.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using StatisticsAnalysisTool.Network.Events;
using StatisticsAnalysisTool.Network.Manager;
using StatisticsAnalysisTool.StorageHistory;
using System.Threading.Tasks;
using StatisticsAnalysisTool.Models.NetworkModel;

namespace StatisticsAnalysisTool.Network.Handler;

Expand All @@ -18,7 +18,7 @@ protected override async Task OnActionAsync(BankVaultInfoEvent value)
{
if (_trackingController.IsTrackingAllowedByMainCharacter())
{
_trackingController.VaultController.SetCurrentVault(new VaultInfo(value.ObjectId, value.LocationGuidString, value.VaultGuidList, value.VaultNames, value.IconTags));
_trackingController.VaultController.SetCurrentVault(new InternalVault(value.ObjectId, value.LocationGuidString, value.VaultGuidList, value.VaultNames, value.IconTags));
}

await Task.CompletedTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected override async Task OnActionAsync(NewEquipmentItemEvent value)
{
if (_trackingController.IsTrackingAllowedByMainCharacter())
{
_trackingController.VaultController.Add(value.Item);
_trackingController.VaultController.AddDiscoveredItem(value.Item);
}

_trackingController.EntityController.AddEquipmentItem(new EquipmentItemInternal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected override async Task OnActionAsync(NewFurnitureItemEvent value)
{
if (_trackingController.IsTrackingAllowedByMainCharacter())
{
_trackingController.VaultController.Add(value.Item);
_trackingController.VaultController.AddDiscoveredItem(value.Item);
}

EstimatedMarketValueController.Add(value.Item.ItemIndex, value.Item.EstimatedMarketValueInternal, value.Item.Quality);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected override async Task OnActionAsync(NewJournalItemEvent value)
{
if (_trackingController.IsTrackingAllowedByMainCharacter())
{
_trackingController.VaultController.Add(value.Item);
_trackingController.VaultController.AddDiscoveredItem(value.Item);
}

EstimatedMarketValueController.Add(value.Item.ItemIndex, value.Item.EstimatedMarketValueInternal, value.Item.Quality);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected override async Task OnActionAsync(NewKillTrophyItemEvent value)
{
if (_trackingController.IsTrackingAllowedByMainCharacter())
{
_trackingController.VaultController.Add(value.Item);
_trackingController.VaultController.AddDiscoveredItem(value.Item);
}

EstimatedMarketValueController.Add(value.Item.ItemIndex, value.Item.EstimatedMarketValueInternal, value.Item.Quality);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected override async Task OnActionAsync(NewLaborerItemEvent value)
{
if (_trackingController.IsTrackingAllowedByMainCharacter())
{
_trackingController.VaultController.Add(value.Item);
_trackingController.VaultController.AddDiscoveredItem(value.Item);
}

EstimatedMarketValueController.Add(value.Item.ItemIndex, value.Item.EstimatedMarketValueInternal, value.Item.Quality);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected override async Task OnActionAsync(NewSimpleItemEvent value)
{
if (_trackingController.IsTrackingAllowedByMainCharacter())
{
_trackingController.VaultController.Add(value.Item);
_trackingController.VaultController.AddDiscoveredItem(value.Item);
}

EstimatedMarketValueController.Add(value.Item.ItemIndex, value.Item.EstimatedMarketValueInternal, value.Item.Quality);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using StatisticsAnalysisTool.Localization;
using StatisticsAnalysisTool.Network.PacketProviders;
using StatisticsAnalysisTool.Party;
using StatisticsAnalysisTool.StorageHistory;
using StatisticsAnalysisTool.Trade;
using StatisticsAnalysisTool.Trade.Mails;
using StatisticsAnalysisTool.Trade.Market;
Expand Down
32 changes: 32 additions & 0 deletions src/StatisticsAnalysisTool/StorageHistory/ContainerItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using StatisticsAnalysisTool.Common;
using StatisticsAnalysisTool.Models;
using StatisticsAnalysisTool.ViewModels;

namespace StatisticsAnalysisTool.StorageHistory;

public class ContainerItem : BaseViewModel
{
private int _itemIndex;
private int _quantity;

public int ItemIndex
{
get => _itemIndex;
set
{
_itemIndex = value;
OnPropertyChanged();
}
}

public int Quantity
{
get => _quantity;
set
{
_quantity = value;
OnPropertyChanged();
}
}
public Item Item => ItemController.GetItemByIndex(ItemIndex);
}
11 changes: 11 additions & 0 deletions src/StatisticsAnalysisTool/StorageHistory/ContainerItemDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Text.Json.Serialization;

namespace StatisticsAnalysisTool.StorageHistory;

public class ContainerItemDto
{
[JsonPropertyName("I")]
public int ItemIndex { get; set; }
[JsonPropertyName("Q")]
public int Quantity { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
using System;
using System.Collections.Generic;

namespace StatisticsAnalysisTool.Models.NetworkModel;
namespace StatisticsAnalysisTool.StorageHistory;

public class VaultInfo
public class InternalVault
{
public VaultInfo(long? objectId, string locationGuidString, List<Guid> containerGuidList, List<string> containerNames, List<string> containerIconTags)
public InternalVault(long? objectId, string locationGuidString, List<Guid> containerGuidList, List<string> containerNames, List<string> containerIconTags)
{
ObjectId = objectId;
LocationGuidString = locationGuidString;
Expand All @@ -24,4 +24,5 @@ public VaultInfo(long? objectId, string locationGuidString, List<Guid> container
public MapType MapType => WorldData.GetMapType(LocationGuidString);
public string MainLocationIndex { get; set; }
public string UniqueClusterName { get; set; }
public double RepairCosts { get; set; }
}
71 changes: 71 additions & 0 deletions src/StatisticsAnalysisTool/StorageHistory/StorageHistoryMapping.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using System.Collections.ObjectModel;
using System.Linq;

namespace StatisticsAnalysisTool.StorageHistory;

public static class StorageHistoryMapping
{
public static VaultDto Mapping(Vault vault)
{
return new VaultDto()
{
Location = vault.Location,
MainLocationIndex = vault.MainLocationIndex,
MapType = vault.MapType,
VaultContainer = vault.VaultContainer.Select(Mapping).ToList()
};
}

public static Vault Mapping(VaultDto vaultDto)
{
return new Vault()
{
Location = vaultDto.Location,
MainLocationIndex = vaultDto.MainLocationIndex,
MapType = vaultDto.MapType,
VaultContainer = vaultDto.VaultContainer.Select(Mapping).ToList()
};
}

public static VaultContainerDto Mapping(VaultContainer vaultContainer)
{
return new VaultContainerDto()
{
LastUpdate = vaultContainer.LastUpdate,
Guid = vaultContainer.Guid,
Name = vaultContainer.Name,
Icon = vaultContainer.Icon,
Items = vaultContainer.Items.Select(Mapping).ToList()
};
}

public static VaultContainer Mapping(VaultContainerDto vaultContainerDto)
{
return new VaultContainer()
{
LastUpdate = vaultContainerDto.LastUpdate,
Guid = vaultContainerDto.Guid,
Name = vaultContainerDto.Name,
Icon = vaultContainerDto.Icon,
Items = new ObservableCollection<ContainerItem>(vaultContainerDto.Items.Select(Mapping))
};
}

public static ContainerItemDto Mapping(ContainerItem containerItem)
{
return new ContainerItemDto()
{
ItemIndex = containerItem.ItemIndex,
Quantity = containerItem.Quantity
};
}

public static ContainerItem Mapping(ContainerItemDto containerItemDto)
{
return new ContainerItem()
{
ItemIndex = containerItemDto.ItemIndex,
Quantity = containerItemDto.Quantity
};
}
}
75 changes: 75 additions & 0 deletions src/StatisticsAnalysisTool/StorageHistory/Vault.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using StatisticsAnalysisTool.Cluster;
using StatisticsAnalysisTool.GameFileData;
using StatisticsAnalysisTool.Localization;
using StatisticsAnalysisTool.ViewModels;
using System.Collections.Generic;

namespace StatisticsAnalysisTool.StorageHistory;

public class Vault : BaseViewModel
{
private string _location;
private string _mainLocationIndex;
private MapType _mapType;
private List<VaultContainer> _vaultContainer = new();

public string Location
{
get => _location;
set
{
_location = value;
OnPropertyChanged();
}
}

public string MainLocationIndex
{
get => _mainLocationIndex;
set
{
_mainLocationIndex = value;
OnPropertyChanged();
}
}

public MapType MapType
{
get => _mapType;
set
{
_mapType = value;
OnPropertyChanged();
}
}

public List<VaultContainer> VaultContainer
{
get => _vaultContainer;
set
{
_vaultContainer = value;
OnPropertyChanged();
}
}

public string MainLocation => WorldData.GetUniqueNameOrDefault(MainLocationIndex);

public string LocationDisplayString
{
get
{
if (MapType is MapType.Hideout)
{
return $"{Location} ({LocalizationController.Translation("HIDEOUT")}) - {MainLocation}";
}

if (MapType is MapType.Island)
{
return $"{Location} ({LocalizationController.Translation("ISLAND")})";
}

return Location;
}
}
}
Loading

0 comments on commit b36e82d

Please sign in to comment.