Skip to content

Commit

Permalink
Manager: Add skill type to game data gathering
Browse files Browse the repository at this point in the history
  • Loading branch information
Sejsel committed Jul 25, 2023
1 parent fbe3d18 commit 74dba55
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
3 changes: 2 additions & 1 deletion ArcdpsLogManager/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ This is the full changelog of the arcdps Log Manager.

## Log Manager v1.9 (unreleased)
#### New features
s Added support for Silent Surf CM
- Added support for Silent Surf CM and NM
- Added fractal scale as a column to the log list; right-click to hide/show (in logs since 2023-07-16)
- Added fractal scale to the log detail panel (in logs since 2023-07-16)
- *EVTC Inspector*: Added rudimentary support for the reworked effect events (since 2023-07-16).
- Added ability/buff column for skills to the Game data gathering tab (View -> Debug Data must be enabled to see this tab).
#### Changes
- The game data collecting tab (requires Show -> Debug data to be enabled) now scans multiple files at once. This
provides a nice performance benefit on SSDs, but may result in slowdowns with HDDs (not tested on a HDD).
Expand Down
36 changes: 29 additions & 7 deletions ArcdpsLogManager/Sections/GameDataGathering.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,25 @@ public override int GetHashCode()
}
}

private enum SkillType
{
Unknown,
Buff,
Ability,
}

private class SkillData : IEquatable<SkillData>
{
public uint SkillId { get; }
public string Name { get; }
public List<LogData> Logs { get; } = new List<LogData>();
public SkillType Type { get; }

public SkillData(uint skillId, string name)
public SkillData(uint skillId, string name, SkillType type)
{
SkillId = skillId;
Name = name;
Type = type;
}

public bool Equals(SkillData other)
Expand All @@ -92,7 +101,7 @@ public override bool Equals(object obj)

public override int GetHashCode()
{
return HashCode.Combine(SkillId, Name);
return HashCode.Combine(SkillId, Name, Type);
}

public static bool operator ==(SkillData left, SkillData right)
Expand Down Expand Up @@ -228,6 +237,14 @@ public GameDataCollecting(LogList logList, LogCache logCache, ApiData apiData, L
}
});
skillGridView.Columns.Add(new GridColumn
{
HeaderText = "Type",
DataCell = new TextBoxCell()
{
Binding = new DelegateBinding<SkillData, string>(x => x.Type.ToString())
}
});
skillGridView.Columns.Add(new GridColumn
{
HeaderText = "Times seen",
DataCell = new TextBoxCell()
Expand Down Expand Up @@ -358,6 +375,7 @@ private void GatherData(LogList logList, ProgressBar progressBar, Label progress
{
return Task.Run(() =>
{
// TODO: Change List into some kind of concurrent bag
var species = new ConcurrentDictionary<int, ConcurrentDictionary<SpeciesData, List<LogData>>>();
var skills = new ConcurrentDictionary<uint, ConcurrentDictionary<SkillData, List<LogData>>>();
Expand All @@ -384,12 +402,10 @@ private void GatherData(LogList logList, ProgressBar progressBar, Label progress
int id = agent.SpeciesId;
string name = agent.Name;
// Ignore missing data. If the species id, in most cases all other data is meaningless.
if (id == 0) continue;
var speciesData = new SpeciesData(id, name);
var dictForSpecies =
species.GetOrAdd(id, new ConcurrentDictionary<SpeciesData, List<LogData>>());
var dictForSpecies = species.GetOrAdd(id, new ConcurrentDictionary<SpeciesData, List<LogData>>());
var listForSpeciesData = dictForSpecies.GetOrAdd(speciesData, new List<LogData>());
listForSpeciesData.Add(log);
Expand All @@ -399,11 +415,17 @@ private void GatherData(LogList logList, ProgressBar progressBar, Label progress
{
uint id = skill.Id;
string name = skill.Name;
var skillType = (skill.SkillData, skill.BuffData) switch
{
(null, null) => SkillType.Unknown,
(_, null) => SkillType.Ability,
(null, _) => SkillType.Buff,
_ => SkillType.Unknown,
};
// Ignore missing data. If the species id, in most cases all other data is meaningless.
if (id == 0) continue;
var skillData = new SkillData(id, name);
var skillData = new SkillData(id, name, skillType);
var dictForSkill = skills.GetOrAdd(id, new ConcurrentDictionary<SkillData, List<LogData>>());
var listForSkillData = dictForSkill.GetOrAdd(skillData, new List<LogData>());
Expand Down

0 comments on commit 74dba55

Please sign in to comment.