Skip to content
This repository was archived by the owner on Feb 11, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
93d6f98
Mode data to yml file
AkiniKites Jan 26, 2022
a17a36e
Move job data to file
AkiniKites Jan 26, 2022
e54b5d0
Code cleanup
AkiniKites Jan 26, 2022
a9a414a
Add overrides
AkiniKites Jan 26, 2022
0433b29
Add reset button
AkiniKites Jan 26, 2022
3c593f0
Update version and url
AkiniKites Jan 26, 2022
3684cae
undo version changes
AkiniKites Feb 4, 2022
cb6905d
Improved repo definition
AkiniKites Feb 4, 2022
0b89bd5
Add conditional reset
AkiniKites Feb 4, 2022
dc9acca
Fix repo name
AkiniKites Feb 4, 2022
ff60b6f
Remove static references in repo
AkiniKites Feb 5, 2022
cad4542
Actually remove static references
AkiniKites Feb 5, 2022
e52f4e7
Fix Gaelicat aggro
AkiniKites Feb 26, 2022
672bb51
Merge remote-tracking branch 'origin/master'
AkiniKites Feb 26, 2022
f4c283e
Fix aggro and undead on some mobs
AkiniKites Feb 27, 2022
892d12d
Merge branch 'master-github-master'
AkiniKites Jul 29, 2022
431fd8b
Add sketchy yaml merge
AkiniKites Jul 29, 2022
6a9e4bd
Update mob data
AkiniKites Jul 29, 2022
9880d3f
Move project into dir
AkiniKites Jul 29, 2022
18014e2
Update readme
AkiniKites Jul 29, 2022
80e9028
Update for 6.2
AkiniKites Sep 13, 2022
5eeb77e
Add mob name, fix merge
AkiniKites Sep 13, 2022
4255333
Update mobs
AkiniKites Jan 13, 2023
5e968b8
Update to net 7
AkiniKites Jan 13, 2023
36ee28a
Update nuget
AkiniKites Jan 13, 2023
c2f719c
Update for 6.5
AkiniKites Oct 5, 2023
1a6180f
Update to net 8
AkiniKites Mar 22, 2024
7717852
Updated to new plugin log
AkiniKites May 29, 2024
1b88359
Update for dalamud 10
AkiniKites Jun 29, 2024
ce21d78
Update to 7.0
Jul 11, 2024
18169f4
Update to 7.0
AkiniKites Sep 9, 2024
105c3a6
Fix some mobs
AkiniKites Nov 24, 2024
9d6de05
Fixes for 7.1
AkiniKites Nov 25, 2024
c6d1658
Merge remote-tracking branch 'origin/master'
AkiniKites Nov 25, 2024
fe61b3a
Fix mob data
AkiniKites Nov 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .editorconfig

This file was deleted.

15 changes: 0 additions & 15 deletions Attributes/AliasesAttribute.cs

This file was deleted.

15 changes: 0 additions & 15 deletions Attributes/CommandAttribute.cs

This file was deleted.

9 changes: 0 additions & 9 deletions Attributes/DoNotShowInHelpAttribute.cs

This file was deleted.

15 changes: 0 additions & 15 deletions Attributes/HelpMessageAttribute.cs

This file was deleted.

11 changes: 0 additions & 11 deletions DalamudPackager.targets

This file was deleted.

497 changes: 0 additions & 497 deletions DataHandler.cs

This file was deleted.

6 changes: 3 additions & 3 deletions DeepDungeonDex.sln
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
# Visual Studio Version 17
VisualStudioVersion = 17.1.32407.343
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DeepDungeonDex", "DeepDungeonDex.csproj", "{517A4352-7F10-48B9-B332-BB592157E377}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DeepDungeonDex", "DeepDungeonDex\DeepDungeonDex.csproj", "{517A4352-7F10-48B9-B332-BB592157E377}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F1FD06F1-DF12-43AD-B211-07E0999D9391}"
EndProject
Expand Down
4 changes: 2 additions & 2 deletions Configuration.cs → DeepDungeonDex/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public class Configuration : IPluginConfiguration
public bool HideBasedOnJob { get; set; } = false;

// Add any other properties or methods here.
[JsonIgnore] private DalamudPluginInterface pluginInterface;
[JsonIgnore] private IDalamudPluginInterface pluginInterface;

public void Initialize(DalamudPluginInterface pluginInterface)
public void Initialize(IDalamudPluginInterface pluginInterface)
{
this.pluginInterface = pluginInterface;
}
Expand Down
9 changes: 9 additions & 0 deletions DeepDungeonDex/DalamudPackager.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<Target Name="Package" AfterTargets="Build" Condition="'$(Configuration)' == 'Debug'">
<DalamudPackager
ProjectDir="$(ProjectDir)"
OutputPath="$(OutputPath)"
AssemblyName="$(AssemblyName)"
MakeZip="false"/>
</Target>
</Project>
133 changes: 133 additions & 0 deletions DeepDungeonDex/Data/DataRepo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Dalamud.Logging;
using Dalamud.Plugin;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;

namespace DeepDungeonDex.Data
{
public class DataRepo<T> where T : class, IRepoData<T>
{
private object _lock = new();
private bool _dataLoaded = false;

private Dictionary<uint, T> _data;
private Dictionary<uint, T> _overrideData;

public string Name { get; init; }
public string DbPath { get; init; }
public string OverrideDbPath { get; init; }

public static DataRepo<T> Create(IDalamudPluginInterface plugin, string name)
{
var dir = plugin.AssemblyLocation.Directory.FullName;
var repo = new DataRepo<T>()
{
Name = name,
DbPath = Path.Combine(dir, $"{name}.yml"),
OverrideDbPath = Path.Combine(plugin.GetPluginConfigDirectory(), $"{name}-overrides.yml")
};

return repo;
}

private DataRepo() { }

public T Get(uint id)
{
return Get(id, out _);
}
public T Get(uint id, out bool isOverride)
{
isOverride = false;
if (!_dataLoaded)
return null;

if (_overrideData.TryGetValue(id, out var value))
{
isOverride = true;
return value.Clone();
}
if (_data.TryGetValue(id, out value))
return value.Clone();
return null;
}

public void SaveOverride(uint id, T data)
{
if (!_dataLoaded)
return;

_overrideData[id] = data;
Save();
}

public void ClearOverride(uint id)
{
if (!_dataLoaded)
return;

_overrideData.Remove(id);
Save();
}

public DataRepo<T> Load()
{
Task.Run(() =>
{
try
{
var deserializer = new DeserializerBuilder()
.WithNamingConvention(CamelCaseNamingConvention.Instance)
.Build();

var yaml = File.ReadAllText(DbPath);
_data = deserializer.Deserialize<Dictionary<uint, T>>(yaml);

if (File.Exists(OverrideDbPath))
{
yaml = File.ReadAllText(OverrideDbPath);
_overrideData = deserializer.Deserialize<Dictionary<uint, T>>(yaml);
}
else
_overrideData = new Dictionary<uint, T>();

Plugin.Log.Information($"Loaded data: mobs={_data.Count}, overrides={_overrideData.Count}");
_dataLoaded = true;
}
catch(Exception ex)
{
Plugin.Log.Error($"Error loading database ({Name}): {ex}");
}
});

return this;
}

private void Save()
{
Task.Run(() =>
{
try
{
lock (_lock)
{
var serializer = new SerializerBuilder()
.WithNamingConvention(CamelCaseNamingConvention.Instance)
.Build();

var yaml = serializer.Serialize(_overrideData);
File.WriteAllText(OverrideDbPath, yaml);
}
}
catch (Exception ex)
{
Plugin.Log.Error($"Error saving database ({Name}): " + ex);
}
});
}
}
}
13 changes: 13 additions & 0 deletions DeepDungeonDex/Data/IRepoData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DeepDungeonDex.Data
{
public interface IRepoData<T>
{
T Clone();
}
}
32 changes: 32 additions & 0 deletions DeepDungeonDex/Data/JobData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DeepDungeonDex.Data
{
public class JobData : IRepoData<JobData>
{
public string Name { get; set; }

public bool CanStun { get; set; }
public bool CanSleep { get; set; }
public bool CanBind { get; set; }
public bool CanHeavy { get; set; }
public bool CanSlow { get; set; }

public JobData Clone()
{
return new JobData()
{
Name = Name,
CanStun = CanStun,
CanSleep = CanSleep,
CanBind = CanBind,
CanHeavy = CanHeavy,
CanSlow = CanSlow
};
}
}
}
70 changes: 70 additions & 0 deletions DeepDungeonDex/Data/MobData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DeepDungeonDex.Data
{
public class MobData : IRepoData<MobData>
{
public class Vulnerabilities
{
public bool? CanStun;
public bool? CanHeavy;
public bool? CanSlow;
public bool? CanSleep;
public bool? CanBind;
public bool? IsUndead;

public Vulnerabilities() { }
public Vulnerabilities(Vulnerabilities vuln)
{
CanStun = vuln.CanStun;
CanHeavy = vuln.CanHeavy;
CanSlow = vuln.CanSlow;
CanSleep = vuln.CanSleep;
CanBind = vuln.CanBind;
IsUndead = vuln.IsUndead;
}
}
public Vulnerabilities Vuln { get; set; }

public string Name { get; set; }
public string MobNotes { get; set; }

public enum ThreatLevel
{
Unspecified,
Easy,
Caution,
Dangerous,
Vicious
}
public ThreatLevel Threat { get; set; }

public enum AggroType
{
Unspecified,
Sight,
Sound,
Proximity,
Boss
}
public AggroType Aggro { get; set; }

public MobData() { }

public MobData Clone()
{
return new MobData()
{
Vuln = new Vulnerabilities(Vuln),
Name = Name,
MobNotes = MobNotes,
Threat = Threat,
Aggro = Aggro
};
}
}
}
Loading