Skip to content

Commit

Permalink
Merge branch 'storage-chest-overview'
Browse files Browse the repository at this point in the history
  • Loading branch information
Triky313 committed Apr 20, 2022
2 parents fbaac54 + ed74e11 commit f13b328
Show file tree
Hide file tree
Showing 54 changed files with 1,310 additions and 81 deletions.
3 changes: 3 additions & 0 deletions src/StatisticsAnalysisTool/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
<setting name="MailsFileName" serializeAs="String">
<value>Mails.json</value>
</setting>
<setting name="VaultsFileName" serializeAs="String">
<value>Vaults.json</value>
</setting>
</StatisticsAnalysisTool.Properties.Settings>
</userSettings>
<applicationSettings>
Expand Down
1 change: 1 addition & 0 deletions src/StatisticsAnalysisTool/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<ResourceDictionary Source="Styles/DungeonStyles.xaml" />
<ResourceDictionary Source="Styles/DamageMeterStyles.xaml" />
<ResourceDictionary Source="Styles/MailMonitoringStyle.xaml" />
<ResourceDictionary Source="Styles/StorageHistoryStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Expand Down
2 changes: 1 addition & 1 deletion src/StatisticsAnalysisTool/Common/ExtensionMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static Dictionary<int, T> ToDictionary<T>(this IEnumerable<T> array)
.Select((v, i) => new { Key = i, Value = v })
.ToDictionary(o => o.Key, o => o.Value);
}

public static string ToTimerString(this TimeSpan span)
{
return $"{span.Hours:00}:{span.Minutes:00}:{span.Seconds:00}";
Expand Down
62 changes: 31 additions & 31 deletions src/StatisticsAnalysisTool/Common/Locations.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using LiveChartsCore.SkiaSharpView.Painting;
using SkiaSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
Expand All @@ -12,40 +12,40 @@ public static class Locations
{
public static readonly Dictionary<Location, string> Names = new()
{
{Location.Thetford, "Thetford"},
{Location.SwampCross, "Swamp Cross"},
{Location.Lymhurst, "Lymhurst"},
{Location.ForestCross, "Forest Cross"},
{Location.Bridgewatch, "Bridgewatch"},
{Location.SteppeCross, "Steppe Cross"},
{Location.HighlandCross, "Highland Cross"},
{Location.BlackMarket, "Black Market"},
{Location.Martlock, "Martlock"},
{Location.Caerleon, "Caerleon"},
{Location.FortSterling, "Fort Sterling"},
{Location.MountainCross, "Mountain Cross"},
{Location.ArthursRest, "Arthur's Rest"},
{Location.MerlynsRest, "Merlyn's Rest"},
{Location.MorganasRest, "Morgana's Rest"}
{ Location.Thetford, "Thetford" },
{ Location.SwampCross, "Swamp Cross" },
{ Location.Lymhurst, "Lymhurst" },
{ Location.ForestCross, "Forest Cross" },
{ Location.Bridgewatch, "Bridgewatch" },
{ Location.SteppeCross, "Steppe Cross" },
{ Location.HighlandCross, "Highland Cross" },
{ Location.BlackMarket, "Black Market" },
{ Location.Martlock, "Martlock" },
{ Location.Caerleon, "Caerleon" },
{ Location.FortSterling, "Fort Sterling" },
{ Location.MountainCross, "Mountain Cross" },
{ Location.ArthursRest, "Arthur's Rest" },
{ Location.MerlynsRest, "Merlyn's Rest" },
{ Location.MorganasRest, "Morgana's Rest" }
};

public static readonly Dictionary<Location, string> ParameterNames = new()
{
{Location.Thetford, "Thetford"},
{Location.SwampCross, "Swamp Cross"},
{Location.Lymhurst, "Lymhurst"},
{Location.ForestCross, "Forest Cross"},
{Location.Bridgewatch, "Bridgewatch"},
{Location.SteppeCross, "Steppe Cross"},
{Location.HighlandCross, "Highland Cross"},
{Location.BlackMarket, "Black Market"},
{Location.Martlock, "Martlock"},
{Location.Caerleon, "Caerleon"},
{Location.FortSterling, "Fort Sterling"},
{Location.MountainCross, "Mountain Cross"},
{Location.ArthursRest, "Arthurs Rest"},
{Location.MerlynsRest, "Merlyns Rest"},
{Location.MorganasRest, "Morganas Rest"}
{ Location.Thetford, "Thetford" },
{ Location.SwampCross, "Swamp Cross" },
{ Location.Lymhurst, "Lymhurst" },
{ Location.ForestCross, "Forest Cross" },
{ Location.Bridgewatch, "Bridgewatch" },
{ Location.SteppeCross, "Steppe Cross" },
{ Location.HighlandCross, "Highland Cross" },
{ Location.BlackMarket, "Black Market" },
{ Location.Martlock, "Martlock" },
{ Location.Caerleon, "Caerleon" },
{ Location.FortSterling, "Fort Sterling" },
{ Location.MountainCross, "Mountain Cross" },
{ Location.ArthursRest, "Arthurs Rest" },
{ Location.MerlynsRest, "Merlyns Rest" },
{ Location.MorganasRest, "Morganas Rest" }
};

public static string GetName(Location location)
Expand Down
12 changes: 6 additions & 6 deletions src/StatisticsAnalysisTool/Enumerations/EventCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public enum EventCodes
NewCharacter = 26,
NewEquipmentItem = 27, // map[0:657 1:2036 2:1 4:28169331 5:Apolo540 6:3 7:90000000 8:[] 9:[0] 252:27] (0: ObjectId, 1: ItemId, 2: Amount, 4: Avarage Market Price, 5: CrafterName)
NewSimpleItem = 28, // map[0:505 1:7006 2:1 3:true 4:29033970 252:27] (0: ObjectId, 1: ItemId, 2: Amount)
NewFurnitureItem,
NewJournalItem,
NewLaborerItem,
NewFurnitureItem = 29,
NewJournalItem = 30,
NewLaborerItem = 31,
NewSimpleHarvestableObject,
NewSimpleHarvestableObjectList,
NewHarvestableObject,
Expand Down Expand Up @@ -91,7 +91,7 @@ public enum EventCodes
RegenerationPlayerComboChanged,
DurabilityChanged,
NewLoot,
AttachItemContainer, // map[0:78 1:[-99 -50 125 -49 86 0 -115 74 -74 67 9 101 -87 -71 -66 -10] 3:[0 0 0 0 0 0 656 657] 4:8 252:89] (0: ObjectId, 3: ItemId[])
AttachItemContainer = 88, // map[0:78 1:[-99 -50 125 -49 86 0 -115 74 -74 67 9 101 -87 -71 -66 -10] 3:[0 0 0 0 0 0 656 657] 4:8 252:89] (0: ObjectId, 3: ItemId[])
DetachItemContainer, // map[0:[-95 72 -77 -75 -70 34 127 73 -114 -96 28 8 75 -107 -106 125] 252:90]
InvalidateItemContainer,
LockItemContainer,
Expand Down Expand Up @@ -380,8 +380,8 @@ public enum EventCodes
UnlockVanityUnlock,
AvatarUnlocked,
CustomizationChanged,
BaseVaultInfo,
GuildVaultInfo,
GuildVaultInfo = 385,
BaseVaultInfo = 386,
BankVaultInfo,
RecoveryVaultPlayerInfo,
RecoveryVaultGuildInfo,
Expand Down
2 changes: 1 addition & 1 deletion src/StatisticsAnalysisTool/Enumerations/OperationCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public enum OperationCodes
AuctionGetMyOpenAuctions,
AuctionGetItemAverageStats,
AuctionGetItemAverageValue,
ContainerOpen,
ContainerOpen = 92, // map[0: ObjectId = 405 1:1 2: ObjectGuid = [-46 37 -21 125 -40 -77 125 76 -96 -6 39 120 -46 -21 11 -39] 253:92]
ContainerClose,
ContainerManageSubContainer,
Respawn,
Expand Down
19 changes: 19 additions & 0 deletions src/StatisticsAnalysisTool/Enumerations/VaultLocation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace StatisticsAnalysisTool.Enumerations;

public enum VaultLocation
{
Unknown = 0,
BankOfThetford = 0006,
BankOfLymhurst = 1001,
ForestCross = 1006,
SteppeCross = 2002,
BankOfBridgewatch = 2003,
HighlandCross = 3002,
BankOfCaerleon = 3006,
BankOfMartlock = 3007,
BankOfFortSterling = 4001,
MountainCross = 4006,
ArthursRest = 4300,
MerlynsRest = -2,
MorganasRest = -3
}
2 changes: 2 additions & 0 deletions src/StatisticsAnalysisTool/Languages/de-DE.xml
Original file line number Diff line number Diff line change
Expand Up @@ -560,4 +560,6 @@
<translation name="SELL_EXPIRED">Verkauf abgelaufen</translation>
<translation name="BUY_EXPIRED">Kauf abgelaufen</translation>
<translation name="TO">bis</translation>
<translation name="STORAGE_HISTORY">Lager Historie</translation>
<translation name="BANK">Bank</translation>
</translations>
2 changes: 2 additions & 0 deletions src/StatisticsAnalysisTool/Languages/en-US.xml
Original file line number Diff line number Diff line change
Expand Up @@ -560,4 +560,6 @@
<translation name="SELL_EXPIRED">Sell expired</translation>
<translation name="BUY_EXPIRED">Buy expired</translation>
<translation name="TO">to</translation>
<translation name="STORAGE_HISTORY">Storage History</translation>
<translation name="BANK">Bank</translation>
</translations>
103 changes: 103 additions & 0 deletions src/StatisticsAnalysisTool/Models/BindingModel/VaultBindings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
using System;
using StatisticsAnalysisTool.Models.NetworkModel;
using StatisticsAnalysisTool.Properties;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Windows;

namespace StatisticsAnalysisTool.Models.BindingModel;

public class VaultBindings : INotifyPropertyChanged
{
private List<ContainerItem> _vaultContainerContent;
private List<Vault> _vaults;
private Vault _vaultSelected;
private List<VaultContainer> _vaultContainer;
private VaultContainer _vaultContainerSelected;
private Visibility _lastUpdateVisibility = Visibility.Hidden;
private DateTime _lastUpdate;

public List<Vault> Vaults
{
get => _vaults;
set
{
_vaults = value;
OnPropertyChanged();
}
}

public Vault VaultSelected
{
get => _vaultSelected;
set
{
_vaultSelected = value;
VaultContainer = _vaultSelected.VaultContainer.FindAll(x => x.LastUpdate.Ticks > 0).OrderBy(y => y.Name).ToList();
OnPropertyChanged();
}
}

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

public VaultContainer VaultContainerSelected
{
get => _vaultContainerSelected;
set
{
_vaultContainerSelected = value;
VaultContainerContent = _vaultContainer?.FirstOrDefault(x => x.Guid == _vaultContainerSelected.Guid)?.Items ?? new List<ContainerItem>();
LastUpdate = _vaultContainerSelected?.LastUpdate ?? new DateTime(0);
LastUpdateVisibility = _vaultContainerSelected?.LastUpdate.Ticks <= 1 ? Visibility.Hidden : Visibility.Visible;
OnPropertyChanged();
}
}

public List<ContainerItem> VaultContainerContent
{
get => _vaultContainerContent;
set
{
_vaultContainerContent = value;
OnPropertyChanged();
}
}

public Visibility LastUpdateVisibility
{
get => _lastUpdateVisibility;
set
{
_lastUpdateVisibility = value;
OnPropertyChanged();
}
}

public DateTime LastUpdate
{
get => _lastUpdate;
set
{
_lastUpdate = value;
OnPropertyChanged();
}
}

public event PropertyChangedEventHandler PropertyChanged;

[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
1 change: 1 addition & 0 deletions src/StatisticsAnalysisTool/Models/MainWindowTranslation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class MainWindowTranslation
public static string Dungeons => LanguageController.Translation("DUNGEONS");
public static string PlayerInformation => LanguageController.Translation("PLAYER_INFORMATION");
public static string MailMonitoring => LanguageController.Translation("MAIL_MONITORING");
public static string StorageHistory => LanguageController.Translation("STORAGE_HISTORY");
public static string Logging => LanguageController.Translation("LOGGING");
public static string TrackingIsActive => LanguageController.Translation("TRACKING_IS_ACTIVE");
public static string TrackingIsPartiallyActive => LanguageController.Translation("TRACKING_IS_PARTIALLY_ACTIVE");
Expand Down
12 changes: 12 additions & 0 deletions src/StatisticsAnalysisTool/Models/NetworkModel/ContainerItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
using StatisticsAnalysisTool.Common;

namespace StatisticsAnalysisTool.Models.NetworkModel;

public class ContainerItem
{
public int ItemIndex { get; set; }
[JsonIgnore]
public Item Item => ItemController.GetItemByIndex(ItemIndex);
public int Quantity { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

namespace StatisticsAnalysisTool.Models.NetworkModel
{
public class DiscoveredLoot
public class DiscoveredItem
{
public DiscoveredLoot()
public DiscoveredItem()
{
UtcPickupTime = DateTime.UtcNow;
UtcDiscoveryTime = DateTime.UtcNow;
}

public long ObjectId { get; set; }
public int ItemId { get; set; }
public DateTime UtcPickupTime { get; }
public int ItemIndex { get; set; }
public DateTime UtcDiscoveryTime { get; }
public int Quantity { get; set; }
public string BodyName { get; set; }
public string LooterName { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;

namespace StatisticsAnalysisTool.Models.NetworkModel;

public class ItemContainerObject
{
public ItemContainerObject(long? objectId, Guid containerGuid, List<int> slotItemId)
{
ObjectId = objectId;
ContainerGuid = containerGuid;
SlotItemId = slotItemId;

LastUpdate = DateTime.UtcNow;
}

public DateTime LastUpdate { get; }
public long? ObjectId { get; set; }
public Guid ContainerGuid { get; set; }
public List<int> SlotItemId { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public enum ContainerType
Player
}

public class Container
public class LootContainer
{
public string Id { get; set; }

Expand Down
17 changes: 17 additions & 0 deletions src/StatisticsAnalysisTool/Models/NetworkModel/Vault.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using StatisticsAnalysisTool.Enumerations;
using StatisticsAnalysisTool.GameData;
using StatisticsAnalysisTool.Network.Manager;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace StatisticsAnalysisTool.Models.NetworkModel;

public class Vault
{
public string Location { get; set; }
[JsonIgnore]
public VaultLocation VaultLocation => VaultController.GetVaultLocation(Location);
[JsonIgnore]
public string LocationName => WorldData.GetUniqueNameOrDefault(VaultController.GetVaultLocationIndex(Location));
public List<VaultContainer> VaultContainer { get; set; } = new();
}
13 changes: 13 additions & 0 deletions src/StatisticsAnalysisTool/Models/NetworkModel/VaultContainer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;

namespace StatisticsAnalysisTool.Models.NetworkModel;

public class VaultContainer
{
public DateTime LastUpdate { get; set; }
public Guid Guid { get; set; }
public string Name { get; set; }
public string Icon { get; set; }
public List<ContainerItem> Items { get; set; } = new ();
}
Loading

0 comments on commit f13b328

Please sign in to comment.